Skip to content

Fix aten_pow when first input is a python constant #2048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 3, 2025
Merged
Changes from 2 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
4 changes: 3 additions & 1 deletion onnxscript/function_libs/torch_lib/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6652,11 +6652,13 @@
"aten::pow.Tensor_Scalar",
"_operator::pow",
),
traceable=True,
trace_only=True,
)
def aten_pow(self: TReal, exponent: TTensor) -> TReal:
"""pow(Tensor self, Tensor exponent) -> Tensor"""

if isinstance(self, (int, float)) and hasattr(exponent, "dtype"):
return op.Pow(op.Cast(self, to=exponent.dtype), exponent)

Check warning on line 6661 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#L6661

Added line #L6661 was not covered by tests
return op.Pow(self, exponent)


Expand Down
Loading