gensbi.diagnostics.metrics.l1_l2#

Functions#

l1(x, y[, axis])

Calculates the L1 (Manhattan) distance between two tensors.

l2(x, y[, axis])

Calculates the L2 (Euclidean) distance between two tensors.

Module Contents#

gensbi.diagnostics.metrics.l1_l2.l1(x, y, axis=-1)[source]#

Calculates the L1 (Manhattan) distance between two tensors.

Parameters:
  • x (Array) – The first tensor.

  • y (Array) – The second tensor.

  • axis (int, optional) – The axis along which to calculate the L2 distance. Defaults to -1.

Returns:

A tensor containing the L1 distance between x and y along the specified axis.

Return type:

Array

gensbi.diagnostics.metrics.l1_l2.l2(x, y, axis=-1)[source]#

Calculates the L2 (Euclidean) distance between two tensors.

Parameters:
  • x (Array) – The first tensor.

  • y (Array) – The second tensor.

  • axis (int, optional) – The axis along which to calculate the L2 distance. Defaults to -1.

Returns:

A tensor containing the L2 distance between x and y along the specified axis.

Return type:

Array