'list' object has no attribute 'shape' 'list' object has no attribute 'shape' numpy numpy

'list' object has no attribute 'shape'


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.


Alternatively, you can use np.shape(...)

For instance:

import numpy as npa=[1,2,3]

and np.shape(a) will give an output of (3,)


import numpyX = numpy.array(the_big_nested_list_you_had)

It's still not going to do what you want; you have more bugs, like trying to unpack a 3-dimensional shape into two target variables in test.