https://www.cnblogs.com/eva-j/p/5534037.html
浅拷贝:
1. tensor 转 numpy方法 ----->.numpy
实例:
import numpy as np
import torch
a = torch.tensor([1,2,3])
b = a.numpy()
a[0] = 10
print(b)
print(id(a))
print(id(b))
2.torch.as_tensor(np.Array)
深拷贝:
1.torch.tensor() , np.array()
例子:
import numpy as np
import torch
a = [1,2,3]
b = torch.tensor(a)
c = np.array(a)
a[0] = 4
print(b)
print(c)