I would like to combine a neural network Net
with a non-differentiable fixed simulator Sim
as follows:
a → Net
→ Sim
→ c_pred
Net
takes as input vectors a and predicts vectors b,Sim
(implemented in Python/numpy) takes as input b and, after integrating PDEs, produces vectors c_pred,- My ground truth are data (a, c)
- I would like to tune the
Net
to minimize the loss L(c, c_pred)
So far I wrap the Sim
in a th.autograd.Function
but the learning is not great because I can’t define a good gradient of the Sim
in the custom backward()
.
How can I solve this?
Kind regards,
Carlo