Skip to content

Logmel: use jnp.fft.rfft instead of jnp.fft.fft. #1221

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

Merged
merged 1 commit into from
May 29, 2025
Merged

Logmel: use jnp.fft.rfft instead of jnp.fft.fft. #1221

merged 1 commit into from
May 29, 2025

Conversation

ds-hwang
Copy link
Contributor

Audio samples are always real-valued, which is why the more efficient rfft can be used.

Currently, the logmel frontend uses fft and manually slices the output tensor to fft_size // 2 + 1. In contrast, rfft directly returns a tensor of shape fft_size // 2 + 1 because, when the input is real, half of the FFT output consists of conjugate complex values, essentially redundant information.

Audio samples are always real-valued, which is why the more efficient `rfft`
can be used.

Currently, the logmel frontend uses `fft` and manually slices the output tensor
to `fft_size // 2 + 1`. In contrast, `rfft` directly returns a tensor of shape
`fft_size // 2 + 1` because, when the input is real, half of the FFT output
consists of conjugate complex values, essentially redundant information.
@ds-hwang ds-hwang requested review from ruomingp, markblee and a team as code owners May 28, 2025 16:47
@ds-hwang ds-hwang enabled auto-merge May 28, 2025 16:48
@ds-hwang
Copy link
Contributor Author

@markblee Could you review it? From 1372

@ds-hwang ds-hwang added this pull request to the merge queue May 29, 2025
Merged via the queue into main with commit 044dc16 May 29, 2025
11 checks passed
@ds-hwang ds-hwang deleted the frontend branch May 29, 2025 21:29
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