Skip to content

Torch

Warning

The current page still doesn't have a translation for this language.

You can read it through Google Translate.

Besides, you can also help to translate it: Contributing.

import numpy as np
import torch

a = torch.Tensor([1, 2, 3])
b = torch.Tensor([4, 5, 6])
print(a + b)

c = torch.ones(2, 3)
d = torch.zeros(4, 5)
print(d.shape)
print(d.size())
e = d.numpy()
print(e)
print(torch.add(a, b))
print(torch.argmax(a))