I have a tensor T with dimensions (batch_size, size_n, size_n)
T = 
    [[[0.9527, 0.8821],
      [0.8442, 0.6147]],
     [[0.0672, 0.5737],
      [0.1963, 0.4532]],
     [[0.0992, 0.3838],
      [0.4169, 0.0925]]]

and want to extract the diagonal of each matrix in that batch to get
diag_T = 
    [[0.9527, 0.6147],
     [0.0672, 0.4532],
     [0.0992, 0.0925]]

Is there some torch.diag() function that also works for batches?