How to calculate the trace of a matrix in 3d tensor where first dimension is the batch size?
torch.trace only works on 2d input but I want it to run on my batch tensor to get output of shape (batch_size,1)