I am trying to do the equivalent of tf.scatter_nd.
I have some values which I want to assign to a larger tensor and then autograd through it.
I found this issue How to achieve tf.scatter_nd in pytorch? project for copynet but it did not help me much.
I tried the following:
x = Variable(torch.zeros(5, 4), requires_grad=True)
x[idx[:, 0], idx[:, 1]] = myvalues

It complains that: a leaf Variable that requires grad has been used in an in-place operation.
I also tried it with scatter as a test and it fails as well.
x.scatter_(0, idx[:, 0], myvalues)

Is there no way in pytorch to achieve the behaviour of tf.scatter_nd?