import torch
±*/
- 维度不同的时候会broadcast
- element-wise
a = torch.ones(2,2)
b = torch.tensor(4)
print(a + b)
print(a.add(b))
print(torch.add(a,b))
tensor([[5., 5.],
[5., 5.]])
tensor([[5., 5.],
[5., 5.]])
tensor([[5., 5.],
[5., 5.]])
print(a/b)
print(torch.all(torch.eq(a/b,a.div(b)))