Solved by KFrank in post #3 
              
              
                Hi Paula (and Alex)! 

Building on Alex’s suggestion, I believe that 
X.prod (dim = 1).sum (dim = 1)

should do what you want. 
Best. 
K. Frank