torch.from_numpy
torch.from_numpy(your_array)
0
8
your_tensor.numpy()
Thank you!
8
0
4.33
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])
Thank you!
3
0
Are there any code examples left?
New code examples in category Other