the given numpy array is not writeable, and pytorch does not support non-writeable tensors. this means you can write to the underlying (supposedly non-writeable) numpy array using the tensor. you may want to copy the array to protect its data or make it writeable before converting it to a tensor. this type of warning will be suppressed for the rest of this program. (triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:180.) return torch.from_numpy(parsed.astype(m[2], copy=false)).view(*s)
时间: 2023-05-01 19:03:49 浏览: 213
给定的numpy数组不可写,并且PyTorch不支持非可写张量。这意味着您可以使用张量写入底层(应该是不可写的)numpy数组。在将其转换为张量之前,您可能需要复制该数组以保护其数据或使其可写。这种类型的警告将在本程序的其余部分中被抑制。(在torch\\csrc\\utils\\tensor_numpy.cpp:180处内部触发)。返回torch.from_numpy(parsed.astype(m[2], copy=false)).view(*s)。
阅读全文