Skip to content
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] Support complex types #86746

Closed
justinchuby opened this issue Oct 11, 2022 · 1 comment
Closed

[ONNX] Support complex types #86746

justinchuby opened this issue Oct 11, 2022 · 1 comment
Labels
module: complex Related to complex number support in PyTorch module: onnx Related to torch.onnx needs design onnx-needs-info needs information from the author / reporter before ONNX team can take action triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@justinchuby
Copy link
Collaborator

Complex types are currently not tracible in the onnx export process. In ops like STFT, torch uses complex for the aten operators. Since ONNX has no plans for now to expand its complex support, we can consider creating a pass to convert complex inputs to real (and later cancel the nodes out like we do for quantized tensors) and consume them as real values.

This is blocking for STFT and other complex operator support.

@justinchuby justinchuby added the module: onnx Related to torch.onnx label Oct 11, 2022
@samdow samdow added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 12, 2022
@thiagocrepaldi
Copy link
Collaborator

We need to determine:

  • A minimal list of new ONNX operator specs necessary to support most models
    • conjugate is one example
  • A list of existing ONNX operators missing pytorch symbolics
  • Priority for this feature

pytorchmergebot pushed a commit that referenced this issue Mar 10, 2023
This PR addresses issue [#81075](#81075),  making `torch.stft` compatible with ONNX Opset 17's STFT operator.

The conversion works for _most_ of `torch.stft` functionality:

- Batched or unbatched inputs
- Normalization
- Pre-computed windows
- Rectangular windows
- One-sided returns
- Window centering (implicitly supported)

What is currently _not_ supported is **complex types**, due to the lack of conversion functionality between PyTorch and ONNX (#86746).

Regardless, this is easy to bypass by setting `return_complex=False` when using `torch.stft`.

Note that there is already a draft PR to address this (#83944), but it is currently closed and it only partially addresses the conversion (i.e., most of `torch.stft` functionality is lacking, and unit tests are missing).
Pull Request resolved: #92087
Approved by: https://github.com/justinchuby
cyyever pushed a commit to cyyever/pytorch_private that referenced this issue Mar 12, 2023
This PR addresses issue [#81075](pytorch/pytorch#81075),  making `torch.stft` compatible with ONNX Opset 17's STFT operator.

The conversion works for _most_ of `torch.stft` functionality:

- Batched or unbatched inputs
- Normalization
- Pre-computed windows
- Rectangular windows
- One-sided returns
- Window centering (implicitly supported)

What is currently _not_ supported is **complex types**, due to the lack of conversion functionality between PyTorch and ONNX (pytorch/pytorch#86746).

Regardless, this is easy to bypass by setting `return_complex=False` when using `torch.stft`.

Note that there is already a draft PR to address this (pytorch/pytorch#83944), but it is currently closed and it only partially addresses the conversion (i.e., most of `torch.stft` functionality is lacking, and unit tests are missing).
Pull Request resolved: pytorch/pytorch#92087
Approved by: https://github.com/justinchuby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: complex Related to complex number support in PyTorch module: onnx Related to torch.onnx needs design onnx-needs-info needs information from the author / reporter before ONNX team can take action triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
Status: Done
Development

No branches or pull requests

3 participants