Skip to content

Conversation

@diegoakel
Copy link
Contributor

What does this PR do?

Standardize conv len function for audio models, uses the following implementation:

def _conv_out_length(input_length, kernel_size, stride, pad=0, dilation=1):
    # 1D convolutional layer output length formula taken
    # from https://pytorch.org/docs/stable/generated/torch.nn.Conv1d.html
    return torch.div(input_length + 2 * pad - dilation * (kernel_size - 1) - 1, stride, rounding_mode="floor") + 1

Fixes #42118

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@eustlb

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: data2vec, hubert, seamless_m4t, seamless_m4t_v2, sew, sew_d, speecht5, unispeech, unispeech_sat, wav2vec2, wav2vec2_bert, wav2vec2_conformer, wavlm

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.

[audio] standardize conv output length computation

1 participant