Skip to content

Commit

Permalink
[torchlib] Do not register rsub
Browse files Browse the repository at this point in the history
  • Loading branch information
justinchuby committed Oct 14, 2024
1 parent a4f3bcb commit 83b2a09
Showing 1 changed file with 2 additions and 9 deletions.
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 @@ def aten_rsqrt(self: TFloat) -> TFloat:
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

0 comments on commit 83b2a09

Please sign in to comment.