Skip to content

Python o fix#21

Merged
adefossez merged 1 commit intoadefossez:mainfrom
aiknownc:python-o-fix
Feb 17, 2025
Merged

Python o fix#21
adefossez merged 1 commit intoadefossez:mainfrom
aiknownc:python-o-fix

Conversation

@aiknownc
Copy link
Contributor

Fix for unintended side effect in unfold() assert statement that causes an exception when running with python -O.

Example error:

  File "/home/appuser/miniconda3/envs/jultest/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/appuser/miniconda3/envs/jultest/lib/python3.10/site-packages/julius/lowpass.py", line 107, in forward
    out = fft_conv1d(input, self.filters, stride=self.stride)
  File "/home/appuser/miniconda3/envs/jultest/lib/python3.10/site-packages/julius/fftconv.py", line 122, in fft_conv1d
    frames = unfold(input, block_size, fold_stride)
  File "/home/appuser/miniconda3/envs/jultest/lib/python3.10/site-packages/julius/core.py", line 122, in unfold
    return padded.as_strided(shape + [n_frames, kernel_size], strides)
RuntimeError: mismatch in length of strides and shape

@adefossez adefossez merged commit b2a7ea8 into adefossez:main Feb 17, 2025
0 of 3 checks passed
@adefossez
Copy link
Owner

Thanks for the fix! Indeed I never thought of avoiding side effects in assert, probably a best practice to have for the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants