From 29cbaee9d6bd4498e2ae04816d45d81c9b910e7c Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Mon, 15 Nov 2021 13:21:00 -0500 Subject: [PATCH] enhance(solvers): raise error when getting solution with nets == None --- neurodiffeq/solvers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neurodiffeq/solvers.py b/neurodiffeq/solvers.py index 7acff17..8610f88 100644 --- a/neurodiffeq/solvers.py +++ b/neurodiffeq/solvers.py @@ -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`