Pytorch Tensor基本运算 #加法运算 import torch a = torch.rand(3,4) b = torch.rand(4) #broadcasting机制 a+b tensor([[1.0349, 1.4042, 0.9662, 0.4812], [1.6120, 1.2008, 1.6819, 0.2741], [1.5190, 0.6663, 1.6405, 0.8839]]) torch.add(a,b) tensor([[1.0349, 1.4042, 0.9662, 0.4812], [1.6120,