得到Tensor中最大值的坐标

问题描述

得到Tensor中最大的值的坐标方法:

x = torch.randn(10, 10) #随机生成一个二维Tensor
print((x==torch.max(x)).nonzero())

你可能感兴趣的:(Pytorch,python,pytorch)