Multidimentional tensor max

Hi,
I have a multi-dimensional tensor, in wich way can i get the maximum over all dimensions and the multi-dimensional index for the maximum?

This code should work:

x = torch.randn(100, 100, 100)
x_max = torch.max(x)
idx_max = (x == x_max).nonzero()
1 Like

Thank you so much :blush: