Model & load_model(const std::filesystem::path &path, const std::string &mname)
A convenient function to load an input file and get a model.
Definition Model.cxx:48
Output:
Name: model
Input: forces/E [SR2]
Output: state/S [SR2]
Parameters: G [Scalar][Float][cpu]
K [Scalar][Float][cpu]
Automatic differentiation
NEML2 tensors can be used interchangeably with PyTorch tensors in a seamless fashion. Function graph traced through NEML2 tensor operations can be back-propagated using PyTorch's autograd engine.
For example, the following Python script demonstrates the calculation of using an arbitrary, scalar-valued loss function obtained by a combination of NEML2 operations and PyTorch operations.