I am trying to run a topk of a 2d matrix
x = torch.tensor([[1, 2,9,87],[6, 32,8,1],[4,6,7,2],[3,6,2,6]])
print("x",x)
values, indices = torch.topk(x,k=2,dim=0)
print("values",values)
print("indices",indices)
output:
x tensor([[ 1, 2, 9, 87],
[ 6, 32, 8, 1],
[ 4, 6, 7, 2],
[ 3, 6, 2, 6]])
values tensor([[ 6, 32, 9, 87],
[ 4, 6, 8, 6]])
indices tensor([[1, 1, 0, 0],
[2, 2, 1, 3]])
but I am expecting output for values as:
values tensor([[ 6, 32, 8, 1],
[ 4, 6, 7, 2]])