Skip to content

Commit

Permalink
Annotate MelSpectrogram power as float only (pytorch#1572)
Browse files Browse the repository at this point in the history
Mel scale frequency is in general defined/used on power spectrogram and as far as we know, it is not defined for raw (complex value) spectrogram. When `power=None` (when intermediate spectrogram is complex-valued), `MelSpectrogram` fails because of extra dimension (when using pseudo complex) or type mismatch between `torch.float` and torch.cfloat` (when using native complex).

This commit changes type annotation so that power is only float.
  • Loading branch information
mthrok committed Jun 14, 2021
1 parent 1437208 commit e8bae86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchaudio/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def __init__(self,
pad: int = 0,
n_mels: int = 128,
window_fn: Callable[..., Tensor] = torch.hann_window,
power: Optional[float] = 2.,
power: float = 2.,
normalized: bool = False,
wkwargs: Optional[dict] = None,
center: bool = True,
Expand Down

0 comments on commit e8bae86

Please sign in to comment.