Skip to content
fn

det_op

→TensorImplPtr
int det_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Compute det⁡(A)\det(A) for a square float tensor.

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

Shape

  • a: (..., N, N).
  • Output: (...,) (rank decreases by 2; a single 2-D input yields a 0-D scalar).

See Also

inv_op : Matrix inverse, used in the backward.

Parameters

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

Returns

TensorImplPtr

Scalar-per-batch determinant of shape (...,) (the trailing two matrix dimensions are removed).

Raises

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

Notes

For ill-conditioned AA prefer slogdet (sign + log) when it becomes available; the magnitude of det can over/underflow long before AA is numerically singular.