📜  torch.from_numpy - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:02.939000             🧑  作者: Mango

代码示例3
>>> a = numpy.array([1, 2, 3])
>>> t = torch.from_numpy(a)
>>> t
tensor([ 1,  2,  3])
>>> t[0] = -1
>>> a
array([-1,  2,  3])