deepmd.tf.utils.tabulate#

Attributes#

Classes#

DPTabulate

Class for tabulation.

Module Contents#

deepmd.tf.utils.tabulate.log[source]#
class deepmd.tf.utils.tabulate.DPTabulate(descrpt: deepmd.tf.descriptor.Descriptor, neuron: list[int], graph: deepmd.tf.env.tf.Graph, graph_def: deepmd.tf.env.tf.GraphDef, type_one_side: bool = False, exclude_types: list[list[int]] = [], activation_fn: Callable[[deepmd.tf.env.tf.Tensor], deepmd.tf.env.tf.Tensor] = tf.nn.tanh, suffix: str = '')[source]#

Bases: deepmd.utils.tabulate.BaseTabulate

Class for tabulation.

Compress a model, which including tabulating the embedding-net. The table is composed of fifth-order polynomial coefficients and is assembled from two sub-tables. The first table takes the stride(parameter) as it’s uniform stride, while the second table takes 10 * stride as it’s uniform stride The range of the first table is automatically detected by deepmd-kit, while the second table ranges from the first table’s upper boundary(upper) to the extrapolate(parameter) * upper.

Parameters:
descrpt

Descriptor of the original model

neuron

Number of neurons in each hidden layers of the embedding net \(\\mathcal{N}\)

graphtf.Graph

The graph of the original model

graph_deftf.GraphDef

The graph_def of the original model

type_one_side

Try to build N_types tables. Otherwise, building N_types^2 tables

exclude_typeslist[list[int]]

The excluded pairs of types which have no interaction with each other. For example, [[0, 1]] means no interaction between type 0 and type 1.

activation_function

The activation function in the embedding net. Supported options are {“tanh”,”gelu”} in common.ACTIVATION_FN_DICT.

suffixstr, optional

The suffix of the scope

descrpt_type = 'Atten'[source]#

Constructor.

graph[source]#
graph_def[source]#
suffix = ''[source]#
activation_fn[source]#
sub_sess[source]#
davg[source]#
dstd[source]#
ntypes[source]#
embedding_net_nodes[source]#
layer_size = 0[source]#
table_size = 0[source]#
bias[source]#
matrix[source]#
data_type[source]#
last_layer_size[source]#

Save the tabulation result.

data[source]#
upper[source]#
lower[source]#
_load_sub_graph()[source]#
_get_descrpt_type() str[source]#

Get the descrpt type.

_get_bias()[source]#

Get bias of embedding net.

_get_matrix()[source]#

Get weight matrx of embedding net.

_make_data(xx, idx)[source]#

Generate tabulation data for the given input.

Parameters:
xxnp.ndarray

Input values to tabulate

idxint

Index for accessing the correct network parameters

Returns:
tuple[np.ndarray, np.ndarray, np.ndarray]

Values, first derivatives, and second derivatives

_layer_0(x, w, b)[source]#
_layer_1(x, w, b)[source]#
_get_layer_size()[source]#

Get the number of embedding layer.

property _n_all_excluded: int[source]#

Then number of types excluding all types.

_convert_numpy_to_tensor() None[source]#

Convert self.data from np.ndarray to tf.Tensor.