deepmd.loss package

Submodules

deepmd.loss.ener module

class deepmd.loss.ener.EnerDipoleLoss(starter_learning_rate: float, start_pref_e: float = 0.1, limit_pref_e: float = 1.0, start_pref_ed: float = 1.0, limit_pref_ed: float = 1.0)[source]

Bases: deepmd.loss.loss.Loss

Methods

build(learning_rate, natoms, model_dict, ...)

Build the loss function graph.

eval(sess, feed_dict, natoms)

Eval the loss function.

print_header

print_on_training

build(learning_rate, natoms, model_dict, label_dict, suffix)[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

eval(sess, feed_dict, natoms)[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 print_header()[source]
print_on_training(tb_writer, cur_batch, sess, natoms, feed_dict_test, feed_dict_batch)[source]
class deepmd.loss.ener.EnerStdLoss(starter_learning_rate: float, start_pref_e: float = 0.02, limit_pref_e: float = 1.0, start_pref_f: float = 1000, limit_pref_f: float = 1.0, start_pref_v: float = 0.0, limit_pref_v: float = 0.0, start_pref_ae: float = 0.0, limit_pref_ae: float = 0.0, start_pref_pf: float = 0.0, limit_pref_pf: float = 0.0, relative_f: Optional[float] = None, enable_atom_ener_coeff: bool = False)[source]

Bases: deepmd.loss.loss.Loss

Standard loss function for DP models

Parameters
enable_atom_ener_coeffbool

if true, the energy will be computed as sum_i c_i E_i

Methods

build(learning_rate, natoms, model_dict, ...)

Build the loss function graph.

eval(sess, feed_dict, natoms)

Eval the loss function.

print_header

print_on_training

build(learning_rate, natoms, model_dict, label_dict, suffix)[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

eval(sess, feed_dict, natoms)[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

print_header()[source]
print_on_training(tb_writer, cur_batch, sess, natoms, feed_dict_test, feed_dict_batch)[source]

deepmd.loss.loss module

class deepmd.loss.loss.Loss[source]

Bases: object

The abstract class for the loss function.

Methods

build(learning_rate, natoms, model_dict, ...)

Build the loss function graph.

eval(sess, feed_dict, natoms)

Eval the loss function.

abstract build(learning_rate: tensorflow.python.framework.ops.Tensor, natoms: tensorflow.python.framework.ops.Tensor, model_dict: Dict[str, tensorflow.python.framework.ops.Tensor], label_dict: Dict[str, tensorflow.python.framework.ops.Tensor], suffix: str) Tuple[tensorflow.python.framework.ops.Tensor, Dict[str, tensorflow.python.framework.ops.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: tensorflow.python.client.session.Session, feed_dict: Dict[tensorflow.python.ops.array_ops.placeholder, tensorflow.python.framework.ops.Tensor], natoms: tensorflow.python.framework.ops.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

deepmd.loss.tensor module

class deepmd.loss.tensor.TensorLoss(jdata, **kwarg)[source]

Bases: deepmd.loss.loss.Loss

Loss function for tensorial properties.

Methods

build(learning_rate, natoms, model_dict, ...)

Build the loss function graph.

eval(sess, feed_dict, natoms)

Eval the loss function.

print_header

print_on_training

build(learning_rate, natoms, model_dict, label_dict, suffix)[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

eval(sess, feed_dict, natoms)[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

print_header()[source]
print_on_training(tb_writer, cur_batch, sess, natoms, feed_dict_test, feed_dict_batch)[source]