Just wanted to update this thread, I know it’s garnering a lot of interest.
justusschock was right. you can use .clone() and avoid the error.
There was just a small issue with the code, it should be this:
XR[1] = q[0]**XR[0].clone()

I am still unsure as to why the .clone() is required. I know it has something to do with the graph getting messed up, but would love to know what exactly is going on.
THANKS!
DS