Skip to content
fn

inv_op

→TensorImplPtr
int inv_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Compute A−1A^{-1} for a square float tensor.

Validates that a is at least 2-D, square in the trailing two axes, and float-typed; dispatches to the backend; and wires InvBackward into the autograd graph (saving only the output) when grad mode is active.

Shape

  • a: (..., N, N).
  • Output: same shape as a.

See Also

solve_op : Often a better alternative — solves AX=BAX = B without forming A−1A^{-1} explicitly, with better conditioning. det_op : Determinant, which uses inv_op in its backward.

Parameters

aTensorImplPtr
Input matrix of shape (..., N, N).

Returns

TensorImplPtr

Inverse A−1A^{-1} of identical shape to a.

Raises

ValueError
If a is not square, fewer than 2-D, or non-float.
LinAlgError
(At backend level.) If AA is singular (LU produces a zero pivot).