I am wondering is there a fast way to get the main diagonal of a dot product of two large tensor?
Example:
a = tensor([[0.9651, 0.5328],
[0.4087, 0.1779]])
b = tensor([[0.9567, 0.1259],
[0.7130, 0.4468]])
a * b  = tensor([[0.9233, 0.0671],
[0.2914, 0.0795]])
expected: torch.diagonal(a*b) = tensor([0.9233, 0.0795])
Thanks!