deepmd.tf2.common#
Attributes#
Classes#
Built-in mutable sequence. |
Functions#
| Convert an object to an ndtensorflow Array. |
| Unwrap a TensorFlow-backed Array to a TensorFlow tensor. |
| Wrap a TensorFlow tensor as an ndtensorflow Array. |
| Recursively wrap TensorFlow tensors as ndtensorflow Arrays. |
| Recursively unwrap ndtensorflow Arrays for TensorFlow SavedModel returns. |
| Register how to convert a dpmodel object to its tf2 wrapper. |
| |
| |
| |
| |
| Convert a registered dpmodel object to its tf2 wrapper. |
| |
| |
| |
| |
| Wrap a dpmodel subclass as a TensorFlow |
Module Contents#
- deepmd.tf2.common.to_tensorflow_array(array: Any | None) Any[source]#
Convert an object to an ndtensorflow Array.
- Parameters:
- array
The object to convert.
- Returns:
ndtensorflow.ArrayThe TensorFlow-backed array.
- deepmd.tf2.common.to_tf_tensor(array: Any | None) tf.Tensor | None[source]#
Unwrap a TensorFlow-backed Array to a TensorFlow tensor.
- deepmd.tf2.common.wrap_tensor(tensor: Any | None) Any | None[source]#
Wrap a TensorFlow tensor as an ndtensorflow Array.
- deepmd.tf2.common.wrap_value(value: Any) Any[source]#
Recursively wrap TensorFlow tensors as ndtensorflow Arrays.
- deepmd.tf2.common.unwrap_value(value: Any) Any[source]#
Recursively unwrap ndtensorflow Arrays for TensorFlow SavedModel returns.
- deepmd.tf2.common._AUTO_WRAPPED_CLASSES: dict[type[deepmd.dpmodel.common.NativeOP], type[Any]][source]#
- class deepmd.tf2.common.TF2List[source]#
Bases:
listBuilt-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
- deepmd.tf2.common.register_dpmodel_mapping(dpmodel_cls: type[Any], converter: collections.abc.Callable[[Any], Any]) None[source]#
Register how to convert a dpmodel object to its tf2 wrapper.
- deepmd.tf2.common.try_convert_module(value: Any) Any | None[source]#
Convert a registered dpmodel object to its tf2 wrapper.
- deepmd.tf2.common._auto_wrap_native_op(value: deepmd.dpmodel.common.NativeOP) Any[source]#