- Neural Network Programming with TensorFlow
- Manpreet Singh Ghotra Rajdeep Dua
- 76字
- 2025-02-18 10:09:00
Inverse matrix
The matrix inverse of I is denoted as . Consider the following equation; to solve it using inverse and different values of b, there can be multiple solutions for x. Note the property:

The following example shows how to calculate the inverse of a matrix using the matrix_inverse operation:
import tensorflow as tf
mat = tf.constant([[2, 3, 4], [5, 6, 7], [8, 9, 10]], dtype=tf.float32)
print(mat)
inv_mat = tf.matrix_inverse(tf.transpose(mat))
with tf.Session() as sess:
print(sess.run(inv_mat))