Skip to content

Commit fdef96c

Browse files
authored
Implement aten::det | feat(torchlib) (#1142)
1 parent 6200a29 commit fdef96c

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

onnxscript/function_libs/torch_lib/ops/core.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,12 +2378,6 @@ def aten_dense_dim(self: TensorType) -> int:
23782378
raise NotImplementedError()
23792379

23802380

2381-
def aten_det(self: TensorType) -> TensorType:
2382-
"""det(Tensor self) -> Tensor"""
2383-
2384-
raise NotImplementedError()
2385-
2386-
23872381
@torch_op("aten::detach")
23882382
def aten_detach(self: TensorType) -> TensorType:
23892383
"""detach(Tensor(a) self) -> Tensor(a)"""

onnxscript/function_libs/torch_lib/ops/linalg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ def aten_linalg_cross(self: TensorType, other: TensorType, dim: int = -1) -> Ten
4646
raise NotImplementedError()
4747

4848

49-
def aten_linalg_det(A: TensorType) -> TensorType:
49+
@torch_op(("aten::linalg_det", "aten::det"))
50+
def aten_linalg_det(A: TFloat) -> TFloat:
5051
"""linalg_det(Tensor A) -> Tensor"""
5152

52-
raise NotImplementedError()
53+
return op.Det(A)
5354

5455

5556
def aten_linalg_diagonal(

onnxscript/tests/function_libs/torch_lib/ops_test_data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ def _where_input_wrangler(
821821
TorchLibOpInfo("isneginf", core_ops.aten_isneginf),
822822
TorchLibOpInfo("isposinf", core_ops.aten_isposinf),
823823
TorchLibOpInfo("lift_fresh_copy", core_ops.aten_lift_fresh_copy),
824+
TorchLibOpInfo("linalg.det", linalg_ops.aten_linalg_det),
824825
TorchLibOpInfo(
825826
"linalg.vector_norm",
826827
linalg_ops.aten_linalg_vector_norm,

0 commit comments

Comments
 (0)