deepmd.tf.fit.fitting

Module Contents

Classes

Fitting

A class to remove type from input arguments.

class deepmd.tf.fit.fitting.Fitting[source]

Bases: deepmd.tf.utils.PluginVariant, make_plugin_registry('fitting')

A class to remove type from input arguments.

property precision: deepmd.tf.env.tf.DType[source]

Precision of fitting network.

abstract init_variables(graph: deepmd.tf.env.tf.Graph, graph_def: deepmd.tf.env.tf.GraphDef, suffix: str = '') None[source]

Init the fitting net variables with the given dict.

Parameters:
graphtf.Graph

The input frozen model graph

graph_deftf.GraphDef

The input frozen model graph_def

suffixstr

suffix to name scope

Notes

This method is called by others when the fitting supported initialization from the given variables.

abstract get_loss(loss: dict, lr) deepmd.tf.loss.loss.Loss[source]

Get the loss function.

Parameters:
lossdict

the loss dict

lrLearningRateExp

the learning rate

Returns:
Loss

the loss function

classmethod deserialize(data: dict, suffix: str = '') Fitting[source]

Deserialize the fitting.

There is no suffix in a native DP model, but it is important for the TF backend.

Parameters:
datadict

The serialized data

suffixstr, optional

Name suffix to identify this fitting

Returns:
Fitting

The deserialized fitting

abstract serialize(suffix: str = '') dict[source]

Serialize the fitting.

There is no suffix in a native DP model, but it is important for the TF backend.

Returns:
dict

The serialized data

suffixstr, optional

Name suffix to identify this fitting

serialize_network(ntypes: int, ndim: int, in_dim: int, neuron: List[int], activation_function: str, resnet_dt: bool, variables: dict, out_dim: int | None = 1, suffix: str = '') dict[source]

Serialize network.

Parameters:
ntypesint

The number of types

ndimint

The dimension of elements

in_dimint

The input dimension

neuronList[int]

The neuron list

activation_functionstr

The activation function

resnet_dtbool

Whether to use resnet

variablesdict

The input variables

suffixstr, optional

The suffix of the scope

out_dimint, optional

The output dimension

Returns:
dict

The converted network data

classmethod deserialize_network(data: dict, suffix: str = '') dict[source]

Deserialize network.

Parameters:
datadict

The input network data

suffixstr, optional

The suffix of the scope

Returns:
variablesdict

The input variables