-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[ONNX] Add complex constant support #138279
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] Add complex constant support #138279
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/138279
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 48bcd3d with merge base 8231180 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
If I try with the following repro to prove the fix: import torch
class MulModule(torch.nn.Module):
def forward(self, x, y):
return torch.ops.aten.mul(x, y)
# Example usage with complex inputs
x = torch.tensor([[1.0 + 2.0j, 3.0 + 4.0j],
[5.0 + 6.0j, 7.0 + 8.0j]], dtype=torch.complex64)
# Example 1: Non-tensor input (scalar)
y = 2 + 3j
onnx_program = torch.onnx.export(MulModule(), (x, y,), "slice.onnx", dynamo=True, report=True)I get |
|
I see. Just move it to inside the forward function? |
Thanks! A test can be added! |
|
@justinchuby PTAL |
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
|
@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 |
Transform complex python constant to float representation as well, like what we have with tensors. PS: I find it's not reasonable to add "complex->float" in IR side, so I put it here. Pull Request resolved: #138279 Approved by: https://github.com/justinchuby Co-authored-by: Justin Chu <justinchuby@users.noreply.github.com>
Transform complex python constant to float representation as well, like what we have with tensors.
PS: I find it's not reasonable to add "complex->float" in IR side, so I put it here.