Use numpy.array to use shape attribute.

>>> import numpy as np
>>> X = np.array([
...     [[-9.035250067710876], [7.453250169754028], [33.34074878692627]],
...     [[-6.63700008392334], [5.132999956607819], [31.66075038909912]],
...     [[-5.1272499561309814], [8.251499891281128], [30.925999641418457]]
... ])
>>> X.shape
(3L, 3L, 1L)

NOTE X.shape returns 3-items tuple for the given array; [n, T] = X.shape raises ValueError.

Answer from falsetru on Stack Overflow
🌐
PyTorch Forums
discuss.pytorch.org › t › attributeerror-list-object-has-no-attribute-shape › 124100
AttributeError: 'list' object has no attribute 'shape' - PyTorch Forums
June 14, 2021 - i’m trying to extract features and got this error from this line feats = model(samples).copy() features = torch.zeros(len(data_loader.dataset), feats.shape[-1]) i read that i should convert it to numpy but couldn’t write it well the first error was AttributeError: ‘list’ object has no attribute ‘clone’ so i changed it to copy but got current error in the title of the post
Discussions

AttributeError: 'list' object has no attribute 'shape'
Search before asking I have searched the YOLOv5 issues and found no similar bug report. YOLOv5 Component Training Bug Environment No response Minimal Reproducible Example No response Additional No ... More on github.com
🌐 github.com
7
February 13, 2023
Visualizing_embeddings_in_2D - AttributeError: 'list' object has no attribute 'shape'
When I run the examples/Visualizing_embeddings_in_2D.ipynb notebook, I get an error during tsne.fit_transform(matrix): 791 def _check_params_vs_input(self, X): --> 792 if self.perplexity >= X.shape[0]: 793 raise ValueError("perplexity must be less than n_samples") AttributeError: 'list' object has ... More on github.com
🌐 github.com
3
November 25, 2022
C3W4 'list' object has no attribute 'shape'
My function features_and_labels runs. But the labels reported from the test have the wrong shape: (1, 5, 3211) when it should be (5, 3211) Please advise! Thanks! =========================================================== Also, when running the function on the whole corpus I get: AttributeError ... More on community.deeplearning.ai
🌐 community.deeplearning.ai
1
0
October 24, 2022
AttributeError: 'list' object has no attribute 'values'
I think values() is used for dictionaries, not lists More on reddit.com
🌐 r/learnpython
11
1
June 21, 2020
🌐
DeepLearning.AI
community.deeplearning.ai › course q&a › machine learning specialization › supervised ml: regression and classification
Error: list object has no attribute shape - Supervised ML: Regression and Classification - DeepLearning.AI
June 16, 2023 - Just trying to run the week 1 optional lab code of cost function in a jupyter notebook where this error pops out “list” object has no shape attribute. AttributeError Traceback (most recent cal…
🌐
Researchdatapod
researchdatapod.com › home › how to solve python attributeerror: ‘list’ object has no attribute ‘shape’
How to Solve Python AttributeError: ‘list’ object has no attribute ‘shape’ - The Research Scientist Pod
February 23, 2022 - AttributeError occurs in a Python ... object has no attribute ‘shape’” tells us that the list object we are handling does not have the shape attribute....
🌐
Bobby Hadz
bobbyhadz.com › blog › python-attributeerror-list-object-has-no-attribute-shape
AttributeError: 'list' object has no attribute 'shape' | bobbyhadz
April 8, 2024 - Copied!my_list = [0, 1, 2, 3, 4, 5] # ⛔️ AttributeError: 'list' object has no attribute 'reshape' reshaped = my_list.reshape((3, 2))
🌐
Itsourcecode
itsourcecode.com › home › attributeerror: list object has no attribute shape [solved]
Attributeerror: list object has no attribute shape [SOLVED]
March 24, 2023 - The “shape” attribute is used to retrieve the dimensions of a NumPy array, but it is not applicable to a Python list because lists are not structured as arrays with defined dimensions.
🌐
GitHub
github.com › ultralytics › yolov5 › issues › 10967
AttributeError: 'list' object has no attribute 'shape' · Issue #10967 · ultralytics/yolov5
February 13, 2023 - AttributeError: 'list' object has no attribute 'shape'#10967 · Copy link · Labels · StaleStale and schedule for closing soonStale and schedule for closing soonbugSomething isn't workingSomething isn't working · XL634663985 · opened · on Feb 13, 2023 · Issue body actions ·
Author   XL634663985
Find elsewhere
🌐
GitHub
github.com › openai › openai-cookbook › issues › 37
Visualizing_embeddings_in_2D - AttributeError: 'list' object has no attribute 'shape' · Issue #37 · openai/openai-cookbook
November 25, 2022 - When I run the examples/Visualizing_embeddings_in_2D.ipynb notebook, I get an error during tsne.fit_transform(matrix): 791 def _check_params_vs_input(self, X): --> 792 if self.perplexity >= X.shape[0]: 793 raise ValueError("perplexity must be less than n_samples") AttributeError: 'list' object has ...
Author   drnic
🌐
DeepLearning.AI
community.deeplearning.ai › course q&a › tensorflow developer professional › natural language processing in tensorflow
C3W4 'list' object has no attribute 'shape' - Natural Language Processing in TensorFlow - DeepLearning.AI
October 24, 2022 - My function features_and_labels runs. But the labels reported from the test have the wrong shape: (1, 5, 3211) when it should be (5, 3211) Please advise! Thanks! =========================================================== Also, when running the function on the whole corpus I get: AttributeError Traceback (most recent call last) in 2 features, labels = features_and_labels(input_sequences, total_words) 3 ----> 4 print(f"features have shape: {features.shape}“) ...
🌐
Reddit
reddit.com › r/learnpython › attributeerror: 'list' object has no attribute 'values'
r/learnpython on Reddit: AttributeError: 'list' object has no attribute 'values'
June 21, 2020 -

I am getting an Attribute Error on this part of my code:

CSV_dict = {}
    with open(argv[1]) as csvfile:
        csv_file = csv.reader(csvfile)
        next(csv_file)
        for row in csv_file:
            CSV_dict[row[0]] = row[1:]
            
        for row in CSV_dict:
            if row.values() == STR_dict:
                print(row.key())

more specifically on this line:

if row.values()  == STR_dict:

What is the work around? I want to compare all the values of each row in my "CSV_dict" to "STR_dict" - which happens to be a single list of the correct values.

🌐
GitHub
github.com › meta-pytorch › captum › issues › 642
integrated_gradients.attribute error: 'list' object has no attribute 'shape' · Issue #642 · meta-pytorch/captum
March 26, 2021 - ~/anaconda3/envs/tf/lib/python3.7/site-packages/captum/attr/_utils/common.py in _select_targets(output, target) 449 return output 450 --> 451 num_examples = output.shape[0] 452 dims = len(output.shape) 453 if isinstance(target, (int, tuple)): AttributeError: 'list' object has no attribute 'shape'
Author   sabyasachi0212
🌐
GitHub
github.com › kijai › ComfyUI-CogVideoXWrapper › issues › 92
'list' object has no attribute 'shape' · Issue #92 · kijai/ComfyUI-CogVideoXWrapper
September 24, 2024 - Error occurred when executing CogVideoSampler: 'list' object has no attribute 'shape'
Author   1hua-hua
🌐
YouTube
youtube.com › watch
PYTHON : 'list' object has no attribute 'shape' - YouTube
PYTHON : 'list' object has no attribute 'shape' [ Gift : Animated Search Engine : https://www.hows.tech/p/recommended.html ] PYTHON : 'list' object has no a...
Published   December 5, 2021
🌐
Reddit
reddit.com › r/comfyui › ksampler 'nonetype' object has no attribute 'shape'
r/comfyui on Reddit: KSampler 'NoneType' object has no attribute 'shape'
February 27, 2025 -

hello people, I would like to ask what could cause this problem. everything be working and when I load a controlnet union sdxl it just doesn't work after I try to apply it, I tried many workflows online and all have the same issue. Any one would know what a possible solution for this?

I checked this in Change 'c_adm' to 'y' in ControlNet.get_control by Kosinkadink · Pull Request #1836 · comfyanonymous/ComfyUI but the whole y thing was not found.

thank you <3

🌐
Experts Exchange
experts-exchange.com › questions › 27146878 › AttributeError-'list'-object-has-no-attribute-'shape'-Python.html
Solved: AttributeError: 'list' object has no attribute 'shape': Python | Experts Exchange
June 28, 2011 - The third parameter, Z0, is apparently expected to be some object that has a property called "shape", while you are passing it an array. I also don't understand why you assign to Z0 twice. The second assignment wipes out the first. Perhaps the first assignment is the one you really want? ... Yes, sorry. The first ZO declaration works: Z0 = np.zeros([np.size(X,0),np. ... ,float) surf1 = ax.plot_surface(X, Y, Z0, rstride=1, cstride=1, cmap=cm.bwr,linewidth=0) This Z0 = [[-2,2,0,1],[2,0,-1,2],[0, ... ,-2,0,1]] does not.
🌐
Anl
millenia.cars.aps.anl.gov › archives › list › ifeffit@millenia.cars.aps.anl.gov › thread › EVQLMCVURWZ6M5YBY5PYG4ATDYPN4FHQ
Larix.desktop on Arch Linux AttributeError: 'list' object has ...
When I am starting Larix.desktop ...larch/wxlib/columnframe.py", line 1208, in set_energy_units ncol, npts = workgroup.data.shape ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'shape' I haven't modified any of the respective files at all....
🌐
Tutorial Reference
tutorialreference.com › python › examples › faq › python-error-attributeerror-list-object-has-no-attribute-replace
How to Resolve "AttributeError: 'list' object has no attribute 'replace'" in Python | Tutorial Reference
The AttributeError: 'list' object has no attribute 'replace' error in Python occurs when you try to use the string method .replace() on a list object. The .replace() method is specifically designed for strings (str objects), not lists.
🌐
Reddit
reddit.com › r/learnpython › what is "attributeerror: 'function' object has no attribute 'find'"
r/learnpython on Reddit: what is "AttributeError: 'function' object has no attribute 'find'"
June 18, 2022 -
morseCodeM={".-":"A",
            "-...":"B",
            "-.-.":"C",
            "-..":"D",
            ".":"E",
            "..-.":"F",
            "--.":"G",
            "....":"H",
            "..":"I",
            ".---":"J",
            "-.-":"K",
            ".-..":"L",
            "--":"M",
            "-.":"N",
            "---":"O",
            ".--.":"P",
            "--.-":"Q",
            ".-.":"R",
            "...":"S",
            "-":"T",
            "..-":"U",
            "...-":"V",
            ".--":"W",
            "-..-":"x",
            "-.--":"Y",
            "--..":"Z",
            " / ":" "}
def morseToText(inp):
  out=""
  while(inp!=" "):
    for i in morseCodeM:
      if(inp.find(i)!=-1):    <-----------------------
        out=out+morseCodeM[i]
        inp2=list(inp)
        inp2[inp.find(i):inp.find(i)+(len(i)-1)]=""
        inp="".join(inp2)
        return out

I honestly don't know whats wrong it just gives the error :"AttributeError: 'function' object has no attribute 'find'" on the line with the arrow .

edit: the code is about converting morse code to text