1.在gpu上运行程序
if torch.cuda.is_available():
x = x.cuda()
y = y.cuda()
x + y
2、定义一个矩阵
x = torch.rand(5, 3)
print(x)
或者
x = torch.Tensor(5,3)
</
1.在gpu上运行程序
if torch.cuda.is_available():
x = x.cuda()
y = y.cuda()
x + y
2、定义一个矩阵
x = torch.rand(5, 3)
print(x)
或者
x = torch.Tensor(5,3)
</