neml2.pyzag¶
- class neml2.pyzag.NEML2PyzagModel(sys, *args, exclude_parameters=None, **kwargs)[source]¶
Bases:
NonlinearRecursiveFunctionWrap a native NEML2
NonlinearSystemas a pyzagNonlinearRecursiveFunction.- Parameters:
sys (ModelNonlinearSystem) – the native NEML2 nonlinear system to wrap.
- Keyword Arguments:
exclude_parameters (list of str) – NEML2 parameters to not mirror as torch parameters on the wrapper (and therefore not optimize against).
Additional
argsandkwargsare forwarded totorch.nn.Moduleverbatim.
- neml2.pyzag.change_lag_order(var, new_order)[source]¶
Re-tag a variable name to a different lag order. Inverse of
lag_order().
- neml2.pyzag.lag_order(var)[source]¶
Split a variable name into its base name and lag order.
varis either"name"(lag 0) or"name~n"(lagn). Used by the interface to identify old-state / old-force variables — pyzag wants a contiguous-in-time state and forces tensor, while the NEML2 nonlinear system keeps current values on the unknown axis and old values on the given axis with a~1suffix.