@mrdrozdov I don’t think this applies to this use case, because optimizers always work with leaf Variables.
@Kalamaya Is there any reason why using a closure is not acceptable? If you can give me some more details about your use case, and why do you need the intermediate gradient, I could probably suggest some other way.