deepmd.pt.loss.loss#

Classes#

TaskLoss

Helper class that provides a standard way to create an ABC using

Module Contents#

class deepmd.pt.loss.loss.TaskLoss(**kwargs)[source]#

Bases: torch.nn.Module, abc.ABC, make_plugin_registry('loss')

Helper class that provides a standard way to create an ABC using inheritance.

abstract forward(input_dict, model, label, natoms, learning_rate) NoReturn[source]#

Return loss .

property label_requirement: list[deepmd.utils.data.DataRequirementItem][source]#
Abstractmethod:

Return data label requirements needed for this loss calculation.

static display_if_exist(loss: torch.Tensor, find_property: float) torch.Tensor[source]#

Display NaN if labeled property is not found.

Parameters:
losstorch.Tensor

the loss tensor

find_propertyfloat

whether the property is found

classmethod get_loss(loss_params: dict) TaskLoss[source]#

Get the loss module by the parameters.

By default, all the parameters are directly passed to the constructor. If not, override this method.

Parameters:
loss_paramsdict

The loss parameters

Returns:
TaskLoss

The loss module