In [1]:
import torch
In [6]:
x = torch.Tensor(5,3)
print(x)
In [16]:
x = torch.rand(5,3)
print(x)
In [13]:
print(x.size())
In [17]:
y = torch.rand(5,3)
result = x + y
In [18]:
print(result)
In [20]:
# INPLACE!
result.add_(x)
print(result)
In [24]:
%%time
a = torch.randn(10).cuda()
print(a)
print(a+2)