original_docstring: Train a neural network to solve an ODE.
  
      :param ode: The ODE to solve. If the ODE is :math:`F(x, t) = 0` where :math:`x` is the dependent variable and :math:`t` is the independent variable,
          then `ode` should be a function that maps :math:`(x, t)` to :math:`F(x, t)`.
      :type ode: function
      :param condition: The initial/boundary condition.
      :type condition: `neurodiffeq.ode.IVP` or `neurodiffeq.ode.DirichletBVP` or `neurodiffeq.ode.NoCondition`
      :param net: The neural network used to approximate the solution, defaults to None.
      :type net: `torch.nn.Module`, optional
      :param t_min: The lower bound of the domain (t) on which the ODE is solved, only needed when train_generator or valid_generator are not specified, defaults to None
      :type t_min: float
      :param t_max: The upper bound of the domain (t) on which the ODE is solved, only needed when train_generator or valid_generator are not specified, defaults to None
      :type t_max: float
      :param train_generator: The example generator to generate 1-D training points, default to None.
      :type train_generator: `neurodiffeq.ode.ExampleGenerator`, optional
      :param shuffle: Whether to shuffle the training examples every epoch, defaults to True.
      :type shuffle: bool, optional
      :param valid_generator: The example generator to generate 1-D validation points, default to None.
      :type valid_generator: `neurodiffeq.ode.ExampleGenerator`, optional
      :param optimizer: The optimization method to use for training, defaults to None.
      :type optimizer: `torch.optim.Optimizer`, optional
      :param criterion: The loss function to use for training, defaults to None.
      :type criterion: `torch.nn.modules.loss._Loss`, optional
      :param additional_loss_term: Extra terms to add to the loss function besides the part specified by `criterion`. The input of `additional_loss_term` should be the same as `ode`
      :type additional_loss_term: function
      :param batch_size: The size of the mini-batch to use, defaults to 16.
      :type batch_size: int, optional
      :param max_epochs: The maximum number of epochs to train, defaults to 1000.
      :type max_epochs: int, optional
      :param monitor: The monitor to check the status of nerual network during training, defaults to None.
      :type monitor: `neurodiffeq.ode.Monitor`, optional
      :param return_internal: Whether to return the nets, conditions, training generator, validation generator, optimizer and loss function, defaults to False.
      :type return_internal: bool, optional
      :param return_best: Whether to return the nets that achieved the lowest validation loss, defaults to False.
      :type return_best: bool, optional
      :return: The solution of the ODE. The history of training loss and validation loss.
          Optionally, the nets, conditions, training generator, validation generator, optimizer and loss function.
      :rtype: tuple[`neurodiffeq.ode.Solution`, dict]; or tuple[`neurodiffeq.ode.Solution`, dict, dict]
      
docstring: Train a neural network to solve an ODE.
docstring_tokens: Train a neural network to solve an ODE .
code: def solve(
          ode, condition, t_min=None, t_max=None,
          net=None, train_generator=None, shuffle=True, valid_generator=None,
          optimizer=None, criterion=None, additional_loss_term=None, batch_size=16,
          max_epochs=1000,
          monitor=None, return_internal=False,
          return_best=False
  ):
      """Train a neural network to solve an ODE.
  
      :param ode: The ODE to solve. If the ODE is :math:`F(x, t) = 0` where :math:`x` is the dependent variable and :math:`t` is the independent variable,
          then `ode` should be a function that maps :math:`(x, t)` to :math:`F(x, t)`.
      :type ode: function
      :param condition: The initial/boundary condition.
      :type condition: `neurodiffeq.ode.IVP` or `neurodiffeq.ode.DirichletBVP` or `neurodiffeq.ode.NoCondition`
      :param net: The neural network used to approximate the solution, defaults to None.
      :type net: `torch.nn.Module`, optional
      :param t_min: The lower bound of the domain (t) on which the ODE is solved, only needed when train_generator or valid_generator are not specified, defaults to None
      :type t_min: float
      :param t_max: The upper bound of the domain (t) on which the ODE is solved, only needed when train_generator or valid_generator are not specified, defaults to None
      :type t_max: float
      :param train_generator: The example generator to generate 1-D training points, default to None.
      :type train_generator: `neurodiffeq.ode.ExampleGenerator`, optional
      :param shuffle: Whether to shuffle the training examples every epoch, defaults to True.
      :type shuffle: bool, optional
      :param valid_generator: The example generator to generate 1-D validation points, default to None.
      :type valid_generator: `neurodiffeq.ode.ExampleGenerator`, optional
      :param optimizer: The optimization method to use for training, defaults to None.
      :type optimizer: `torch.optim.Optimizer`, optional
      :param criterion: The loss function to use for training, defaults to None.
      :type criterion: `torch.nn.modules.loss._Loss`, optional
      :param additional_loss_term: Extra terms to add to the loss function besides the part specified by `criterion`. The input of `additional_loss_term` should be the same as `ode`
      :type additional_loss_term: function
      :param batch_size: The size of the mini-batch to use, defaults to 16.
      :type batch_size: int, optional
      :param max_epochs: The maximum number of epochs to train, defaults to 1000.
      :type max_epochs: int, optional
      :param monitor: The monitor to check the status of nerual network during training, defaults to None.
      :type monitor: `neurodiffeq.ode.Monitor`, optional
      :param return_internal: Whether to return the nets, conditions, training generator, validation generator, optimizer and loss function, defaults to False.
      :type return_internal: bool, optional
      :param return_best: Whether to return the nets that achieved the lowest validation loss, defaults to False.
      :type return_best: bool, optional
      :return: The solution of the ODE. The history of training loss and validation loss.
          Optionally, the nets, conditions, training generator, validation generator, optimizer and loss function.
      :rtype: tuple[`neurodiffeq.ode.Solution`, dict]; or tuple[`neurodiffeq.ode.Solution`, dict, dict]
      """
      nets = None if not net else [net]
      return solve_system(
          ode_system=lambda x, t: [ode(x, t)], conditions=[condition],
          t_min=t_min, t_max=t_max, nets=nets,
          train_generator=train_generator, shuffle=shuffle, valid_generator=valid_generator,
          optimizer=optimizer, criterion=criterion, additional_loss_term=additional_loss_term, batch_size=batch_size,
          max_epochs=max_epochs, monitor=monitor, return_internal=return_internal,
          return_best=return_best
      )
code_tokens: def solve ( ode , condition , t_min = None , t_max = None , net = None , train_generator = None , shuffle = True , valid_generator = None , optimizer = None , criterion = None , additional_loss_term = None , batch_size = 16 , max_epochs = 1000 , monitor = None , return_internal = False , return_best = False ) : nets = None if not net else [ net ] return solve_system ( ode_system = lambda x , t : [ ode ( x , t ) ] , conditions = [ condition ] , t_min = t_min , t_max = t_max , nets = nets , train_generator = train_generator , shuffle = shuffle , valid_generator = valid_generator , optimizer = optimizer , criterion = criterion , additional_loss_term = additional_loss_term , batch_size = batch_size , max_epochs = max_epochs , monitor = monitor , return_internal = return_internal , return_best = return_best )
short_docstring: Train a neural network to solve an ODE.
short_docstring_tokens: Train a neural network to solve an ODE .
comment: """Train a neural network to solve an ODE.
  
      :param ode: The ODE to solve. If the ODE is :math:`F(x, t) = 0` where :math:`x` is the dependent variable and :math:`t` is the independent variable,
          then `ode` should be a function that maps :math:`(x, t)` to :math:`F(x, t)`.
      :type ode: function
      :param condition: The initial/boundary condition.
      :type condition: `neurodiffeq.ode.IVP` or `neurodiffeq.ode.DirichletBVP` or `neurodiffeq.ode.NoCondition`
      :param net: The neural network used to approximate the solution, defaults to None.
      :type net: `torch.nn.Module`, optional
      :param t_min: The lower bound of the domain (t) on which the ODE is solved, only needed when train_generator or valid_generator are not specified, defaults to None
      :type t_min: float
      :param t_max: The upper bound of the domain (t) on which the ODE is solved, only needed when train_generator or valid_generator are not specified, defaults to None
      :type t_max: float
      :param train_generator: The example generator to generate 1-D training points, default to None.
      :type train_generator: `neurodiffeq.ode.ExampleGenerator`, optional
      :param shuffle: Whether to shuffle the training examples every epoch, defaults to True.
      :type shuffle: bool, optional
      :param valid_generator: The example generator to generate 1-D validation points, default to None.
      :type valid_generator: `neurodiffeq.ode.ExampleGenerator`, optional
      :param optimizer: The optimization method to use for training, defaults to None.
      :type optimizer: `torch.optim.Optimizer`, optional
      :param criterion: The loss function to use for training, defaults to None.
      :type criterion: `torch.nn.modules.loss._Loss`, optional
      :param additional_loss_term: Extra terms to add to the loss function besides the part specified by `criterion`. The input of `additional_loss_term` should be the same as `ode`
      :type additional_loss_term: function
      :param batch_size: The size of the mini-batch to use, defaults to 16.
      :type batch_size: int, optional
      :param max_epochs: The maximum number of epochs to train, defaults to 1000.
      :type max_epochs: int, optional
      :param monitor: The monitor to check the status of nerual network during training, defaults to None.
      :type monitor: `neurodiffeq.ode.Monitor`, optional
      :param return_internal: Whether to return the nets, conditions, training generator, validation generator, optimizer and loss function, defaults to False.
      :type return_internal: bool, optional
      :param return_best: Whether to return the nets that achieved the lowest validation loss, defaults to False.
      :type return_best: bool, optional
      :return: The solution of the ODE. The history of training loss and validation loss.
          Optionally, the nets, conditions, training generator, validation generator, optimizer and loss function.
      :rtype: tuple[`neurodiffeq.ode.Solution`, dict]; or tuple[`neurodiffeq.ode.Solution`, dict, dict]
      """