deepmd.dpmodel.utils.type_embed#

Classes#

TypeEmbedNet

Type embedding network.

Functions#

get_econf_tebd(type_map[, precision])

Module Contents#

class deepmd.dpmodel.utils.type_embed.TypeEmbedNet(*, ntypes: int, neuron: list[int], resnet_dt: bool = False, activation_function: str = 'tanh', precision: str = 'default', trainable: bool = True, seed: int | list[int] | None = None, padding: bool = False, use_econf_tebd: bool = False, use_tebd_bias: bool = False, type_map: list[str] | None = None)[source]#

Bases: deepmd.dpmodel.common.NativeOP

Type embedding network.

Parameters:
ntypesint

Number of atom types

neuronlist[int]

Number of neurons in each hidden layers of the embedding net

resnet_dt

Time-step dt in the resnet construction: y = x + dt * phi (Wx + b)

activation_function

The activation function in the embedding net. Supported options are “none”, “gelu_tf”, “linear”, “relu6”, “sigmoid”, “tanh”, “gelu”, “relu”, “softplus”.

precision

The precision of the embedding net parameters. Supported options are “float16”, “float64”, “default”, “float32”.

trainable

If the weights of embedding net are trainable.

seed

Random seed for initializing the network parameters.

padding

Concat the zero padding to the output, as the default embedding of empty type.

use_econf_tebd: bool, Optional

Whether to use electronic configuration type embedding.

use_tebd_biasbool, Optional

Whether to use bias in the type embedding layer.

type_map: list[str], Optional

A list of strings. Give the name to each type of atoms.

ntypes[source]#
neuron[source]#
seed[source]#
resnet_dt[source]#
precision[source]#
activation_function[source]#
trainable[source]#
padding[source]#
use_econf_tebd[source]#
use_tebd_bias[source]#
type_map[source]#
embedding_net[source]#
call() numpy.ndarray[source]#

Compute the type embedding network.

classmethod deserialize(data: dict)[source]#

Deserialize the model.

Parameters:
datadict

The serialized data

Returns:
Model

The deserialized model

serialize() dict[source]#

Serialize the model.

Returns:
dict

The serialized data

change_type_map(type_map: list[str], model_with_new_type_stat=None) None[source]#

Change the type related params to new ones, according to type_map and the original one in the model. If there are new types in type_map, statistics will be updated accordingly to model_with_new_type_stat for these new types.

deepmd.dpmodel.utils.type_embed.get_econf_tebd(type_map, precision: str = 'default')[source]#