Skip to content

Commit 81a980f

Browse files
committed
Fix
1 parent 8d1b7fa commit 81a980f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

torchaudio/functional/functional.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ def spectrogram(
113113
if power is not None:
114114
if power == 1.0:
115115
return spec_f.abs()
116-
if power == 2.0:
117-
if spec_f.is_cuda:
118-
return torch.view_as_real(spec_f).pow(power).sum(-1)
119-
return spec_f.pow(power)
116+
if power == 2.0 and spec_f.is_cuda:
117+
return torch.view_as_real(spec_f).pow(power).sum(-1)
120118
return spec_f.abs().pow(power)
121119
if not return_complex:
122120
return torch.view_as_real(spec_f)

0 commit comments

Comments
 (0)