If I need to sum all the values of a 2-dimensional tensor myOnes = torch.ones([32,32]), I\'ve been doing this: torch.sum(myTensor, dim=[0,1]). For 3-d
myOnes = torch.ones([32,32])
torch.sum(myTensor, dim=[0,1])