squlearn.qnn.loss
.LossBase
- class squlearn.qnn.loss.LossBase
Base class implementation for loss functions.
- abstract gradient(value_dict: dict, **kwargs) ndarray | tuple[ndarray, ndarray]
Calculates and returns the gradient of the loss.
- set_opt_param_op(opt_param_op: bool = True)
Sets the opt_param_op flag.
- Parameters:
opt_param_op (bool) – True, if operator has trainable parameters
- abstract value(value_dict: dict, **kwargs) float
Calculates and returns the loss value.
- variance(value_dict: dict, **kwargs) float
Calculates and returns the variance of the loss value.