EDIT:
see my other reply below for possible solution.

Interesting question!
Still thinking if it’s possible to get rid of the for loop, ill update if an idea comes up (currently testing it with einsum function but no solution so far)
In case ‘for loop’ will stay, I belive using sum+diagonal will be more readable:
a = torch.arange(1, 10).view(3,3)
b = torch.zeros(5) # 5 diagonals for 3x3 due to (2*3-1), for nxn, there are (2*n-1) diagonals
for i in range(5):
     b[i] = torch.sum(torch.diagonal(a, offset=2-i))

Would be nice if torch.diagonal could get a list of offsets 
output from code above:
tensor([ 3.,  8., 15., 12.,  7.])
Roy