关于“could not infer dtype of numpy.int64”错误的解答 1. 问题背景 你在使用numpy或与之相关的库(如PyTorch)时遇到了“could not infer dtype of numpy.int64”的错误。这通常发生在数据类型不匹配或库之间的不兼容情况下。 2. 可能原因 数据类型不匹配:当你尝试将一个numpy的int64类型数据转换为PyTorch张量...
Not impossible, but I have a regular PyTorch 1.9.0 install with Conda and can reproduce this: >>>importtorch>>>importnumpyasnp>>>t=torch.as_tensor([3,4],dtype=torch.int64)>>>t=torch.as_tensor([3,4],dtype=np.int64)Traceback(mostrecentcalllast):File"<ipython-input-9-e7361c5bb7d8...