Skip to content

Commit

Permalink
Backend paddle: convert loss_weights as same dtype of stacked losses (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate authored Jun 20, 2024
1 parent ad6399b commit e586a7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepxde/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def outputs_losses(training, inputs, targets, auxiliary_vars, losses_fn):
losses = paddle.stack(losses, axis=0)
# Weighted losses
if self.loss_weights is not None:
losses *= paddle.to_tensor(self.loss_weights)
losses *= paddle.to_tensor(self.loss_weights, dtype=losses.dtype)
# Clear cached Jacobians and Hessians.
grad.clear()
return outputs_, losses
Expand Down

0 comments on commit e586a7b

Please sign in to comment.