Det¶
Det - 22¶
Version¶
name: Det (GitHub)
domain:
mainsince_version:
22function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 22.
Summary¶
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 (heterogeneous) - T:
Input tensor
Outputs¶
Y (heterogeneous) - T:
Output tensor
Type Constraints¶
T in (
tensor(bfloat16),tensor(double),tensor(float),tensor(float16)):Constrain input and output types to floating-point tensors.
Examples¶
_2d¶
import numpy as np
import onnx
node = onnx.helper.make_node(
"Det",
inputs=["x"],
outputs=["y"],
)
x = np.arange(4).reshape(2, 2).astype(np.float32)
y = np.linalg.det(x) # expect -2
expect(node, inputs=[x], outputs=[y], name="test_det_2d")
_nd¶
import numpy as np
import onnx
node = onnx.helper.make_node(
"Det",
inputs=["x"],
outputs=["y"],
)
x = np.array([[[1, 2], [3, 4]], [[1, 2], [2, 1]], [[1, 3], [3, 1]]]).astype(
np.float32
)
y = np.linalg.det(x) # expect array([-2., -3., -8.])
expect(node, inputs=[x], outputs=[y], name="test_det_nd")
Det - 11¶
Version¶
name: Det (GitHub)
domain:
mainsince_version:
11function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 11.
Summary¶
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 (heterogeneous) - T:
Input tensor
Outputs¶
Y (heterogeneous) - T:
Output tensor
Type Constraints¶
T in (
tensor(double),tensor(float),tensor(float16)):Constrain input and output types to floating-point tensors.