osl_dynamics.inference.ops.add_epsilon#

osl_dynamics.inference.ops.add_epsilon(A, epsilon, diag=False)#

Add epsilon to the diagonal of square matrices or to every element.

Parameters:
Atf.Tensor

Batches of square matrices or vectors. Shape is (…, N, N) or (…, N).

epsilonfloat

Small error added to the diagonal of the matrices or every element of the vectors.

diagbool, optional

Do we want to add epsilon to the diagonal only?

Returns:
Atf.Tensor

A with epsilon added. Same shape as the input.