Tensor
1.torch 存入本地
代码:
x = torch.rand(4,5) print(x) torch.save(x, "myTensor.pth") y = torch.load("myTensor.pth") print(y)
输出:
2.numpy
代码:
x = torch.rand(4, 5) print(x) np.save("myTensor",x )#同np.save("myTensor.npy",x ) y = np.load("myTensor.npy") print(y)
输出:
list
代码:
x=[i for i in range(20)] print(x) np.save('list.npy',x) y=np.load('list.npy') p