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() and torch.min() are functions to compare the size of tensor
x = torch.rand(1,3)
print(x)
print(torch.min(x))
y = torch.rand(2,3)
print(y)
print(torch.min(y))
Specify the comparison dimension: 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))
Comparison of two tensors: not necessarily the same size structure
If it is not the same size structure, it must be broadcastable
x = torch.rand(2,3)
y = torch.rand(2,3)
print("***********")
print(x)
print("***********")
print(y)
print("*****比较结果******")
print(torch.max(x,y))