Skip to content

Commit d1d6dbc

Browse files
authored
Simplify axis value checks (#1501)
1 parent d49e6e4 commit d1d6dbc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchaudio/functional/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def mask_along_axis_iid(
732732
Tensor: Masked spectrograms of dimensions (batch, channel, freq, time)
733733
"""
734734

735-
if axis != 2 and axis != 3:
735+
if axis not in [2, 3]:
736736
raise ValueError('Only Frequency and Time masking are supported')
737737

738738
device = specgrams.device
@@ -774,7 +774,7 @@ def mask_along_axis(
774774
Returns:
775775
Tensor: Masked spectrogram of dimensions (channel, freq, time)
776776
"""
777-
if axis != 1 and axis != 2:
777+
if axis not in [1, 2]:
778778
raise ValueError('Only Frequency and Time masking are supported')
779779

780780
# pack batch

0 commit comments

Comments
 (0)