deepmd.tf.loss.loss

Module Contents

Classes

Loss

The abstract class for the loss function.

class deepmd.tf.loss.loss.Loss[source]

The abstract class for the loss function.

abstract build(learning_rate: deepmd.tf.env.tf.Tensor, natoms: deepmd.tf.env.tf.Tensor, model_dict: Dict[str, deepmd.tf.env.tf.Tensor], label_dict: Dict[str, deepmd.tf.env.tf.Tensor], suffix: str) Tuple[deepmd.tf.env.tf.Tensor, Dict[str, deepmd.tf.env.tf.Tensor]][source]

Build the loss function graph.

Parameters:
learning_ratetf.Tensor

learning rate

natomstf.Tensor

number of atoms

model_dictdict[str, tf.Tensor]

A dictionary that maps model keys to tensors

label_dictdict[str, tf.Tensor]

A dictionary that maps label keys to tensors

suffixstr

suffix

Returns:
tf.Tensor

the total squared loss

dict[str, tf.Tensor]

A dictionary that maps loss keys to more loss tensors

abstract eval(sess: deepmd.tf.env.tf.Session, feed_dict: Dict[deepmd.tf.env.tf.placeholder, deepmd.tf.env.tf.Tensor], natoms: deepmd.tf.env.tf.Tensor) dict[source]

Eval the loss function.

Parameters:
sesstf.Session

TensorFlow session

feed_dictdict[tf.placeholder, tf.Tensor]

A dictionary that maps graph elements to values

natomstf.Tensor

number of atoms

Returns:
dict

A dictionary that maps keys to values. It should contain key natoms

static display_if_exist(loss: deepmd.tf.env.tf.Tensor, find_property: float) deepmd.tf.env.tf.Tensor[source]

Display NaN if labeled property is not found.

Parameters:
losstf.Tensor

the loss tensor

find_propertyfloat

whether the property is found