t o r c h . m i n 、 t o r c h . m a x 、 t o r c h . a r g m a x torch.min、torch.max、torch.argmax torch.min、torch.max、torch.argmax
torch.max()和torch.min()是比较tensor大小的函数
x = torch.rand(1,3)
print(x)
print(torch.min(x))
y = torch.rand(2,3)
print(y)
print(torch.min(y))
指定比较维度:torch.max(input,dim)
y = torch.rand(5,3)
print("***********")
print(y)
print("***********")
print(torch.max(y,0))
y = torch.rand(5,6)
print("***********")
print(y)
print("***********")
print(torch.max(y,1))
两个tensor相比较:不一定是相同大小结构
若不是相同大小结构,必须满足可广播
x = torch.rand(2,3)
y = torch.rand(2,3)
print("***********")
print(x)
print("***********")
print(y)
print("*****比较结果******")
print(torch.max(x,y))