tf.linalg.lu_solve

View source on GitHub

Solves systems of linear eqns A X = RHS, given LU factorizations.

tf.linalg.lu_solve(
    lower_upper, perm, rhs, validate_args=False, name=None
)

Note: this function does not verify the implied matrix is actually invertible nor is this condition checked even when validate_args=True.

Args:

Returns:

Examples

import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp

x = [[[1., 2],
      [3, 4]],
     [[7, 8],
      [3, 4]]]
inv_x = tf.linalg.lu_solve(*tf.linalg.lu(x), rhs=tf.eye(2))
tf.assert_near(tf.matrix_inverse(x), inv_x)
# ==> True