deepmd.pt.loss.ener#
Classes#
Helper class that provides a standard way to create an ABC using | |
Helper class that provides a standard way to create an ABC using |
Functions#
|
Module Contents#
- deepmd.pt.loss.ener.custom_huber_loss(predictions: torch.Tensor, targets: torch.Tensor, delta: float = 1.0) torch.Tensor[source]#
- class deepmd.pt.loss.ener.EnergyStdLoss(starter_learning_rate: float = 1.0, start_pref_e: float = 0.0, limit_pref_e: float = 0.0, start_pref_f: float = 0.0, limit_pref_f: float = 0.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: float | None = None, enable_atom_ener_coeff: bool = False, start_pref_gf: float = 0.0, limit_pref_gf: float = 0.0, numb_generalized_coord: int = 0, loss_func: str = 'mse', inference: bool = False, use_huber: bool = False, use_default_pf: bool = False, f_use_norm: bool = False, huber_delta: float | list[float] = 0.01, intensive_ener_virial: bool = False, **kwargs: Any)[source]#
Bases:
deepmd.pt.loss.loss.TaskLossHelper class that provides a standard way to create an ABC using inheritance.
- forward(input_dict: dict[str, torch.Tensor], model: torch.nn.Module, label: dict[str, torch.Tensor], natoms: int, learning_rate: float, mae: bool = False) tuple[dict[str, torch.Tensor], torch.Tensor, dict[str, torch.Tensor]][source]#
Return loss on energy and force.
- Parameters:
- input_dict
dict[str,torch.Tensor] Model inputs.
- model
torch.nn.Module Model to be used to output the predictions.
- label
dict[str,torch.Tensor] Labels.
- natoms
int The local atom number.
- input_dict
- Returns:
- model_pred:
dict[str,torch.Tensor] Model predictions.
- loss:
torch.Tensor Loss for model to minimize.
- more_loss:
dict[str,torch.Tensor] Other losses for display.
- model_pred:
- property label_requirement: list[deepmd.utils.data.DataRequirementItem][source]#
Return data label requirements needed for this loss calculation.
- classmethod deserialize(data: dict) deepmd.pt.loss.loss.TaskLoss[source]#
Deserialize the loss module.
- Parameters:
- data
dict The serialized loss module
- data
- Returns:
LossThe deserialized loss module
- class deepmd.pt.loss.ener.EnergyHessianStdLoss(start_pref_h: float = 0.0, limit_pref_h: float = 0.0, **kwargs: Any)[source]#
Bases:
EnergyStdLossHelper class that provides a standard way to create an ABC using inheritance.
- forward(input_dict: dict[str, torch.Tensor], model: torch.nn.Module, label: dict[str, torch.Tensor], natoms: int, learning_rate: float, mae: bool = False) tuple[dict[str, torch.Tensor], torch.Tensor, dict[str, torch.Tensor]][source]#
Return loss on energy and force.
- Parameters:
- input_dict
dict[str,torch.Tensor] Model inputs.
- model
torch.nn.Module Model to be used to output the predictions.
- label
dict[str,torch.Tensor] Labels.
- natoms
int The local atom number.
- input_dict
- Returns:
- model_pred:
dict[str,torch.Tensor] Model predictions.
- loss:
torch.Tensor Loss for model to minimize.
- more_loss:
dict[str,torch.Tensor] Other losses for display.
- model_pred:
- property label_requirement: list[deepmd.utils.data.DataRequirementItem][source]#
Add hessian label requirement needed for this loss calculation.