我在跑以下代码时出现错误
pic = pic[:,:, ::-1,:]
pic = torch.from_numpy(pic.transpose([3,0,1,2]))
## ValueError: some of the strides of a given numpy array are negative
解决方案
pic = pic[:,:, ::-1,:].copy() #加上.copy()
具体可参考:discuss.pytorch
我在跑以下代码时出现错误
pic = pic[:,:, ::-1,:]
pic = torch.from_numpy(pic.transpose([3,0,1,2]))
## ValueError: some of the strides of a given numpy array are negative
解决方案
pic = pic[:,:, ::-1,:].copy() #加上.copy()
具体可参考:discuss.pytorch