Skip to content

Commit

Permalink
add losses = [] before if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry-Jzy committed Dec 11, 2024
1 parent 07a9d96 commit faca8e7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions deepxde/data/pde_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ def __init__(

def _losses(self, outputs, loss_fn, inputs, model, num_func, aux=None):
bcs_start = np.cumsum([0] + self.pde.num_bcs)
losses = []

if config.autodiff == "reverse": # reverse mode AD
losses = []
for i in range(num_func):
out = outputs[i]
# Single output
Expand Down Expand Up @@ -274,7 +274,6 @@ def _losses(self, outputs, loss_fn, inputs, model, num_func, aux=None):
# Use stack instead of as_tensor to keep the gradients.
losses = [bkd.reduce_mean(bkd.stack(loss, 0)) for loss in losses]
elif config.autodiff == "forward": # forward mode AD
losses=[]

def forward_call(trunk_input):
return aux[0]((inputs[0], trunk_input))
Expand Down

0 comments on commit faca8e7

Please sign in to comment.