Torch - Basic n NN Basic

Torch - Basic

1. Really Basic

x = torch.rand(3, 2)
x

 0.6748  0.2027
 0.5566  0.6601
 0.8654  0.0982
[torch.FloatTensor of size 3x2]
y = torch.ones(x.size())
y

 1  1
 1  1
 1  1
[torch.FloatTensor of size 3x2]
z = x + y
z

 1.6748  1.2027
 1.5566  1.6601
 1.8654  1.0982
[torch.FloatTensor of size 3x2]

2. in place by _

3. Reshape

4. Numpy to Torch and back

The memory is shared between the Numpy array and Torch tensor.

Torch - NN Basic

Torch - NN Basic

Last updated

Was this helpful?