Skip to content

Commit

Permalink
enhance(solvers): raise error when getting solution with nets == None
Browse files Browse the repository at this point in the history
  • Loading branch information
shuheng-liu committed Nov 15, 2021
1 parent 816c7cd commit 29cbaee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions neurodiffeq/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ class BaseSolution(ABC):
"""

def __init__(self, nets, conditions):
if nets is None:
raise RuntimeError("The nets cannot be None, check if you disabled validation "
"and used `best`=True with `get_solution` / `get_residual`")
if isinstance(nets, nn.Module):
# This is for backward compatibility with the `single_net` option
# The same torch.nn.Module instance is repeated to form a list of the same length as `conditions`
Expand Down

0 comments on commit 29cbaee

Please sign in to comment.