Hi,


yes, call it as ctx.save_for_bacward(*your_tensor_list). And get them back as your_tensor_list = list(ctx.saved_tensors) in the backward (if you’re fine with a tuple, the list is not necessary).


The custom backward must output the gradients wrt to the inputs of the forward function. Not sure to understand what you want here. But you have access to global variables and anything you saved in the ctx here.