Update tensor on specific (variable) column only

Hello
I have a tensor with probabilities, for example:
size 8000x2

print(probabilities)
0.5008 0.4992
0.5008 0.4992
0.5003 0.4997

0.4984 0.5016
0.5007 0.4993
0.4999 0.5001
[torch.FloatTensor of size 8000x2]

I would like to update it row by row but on variable column (index)

I created new tensor with indexes:

print(indices)
0
1
0

0
0
1
[torch.LongTensor of size 8000]

And I was able to display specific column (depending on indices)

print(probabilities.gather(1, indices.view(-1,1)))

0.5008
0.4992
0.5003

0.4984
0.5007
0.5001
[torch.FloatTensor of size 8000x1]

I can display it - but I don’t know how to update it
for example subtract -1 in every row on specific index specified by indices…

I guess I can do it through loop - but is there any other solution?
in numpy it’s possible with one liner

thanks for any help

regards,
Michael

probabilities[torch.arange(0, 8000).long(), indices] -= 1

should do the trick.