We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c0b72b commit bb75e2bCopy full SHA for bb75e2b
onnxscript/function_libs/torch_lib/ops/core.py
@@ -8533,6 +8533,14 @@ def aten_trunc(self: TFloat) -> TFloat:
8533
return op.Floor(op.Abs(self)) * op.Sign(self)
8534
8535
8536
+@torch_op("math::trunc", trace_only=True)
8537
+def python_math_trunc(self: TFloat) -> TInt:
8538
+ """trunc(Tensor self) -> Tensor"""
8539
+ # NOTE: This is used in SymInt/SymBool/SymFloat context, so
8540
+ # we don't expect overflow to happen here.
8541
+ return op.Cast(self, to=INT64.dtype)
8542
+
8543
8544
@torch_op("aten::type_as", trace_only=True)
8545
def aten_type_as(self: TTensor, other: TTensor2) -> TTensor2:
8546
"""type_as(Tensor self, Tensor other) -> Tensor"""
0 commit comments