Hi,
You can use the provided optimizer by giving it your Tensors to optimize (corrected_im,) here if there is only one.
Then you can just call opt.step() and it will use the content of corrected_im.grad to update corrected_im.