How to insert a value in a fixed position of pytorch
16:07 29 Mar 2022

I have a PyTorch tensor

x = [[1,2,3,4,5]]

Now I want to add a value to a fixed position of the tensor x, for example, I want to add 11 in position 3 then the x will be

x= [[1,2,3,11,4,5]]

How can I perform this operation in Pytorch?

python pytorch tensor