deepxde
deepxde copied to clipboard
Calculating the NN output in "losses" function of PDE class
Dear Lu Lu,
I have one question regarding calculating NN output during the loss calculation of the PDE class. I am reformulating PDE class so that I can pursue calculations based on elements, not collocation points (PINNs based on weak formulation, Variational PINNs). To achieve that, I decided to make a loop for each element, which requires output of NN for that provided element. As shown below, outputs
term contains the NN for the input, basically (train_x_all). However, I would like to obtain NN output for any given placeholder, not the prediction of course since we still build losses. How can I achieve that? I just need to calculate NN output based on updated network. I tried couple of things but I could not obtain that.
def losses(self, targets, outputs, loss_fn, inputs, model, aux=None):
.
.
.
@lululxvi
For instance, model
argument in losses
function has already net
. But I could not see that how can I calculate NN output from there.
For instance, for torch
as backend, there is forward
function in fnn
module. What about tensorflow.compat_v1
?
Hey I think the forward pass for fnn
with Tensorflow 1.x is here.