torch.Tensor(array)时,报错: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().)
原因分析:
主要原因是Nunmpy中,随机初始化的数组默认都是C连续的,经过slice操作后,其连续性被改变,需要’numpy.ascontinguousarray(array)',使内存不连续的array转换为内存连续存储的数组。



