Solved by ptrmcl in post #6 
              
              
                sum again? I think it’s the same idea. 
ten = torch.ones((128,10))
big = torch.ones((128,10,512))

result = (big*ten.view(128,10,1)).sum(1)