l2_norm

Contents

l2_norm#

class braintools.metric.l2_norm(predictions, targets=None, axis=None)#

Computes the L2 norm of the difference between predictions and targets.

Parameters:
  • predictions (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – a vector of arbitrary shape […].

  • targets (Array | ndarray | bool | number | bool | int | float | complex | Quantity | None) – a vector with shape broadcastable to that of predictions; if not provided then it is assumed to be a vector of zeros.

  • axis (int | tuple[int, ...] | None) – the dimensions to reduce. If None, the loss is reduced to a scalar.

Return type:

Array | ndarray | bool | number | bool | int | float | complex | Quantity

Returns:

elementwise l2 norm of the differences, with same shape as predictions.