I want the parameters of the model to NOT be leafs. I also want the parameters to be part of the computation graph and I am dynamically changing the parameters with code. So I want:

Parameters to NOT be leafs (but still be held inside a nn.Module so that I can use the dynamically changing parameters as part of the computation graph).
I want the “updating model” to be part of the computation graph at any time but it seems setting the parameters to leaf is stopping the flow of gradients

How can I do that?
(plan to post later a working self-contained simplified jupyter demo of what more or less is going to make it easier to help me)

SO: https://stackoverflow.com/questions/60271131/how-does-one-have-parameters-in-a-pytorch-model-not-be-leafs-and-be-in-the-compu 12