One way to solve this problem is by doing something as follows
x = torch.tensor([1., 2.], requires_grad=True)
y = [x[0], x[1]]
(y[0]+y[1]).backward()

# Now gradients will be propagated to x

I don’t know if there is an easier way. But you need to convert Rx, Ry, Rx to lists and then work from there for your code to work.