e3x.ops.safe

Numerically stable and nan-safe implementations of common operations.

In some cases, the operation itself is unproblematic, but certain inputs may result in NaNs when taking derivatives. The implementations in this module do not suffer from such issues.

Functions

normalize(x[, axis])

Normalize x using the L2-norm of x along the specified axis.

normalize_and_return_norm(x[, axis, keepdims])

Normalize x using the L2-norm along the specified axis and return its norm.