Hi Mark,
I did not succeed to obtain the sum over the second dimension using Total in the way you showed. An alternative approach which doesn't make use of Transpose would be the following
Total[a2X2X2[[#, All, All]], 2] & /@ {1, 2}
Total[a2X2X2[[All, #, All]], 2] & /@ {1, 2}
Total[a2X2X2[[All, All, #]], 2] & /@ {1, 2}
It can be easily generalized to tensors of any rank and/or dimensions. For high ranks and small number of dimensions, the timings between this version and yours are more or less similar; but for small ranks and high number of dimensions, the above version is significantly slower. (See attached file for these remarks.)
Attachments: