deepmd.dpmodel.utils.serialization
Attributes
Classes
A callable counter. |
Functions
| Traverse a model dict and call callback on each variable. |
| Save a DP model to a file in the native format. |
| Load a DP model from a file in the native format. |
Module Contents
- deepmd.dpmodel.utils.serialization.traverse_model_dict(model_obj, callback: Callable, is_variable: bool = False)[source]
Traverse a model dict and call callback on each variable.
- Parameters:
- model_obj
object The model object to traverse.
- callback
callable() The callback function to call on each variable.
- is_variablebool,
optional Whether the current node is a variable.
- model_obj
- Returns:
objectThe model object after traversing.
- class deepmd.dpmodel.utils.serialization.Counter[source]
A callable counter.
Examples
>>> counter = Counter() >>> counter() 0 >>> counter() 1