deepmd.pt_expt.loss.tensor#
Classes#
Loss on local and global tensors (e.g. dipole, polarizability). |
Module Contents#
- class deepmd.pt_expt.loss.tensor.TensorLoss(tensor_name: str, tensor_size: int, label_name: str, pref_atomic: float = 0.0, pref: float = 0.0, enable_atomic_weight: bool = False, **kwargs: Any)[source]#
Bases:
deepmd.dpmodel.loss.loss.LossLoss on local and global tensors (e.g. dipole, polarizability).
- Parameters:
- tensor_name
str The name of the tensor in model predictions.
- tensor_size
int The size (dimension) of the tensor.
- label_name
str The name of the tensor in labels.
- pref_atomic
float The prefactor of the weight of atomic (local) loss.
- pref
float The prefactor of the weight of global loss.
- enable_atomic_weightbool
If true, atomic weight will be used in the loss calculation.
- **kwargs
Other keyword arguments.
- tensor_name
- tensor_name#
- tensor_size#
- label_name#
- local_weight = 0.0#
- global_weight = 0.0#
- enable_atomic_weight = False#
- has_local_weight#
- has_global_weight#
- call(learning_rate: float, natoms: int, model_dict: dict[str, deepmd.dpmodel.array_api.Array], label_dict: dict[str, deepmd.dpmodel.array_api.Array], mae: bool = False) tuple[deepmd.dpmodel.array_api.Array, dict[str, deepmd.dpmodel.array_api.Array]][source]#
Calculate loss from model results and labeled results.
- property label_requirement: list[deepmd.utils.data.DataRequirementItem]#
Return data label requirements needed for this loss calculation.
- classmethod deserialize(data: dict) TensorLoss[source]#
Deserialize the loss module.