Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 2 additions & 9 deletions onnxscript/function_libs/torch_lib/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7352,18 +7352,11 @@
return op.Reciprocal(op.Sqrt(self))


@torch_op(("aten::rsub.Tensor", "aten::rsub.Scalar"))
# Do not register rsub. It will be decomposed and type promoted by torch
def aten_rsub(self: TReal, other: TReal, alpha: float = 1.0) -> TReal:
"""rsub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor"""

return op.Sub(other, op.Mul(self, alpha))


@torch_op(("aten::rsub.Tensor", "aten::rsub.Scalar"), trace_only=True, complex=True)
def aten_rsub_complex(self: TReal, other: TReal, alpha: float = 1.0) -> TReal:
"""rsub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor"""

return aten_rsub(self, other, alpha)
raise NotImplementedError

Check warning on line 7359 in onnxscript/function_libs/torch_lib/ops/core.py

View check run for this annotation

Codecov / codecov/patch

onnxscript/function_libs/torch_lib/ops/core.py#L7359

Added line #L7359 was not covered by tests


@torch_op("aten::scalar_tensor", trace_only=True)
Expand Down
2 changes: 0 additions & 2 deletions tests/function_libs/torch_lib/ops_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,8 +1360,6 @@ def _where_input_wrangler(
),
TorchLibOpInfo("round_decimals", core_ops.aten_round_decimals),
TorchLibOpInfo("rsqrt", core_ops.aten_rsqrt),
TorchLibOpInfo("rsub", core_ops.aten_rsub),
TorchLibOpInfo("rsub", core_ops.aten_rsub_complex, complex=True),
TorchLibOpInfo(
"scalar_tensor",
core_ops.aten_scalar_tensor,
Expand Down
Loading