-
Notifications
You must be signed in to change notification settings - Fork 64
Test fft normalization #2209
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
base: main
Are you sure you want to change the base?
Test fft normalization #2209
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
|
||
from typing import Optional, Sequence | ||
|
||
from onnxscript import INT64 | ||
from onnxscript import INT64, ir | ||
Check warningCode scanning / lintrunner PYLINT/W0611 Warning
Unused ir imported from onnxscript (unused-import)
See unused-import. To disable, use # pylint: disable=unused-import Check warningCode scanning / lintrunner RUFF/F401 Warning
onnxscript.ir imported but unused.
See https://docs.astral.sh/ruff/rules/unused-import |
||
from onnxscript.function_libs.torch_lib.registration import torch_op | ||
from onnxscript.function_libs.torch_lib.tensor_typing import TFloat | ||
from onnxscript.onnx_opset import opset18 as op | ||
|
@@ -118,12 +118,18 @@ | |
# Torch truncates/pads on the last dimension only. Typically, the only valid values that can be passed | ||
# into PyTorch are n or n//2+1, where n is self.shape[dim[-1]], but this is not always the case, so we | ||
# place no such restriction on the ONNX side. | ||
transformed = op.DFT( | ||
transformed, | ||
dft_length=last_dim_size, | ||
axis=dimension, | ||
inverse=True, | ||
onesided=False, | ||
scale = (op.CastLike(last_dim_size, self)) / op.CastLike( | ||
op.Shape(transformed, start=dimension, end=dimension + 1), self | ||
) | ||
transformed = ( | ||
op.DFT( | ||
transformed, | ||
dft_length=last_dim_size, | ||
axis=dimension, | ||
inverse=True, | ||
onesided=False, | ||
) | ||
* scale | ||
) | ||
transformed = _fftn_onnx_normalization( | ||
transformed, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps replace line 137 (op.Shape...) with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought last_dim_size was There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, nvm, sorry, you're completely right about |
||
|
Check notice
Code scanning / CodeQL
Unused import Note
Copilot Autofix
AI 10 days ago
To fix the issue, we should remove the unused import of
ir
from theonnxscript
module. This will clean up the code and eliminate the unnecessary dependency. The change should be made on line 17, where the import statement is defined.