waxmorph.jax.losses.squared_loss

Contents

waxmorph.jax.losses.squared_loss#

waxmorph.jax.losses.squared_loss(X_pred, X_target)[source]#

Squared Frobenius norm for row-aligned arrays of equal shape.

Use chamfer_distance() or make_sinkhorn_loss() for unordered rows.

\[\mathcal{L} = \lVert X^f - X^T \rVert_F^2\]
Raises:

ValueError – If the input shapes differ.

Parameters:
Return type:

Array

Examples

>>> x = jnp.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]])
>>> y = jnp.array([[0.0, 0.0, 0.0], [2.0, 0.0, 0.0]])
>>> print(float(squared_loss(x, y)))
1.0