Skip to content

Commit

Permalink
Register aten::pow.Scalar for aten::pow (#1719)
Browse files Browse the repository at this point in the history
Hello,

After upgrading onnxscript from version `0.1.0.dev20240516` to the
latest version, I encountered an error while trying to export my Torch
model to ONNX:
```
torch.onnx._internal.diagnostics.infra.context.RuntimeErrorWithDiagnostic: Unsupported FX nodes: {'call_function': ['aten.pow.Scalar']}. 
```
Upon investigating the issue, I found that the changes made to
`aten_pow` in PR #1612 are causing this problem. Reverting these changes
allows the model to be exported to ONNX successfully again.

Could support for `aten::pow` be reintroduced to enable smooth exporting
of models?

Thank you for your consideration.

---------

Signed-off-by: Hankyeol Kyung <[email protected]>
Co-authored-by: Justin Chu <[email protected]>
  • Loading branch information
keenranger and justinchuby authored Jul 5, 2024
1 parent 08c8307 commit ee1ac58
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion onnxscript/function_libs/torch_lib/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6555,7 +6555,14 @@ def aten_positive(self: TensorType) -> TensorType:
raise NotImplementedError()


@torch_op(("aten::pow.Tensor_Tensor", "aten::pow.Tensor_Scalar", "_operator::pow"))
@torch_op(
(
"aten::pow.Scalar",
"aten::pow.Tensor_Tensor",
"aten::pow.Tensor_Scalar",
"_operator::pow",
)
)
def aten_pow(self: TReal, exponent: TTensor) -> TReal:
"""pow(Tensor self, Tensor exponent) -> Tensor"""

Expand Down

0 comments on commit ee1ac58

Please sign in to comment.