ElleryL:

torch.potrf(a)


This 6 function call calculates Cholesky decomposition and in your case, it essentially returns a matrix with determinant equal to square root determinant of the original matrix (because it is a diagonal matrix). I think you wanted to do this:
a = Variable(torch.Tensor([[2,0],[0,4]]))
torch.diag(a).prod()