This is follow up question to this question. I tried using index_put_
as suggested in the answer, however I'm getting the following error
RuntimeError: the derivative for 'indices' is not implemented
I want to backpropagate the error gradients through the indices and hence I can't detach()
it. Is there any way possible to achieve this?
Example:
import torch
image = torch.tensor([[246, 50, 101], [116, 1, 113], [187, 110, 64]])
iy = torch.tensor([[1, 0, 2], [1, 0, 2], [2, 2, 2]])
ix = torch.tensor([[0, 2, 1], [1, 2, 0], [0, 1, 2]])
warped_image = torch.zeros(size=image.shape)
warped_image.index_put_((iy, ix), image, accumulate=True)