Answers for "argmax pytorch"

1

index of max in tensor

>>> a = torch.randn(4, 4)
>>> a
tensor([[ 1.3398,  0.2663, -0.2686,  0.2450],
        [-0.7401, -0.8805, -0.3402, -1.1936],
        [ 0.4907, -1.3948, -1.0691, -0.3132],
        [-1.6092,  0.5419, -0.2993,  0.3195]])
>>> torch.argmax(a)
tensor(0)
Posted by: Guest on January-09-2021
0

pytorch tensor argmax

values, indices = tensor.max(0)
values, indices = torch.max(tensor, 0)
Posted by: Guest on March-28-2020

Python Answers by Framework

Browse Popular Code Answers by Language