-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[ONNX] Remove type promotion rule for pow #139527
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
[ONNX] Remove type promotion rule for pow #139527
Conversation
ONNX supports different input types in Pow, so type promotion is not needed
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/139527
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c4679a1 with merge base d338499 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
ONNX supports different input types in Pow, so type promotion is not needed.
The resulting graph is the following:
```py
ONNXProgram(
model=
<
ir_version=9,
opset_imports={'': 18, 'pkg.onnxscript.torch_lib.common': 1},
producer_name='pytorch',
producer_version='2.6.0a0+git59a1af5',
domain=None,
model_version=None,
>
graph(
name=main_graph,
inputs=(
%"x"<FLOAT16,[3]>
),
outputs=(
%"pow_1"<FLOAT16,[3]>
),
) {
0 | # node_Constant_0
%"val_0"<?,?> ⬅️ ::Constant() {value=Tensor<FLOAT,[]>(array(2., dtype=float32), name=None)}
1 | # node_Pow_1
%"pow_1"<FLOAT16,[3]> ⬅️ ::Pow(%"x", %"val_0")
return %"pow_1"<FLOAT16,[3]>
}
...
,
exported_program=
ExportedProgram:
class GraphModule(torch.nn.Module):
def forward(self, x: "f16[3]"):
# File: /workspace/pytorch/test/onnx/exporter/test_small_models_e2e.py:53 in forward, code: return x**2.0
pow_1: "f16[3]" = torch.ops.aten.pow.Tensor_Scalar(x, 2.0); x = None
return (pow_1,)
Graph signature: ExportGraphSignature(input_specs=[InputSpec(kind=<InputKind.USER_INPUT: 1>, arg=TensorArgument(name='x'), target=None, persistent=None)], output_specs=[OutputSpec(kind=<OutputKind.USER_OUTPUT: 1>, arg=TensorArgument(name='pow_1'), target=None)])
Range constraints: {}
)
```
Pull Request resolved: pytorch#139527
Approved by: https://github.com/titaiwangms
ONNX supports different input types in Pow, so type promotion is not needed.
The resulting graph is the following: