Hi Truss!



 truss712:

I don’t require gradients for the simulation layer as I just want to update params prediction network.


I don’t really understand what you are saying here.
But let me ask this question:  Should the update you apply to your
prediction-network parameters depend in any way on the output
of the simulation layer?  If not, I can’t see any reason that you would
need to run the simulation layer to perform the prediction-network
update.  If so, it would seem that you would have to backpropagate
gradients of your final loss function (that depends on your simulation
layer) through the simulation layer back to the prediction network.


Does it make sense if I give precalculated dummy gradients in backward function of the custom layer?


This doesn’t make sense to me.  If your custom simulation layer
matters, dummy gradients will obscure its structure and make it not
matter to the prediction-layer update.  (And if your simulation layer
doesn’t matter, you should be able to update your prediction layer
based solely on its output without passing anything – forward or
backward – through the simulation layer.)
At a conceptual level – ignoring gradients and specific optimization
algorithms – your loss function is supposed to tell you how good a
job the parameters of your prediction network are doing.  What role
does your simulation play in telling you whether your prediction
network is performing well or poorly?  Or to ask the same question
more concretely, how does your final loss function depend on your
simulation layer and its output?
Best.
K. Frank