Get the value at a specific index in PyTorch
I have a ground truth label array for size 5.
y=tensor([958,  85, 244, 182, 294])

I have the output for scores array  of shape :  [5,1000]
scores   =  tensor([[ 1.0406,  1.1808,  4.4227,  ...,  4.6864,  8.0145,  5.2128],
        [ 6.9101,  4.6083,  6.9259,  ...,  9.7415,  9.6305,  9.3974],
        [ 7.6097,  4.0396,  4.4560,  ...,  3.4892, 11.6411, 2],
        [ 1.0693,  4.6295,  5.3638,  ..., 10.9041, 10.8380,  9.2077],
        [ 1.7085,  1.4938,  8.6876,  ..., 15.1423,  9.6055,  9.8920]],
       grad_fn=&lt;ViewBackward&gt;)

I want the value from scores array based on the corresponding index of y. So for y[0], which is 958, I want the corresponding value from scores[1], position 958.
Is there some direct Pytorch function I can use?

Yes, you can do it by using your y array as an index:
scores[torch.arange(5), y]

