Skip to content

Commit

Permalink
Delete redundancy for loop checks. (#35288)
Browse files Browse the repository at this point in the history
Signed-off-by: zhanluxianshen <[email protected]>
  • Loading branch information
zhanluxianshen authored Dec 16, 2024
1 parent d0f3221 commit d5b81e1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/transformers/audio_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,12 @@ def spectrogram_batch(
if hop_length <= 0:
raise ValueError("hop_length must be greater than zero")

# Check the dimensions of the waveform
# Check the dimensions of the waveform , and if waveform is complex
for waveform in waveform_list:
if waveform.ndim != 1:
raise ValueError(f"Input waveform must have only one dimension, shape is {waveform.shape}")

# Check if waveform is complex
for waveform in waveform_list:
if np.iscomplexobj(waveform):
raise ValueError("Complex-valued input waveforms are not currently supported")

# Center pad the waveform
if center:
padding = [(int(frame_length // 2), int(frame_length // 2))]
Expand Down

0 comments on commit d5b81e1

Please sign in to comment.