pytorch中torch.max函数

torch.max(x,0)返回每一列中最大值的那个元素,且返回索引(返回最大元素在这一列的行索引)。torch.max(x,1)返回每一行中最大值的那个元素,且返回索引。
如下面程序输出结果如图:

x = torch.randn(5,5)
print(x)
print(torch.max(x,0))
print(torch.max(x,1))

pytorch中torch.max函数_第1张图片

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