Skip to content

fix(audio): normalize negative axis in pad_or_trim - #2833

Open
loulanyue wants to merge 1 commit into
openai:mainfrom
loulanyue:fix/audio-pad-or-trim-dimension-validation
Open

fix(audio): normalize negative axis in pad_or_trim#2833
loulanyue wants to merge 1 commit into
openai:mainfrom
loulanyue:fix/audio-pad-or-trim-dimension-validation

Conversation

@loulanyue

Copy link
Copy Markdown

Summary

In whisper/audio.py:

  • pad_or_trim accepts an axis parameter (default -1).
  • When constructing pad_widths and accessing tensor/array dimensions, negative axis values are now explicitly normalized (dim = axis if axis >= 0 else array.ndim + axis).
  • This ensures clean, consistent indexing across PyTorch tensor and NumPy array padding logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant