Skip to content

Annotate kaldi.vtln_warp_mel_freq low_freq as float for TorchScript#4195

Open
adityasingh2400 wants to merge 1 commit into
pytorch:mainfrom
adityasingh2400:fix-vtln-warp-mel-freq-type-hint-3729
Open

Annotate kaldi.vtln_warp_mel_freq low_freq as float for TorchScript#4195
adityasingh2400 wants to merge 1 commit into
pytorch:mainfrom
adityasingh2400:fix-vtln-warp-mel-freq-type-hint-3729

Conversation

@adityasingh2400
Copy link
Copy Markdown

Summary

torchaudio.compliance.kaldi.vtln_warp_mel_freq accepted low_freq without a type annotation, while every other parameter in the signature (vtln_low_cutoff, vtln_high_cutoff, high_freq, vtln_warp_factor, mel_freq) was annotated. Without the hint, torch.jit.script infers Tensor and refuses to lower the function, blocking TorchScript export of any model that exercises this path.

The sibling vtln_warp_freq function (line 337) already annotates low_freq: float, so this matches existing convention.

Change

One-token addition of : float to the low_freq parameter.

 def vtln_warp_mel_freq(
     vtln_low_cutoff: float,
     vtln_high_cutoff: float,
-    low_freq,
+    low_freq: float,
     high_freq: float,
     vtln_warp_factor: float,
     mel_freq: Tensor,
 ) -> Tensor:

The existing docstring already documents the parameter as low_freq (float), so behaviour and documentation are unchanged. Runtime behaviour is unchanged; this is purely a TorchScript compatibility fix.

Fixes #3729

src/torchaudio/compliance/kaldi.py vtln_warp_mel_freq accepted low_freq
without a type annotation, so torch.jit.script could not lower it
while every other param in the signature was annotated. Add : float
to bring it in line.

Fixes pytorch#3729
@adityasingh2400 adityasingh2400 requested a review from a team as a code owner May 22, 2026 00:41
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 22, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/audio/4195

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

torchaudio.compliance.kaldi requires annotation on vtln_warp_mel_freq

1 participant