thank you very much for your help however when i try to run the given the code it gives the following error:
Traceback (most recent call last):
File “model_change.py”, line 204, in 
output = model(data)
File “/home/sohrab/anaconda3/lib/python3.5/site-packages/torch/nn/modules/module.py”, line 325, in call
result = self.forward(*input, **kwargs)
File “model_change.py”, line 172, in forward
x = self.stn(x)
File “model_change.py”, line 162, in stn
theta[:, :, 2] = theta_translation
File “/home/sohrab/anaconda3/lib/python3.5/site-packages/torch/autograd/variable.py”, line 87, in setitem
return SetItem.apply(self, key, value)
RuntimeError: a leaf Variable that requires grad has been used in an in-place operation.
im assuming this is because the variable has already been created and cant be modified afterwards? any help on this would be amazing, thank you so much