Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions onnxscript/function_libs/torch_lib/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8533,6 +8533,14 @@ def aten_trunc(self: TFloat) -> TFloat:
return op.Floor(op.Abs(self)) * op.Sign(self)


@torch_op("math::trunc", trace_only=True)
def python_math_trunc(self: TFloat) -> TInt:
"""trunc(Tensor self) -> Tensor"""
# NOTE: This is used in SymInt/SymBool/SymFloat context, so
# we don't expect overflow to happen here.
return op.Cast(self, to=INT64.dtype)


@torch_op("aten::type_as", trace_only=True)
def aten_type_as(self: TTensor, other: TTensor2) -> TTensor2:
"""type_as(Tensor self, Tensor other) -> Tensor"""
Expand Down
Loading