[Sequence Feature Extraction] Add truncation
Author: patrickvonplaten
Pull request: yes

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

This PR adds `truncation` to speech-related feature extractors. It should enable use cases such as: https://github.com/huggingface/transformers/issues/12774

Different to our tokenizers we allow truncation to be just True or False => there is no "truncation strategy". The reason is that for feature extractors the input cannot be a "pair" of input sequences so there is essentially just one use case for truncation that applies to all inputs.

The logic is equivalent to Tokenizers with a small exception in error handling. The differences are shown in example 1. & 2. in the following:

1. truncation=True, no padding, no max_length. IMO this should be an error because it's not clear what should be done here. In Tokenizers we don't throw an error, but simply don't do anything. Throwing an error is better here IMO

```python
from transformers import Wav2Vec2FeatureExtractor, BatchFeature
feat_extractor = Wav2Vec2FeatureExtractor()
dummy_inputs = BatchFeature({"input_values": [[0.1, 0.2, 0.3], [0.1]]})

feat_extractor.pad(dummy_inputs, truncation=True) # -> throws error since `max_length` is not defined 
```

2. truncation=True, "longest" padding, no max_length. IMO this should be an error because it doesn't make sense to "truncate" and to pad to the longest tensor in the batch. If we pad to the longest batch, we can't truncate. In Tokenizers we don't throw an error, but simply don't do anything. Throwing an error is better here IMO

```python
from transformers import Wav2Vec2FeatureExtractor, BatchFeature
feat_extractor = Wav2Vec2FeatureExtractor()
dummy_inputs = BatchFeature({"input_values": [[0.1, 0.2, 0.3], [0.1]]})

feat_extractor.pad(dummy_inputs, truncation=True, padding="longest") # -> throws error since `max_length` is not defined and padding not "max_length"
```

3. truncation=True, "max_length" padding. Here the logic is equivalent to tokenizers

```python
from transformers import Wav2Vec2FeatureExtractor, BatchFeature
feat_extractor = Wav2Vec2FeatureExtractor()
dummy_inputs = BatchFeature({"input_values": [[0.1, 0.2, 0.3], [0.1]]})

feat_extractor.pad(dummy_inputs, truncation=True, max_length=2, padding="max_length") # -> output shape is [2, 2]
```

In addition `pad_to_multiple_of` works correctly and equivalent to the Tokenizers. Tests are added to cover all possible use cases.

## 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](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? 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](https://github.com/huggingface/transformers/tree/master/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/master/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @LysandreJik

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @n1t0, @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->


Comments: