NEML2 1.4.0
Loading...
Searching...
No Matches
base Namespace Reference

Classes

class  Model
 
class  TensorValue
 

Functions

None diagnose (Model model)
 
Model get_model (str model, bool enable_AD=True, bool force_create=True)
 
None load_input (os.PathLike path, str cli_args='')
 
Model load_model (os.PathLike path, str model, bool enable_AD=True)
 
None reload_input (os.PathLike path, str cli_args='')
 
Model reload_model (os.PathLike path, str model, bool enable_AD=True)
 

Detailed Description

NEML2 Python bindings

Function Documentation

◆ diagnose()

None diagnose ( Model model)
Diagnose common issues in model setup. Raises a runtime error including all identified issues, if any.

:param model: Model to be diagnosed

◆ get_model()

Model get_model ( str model,
bool enable_AD = True,
bool force_create = True )
Create a models.Model from given input options. The input file must have
already been parsed and loaded.

:param model:        Name of the model
:param enable_AD:    Enable automatic differentiation
:param force_create: Whether to force create the model even if one has already been created

◆ load_input()

None load_input ( os.PathLike path,
str cli_args = '' )
Parse all options from an input file. Note that Previously loaded input options
will be discarded.

:param path:     Path to the input file to be parsed
:parma cli_args: Additional command-line arguments to pass to the parser

◆ load_model()

Model load_model ( os.PathLike path,
str model,
bool enable_AD = True )
A convenient function to load an input file and get a model.

This function is equivalent to calling base.load_input followed by
base.get_model. Note that this convenient function does not support passing
additional command-line arguments and will force the creation of a new
models.Model even if one has already been created. Use base.load_input and
base.get_model if you need finer control over the model creation behavior.

:param path:      Path to the input file to be parsed
:param model:     Name of the model
:param enable_AD: Enable automatic differentiation

◆ reload_input()

None reload_input ( os.PathLike path,
str cli_args = '' )
Similar to base.load_input, except that this function additionally clears the
factory so that previously retrieved models are deleted.

This function is only needed if you load and evaluate models inside a for-loop,
where it is desirable to deallocate models on-the-fly.

:param path:     Path to the input file to be parsed
:param cli_args: Additional command-line arguments to pass to the parser

◆ reload_model()

Model reload_model ( os.PathLike path,
str model,
bool enable_AD = True )
Similar to base.load_model, except that this function additionally clears the
factory so that previously retrieved models are deleted.

This function is only needed if you load and evaluate models inside a for-loop,
where it is desirable to deallocate models on-the-fly.

:param path:      Path to the input file to be parsed
:param model:     Name of the model
:param enable_AD: Enable automatic differentiation