tf.linalg.lu_matrix_inverse

View source on GitHub

Computes the inverse given the LU decomposition(s) of one or more matrices.

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

This op is conceptually identical to,

inv_X = tf.lu_matrix_inverse(*tf.linalg.lu(X))
tf.assert_near(tf.matrix_inverse(X), inv_X)
# ==> True

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 = [[[3., 4], [1, 2]],
     [[7., 8], [3, 4]]]
inv_x = tf.linalg.lu_matrix_inverse(*tf.linalg.lu(x))
tf.assert_near(tf.matrix_inverse(x), inv_x)
# ==> True