theseus.Objective.error_metric

Objective.error_metric(input_tensors: Optional[Dict[str, Tensor]] = None, also_update: bool = False) Tensor

Aggregates all cost function errors into a (batched) scalar objective.

Parameters
  • input_tensors (Dict[str, torch.Tensor], optional) – if given, it must be a dictionary mapping variable names to tensors; if a variable with the given name is registered in the objective, its tensor will be replaced with the one in the dictionary (possibly permanently, depending on the value of also_update). Defaults to None, in which case the error is evaluated using the current tensors stored in all registered variables.

  • also_update (bool, optional) – if True, and input_tensors is given, the modified variables are permanently updated with the given tensors. Defaults to False, in which case the variables are reverted to the previous tensors after the error is evaluated.

Returns

a tensor of shape (batch_size,) with the scalar value of

the objective function.

Return type

torch.Tensor