'numpy.ndarray' object has no attribute 'contiguous'

Hi!
I have encountered this error:

'numpy.ndarray' object has no attribute 'contiguous'

in this code:

a=numpy.array([[1,2,3,4],[5,6,7,8],[1,2,3,4],[5,6,7,8]])
dct.dct_2d(a)

that the dct func contains:

x_shape = x.shape
N = x_shape[-1]
x = x.contiguous().view(-1, N)

Could you mind helping me solve this?

contiguous is a torch method, it has to be a torch tensor not a numpy array

1 Like