b = torch.sum(a,dim=0) print(b) b.shape. output: tensor([ 5, 7, 9]) torch.Size([3]). 5 = 1 + 4 7 = 2 + 5 9 = 3 + 6. 此时b为1维张量,是一个向量,且剩余元素个 ...
確定! 回上一頁