Skip to content

Commit e8bae86

Browse files
committed
Annotate MelSpectrogram power as float only (#1572)
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.
1 parent 1437208 commit e8bae86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torchaudio/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def __init__(self,
474474
pad: int = 0,
475475
n_mels: int = 128,
476476
window_fn: Callable[..., Tensor] = torch.hann_window,
477-
power: Optional[float] = 2.,
477+
power: float = 2.,
478478
normalized: bool = False,
479479
wkwargs: Optional[dict] = None,
480480
center: bool = True,

0 commit comments

Comments
 (0)