Det - version 11#

This page documents version 11 of operator Det. See Det for the latest version (since version 22).

  • Domain: ai.onnx

  • Since version: 11

Det calculates determinant of a square matrix or batches of square matrices. Det takes one input tensor of shape [*, M, M], where * is zero or more batch dimensions, and the inner-most 2 dimensions form square matrices. The output is a tensor of shape [*], containing the determinants of all input submatrices. e.g., When the input is 2-D, the output is a scalar(shape is empty: []).

Inputs

  • X (T): Input tensor

Outputs

  • Y (T): Output tensor

Type Constraints

  • T: Constrain input and output types to floating-point tensors. Allowed types: tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_det_2d

Node:
  Det(X) -> (Y)
Inputs:
  X: shape=(2, 2), dtype=float32
    [[0., 1.],
     [2., 3.]]

Outputs:
  Y: shape=(), dtype=float32
    -2.

test_cc_det_double

Node:
  Det(X) -> (Y)
Inputs:
  X: shape=(2, 2), dtype=float64
    [[1., 1.],
     [1., 1.]]

Outputs:
  Y: shape=(), dtype=float64
    9.09494702e-13

test_cc_det_float16

Node:
  Det(X) -> (Y)
Inputs:
  X: shape=(3, 2, 2), dtype=float16
    [[[0., 1.],
      [2., 3.]],

     [[1., 2.],
      [2., 4.]],

     [[1., 2.],
      [3., 4.]]]

Outputs:
  Y: shape=(3,), dtype=float16
    [-2.,  0., -2.]

test_cc_det_float16_empty_batch

Node:
  Det(X) -> (Y)
Inputs:
  X: shape=(0, 2, 2), dtype=float16
    []

Outputs:
  Y: shape=(0,), dtype=float16
    []

test_cc_det_float16_scalar

Node:
  Det(X) -> (Y)
Inputs:
  X: shape=(2, 2), dtype=float16
    [[1., 2.],
     [3., 4.]]

Outputs:
  Y: shape=(), dtype=float16
    -2.

test_cc_det_nd

Node:
  Det(X) -> (Y)
Inputs:
  X: shape=(3, 2, 2), dtype=float32
    [[[1., 2.],
      [3., 4.]],

     [[1., 2.],
      [2., 1.]],

     [[1., 3.],
      [3., 1.]]]

Outputs:
  Y: shape=(3,), dtype=float32
    [-1.9999999, -3.       , -8.       ]