Hi, when I use numpy.flip() on my array and then i try to create from this array torch tensor with torch.from_numpy(x)
It says
ValueError: At least one stride in the given numpy array is negative, and tensors with negative strides are not currently supported. (You can probably work around this by making a copy of your array with array.copy().)
Why is this happening ? I see there are some solutions on internet but this never happened to me yet and I was using numpy.flip() a lot.
When I use min() max() on this array there is no negative number so why is this happening ?
example code:
Just normal numpy array, flip it and it crashes.
import numpy
import torch
x = numpy.zeros((12,3,48,48))
def _augmentation_flip(image_np, label_np):
aug_img = numpy.flip(image_np, 1)
aug_label = numpy.flip(label_np, 1)
return aug_img, aug_label
x,y = _augmentation_flip(x,x)
torch.from_numpy(x)