Error in ToTensor() transformation

Hi, When I want to pass the ToTensor() transform, I get the following error in this line.

Line: img = torch.from_numpy(pic.transpose((2, 0, 1)))

RuntimeError: some of the strides of a given numpy array are negative. This is currently not supported, but will be added in future releases.

Any idea?

Solved the problem with the following line:

img = torch.from_numpy(np.flip(pic.transpose((2, 0, 1)),axis=0).copy())


1 Like