Thank you… I ended up doing the following:
I needed the last 3 elements of each array so using ranges
x = torch.tensor([[1, 0,9,87,1],[6, 0,8,1,8],[4,0,7,2,2],[3,0,2,6,3]])
print("x",x)
values, indices = torch.topk(x,k=2,largest=True,dim=0)
print("indices",indices)
#2d data samples
newdataset = torch.zeros(2, 3)
print("newdataset",newdataset)
newdataset[0] = x[indices[0,0].item(),2:5]
newdataset[1] = x[indices[1,0].item(),2:5]
print("newdataset",newdataset)