Unexpected shape of "past_key_values" of ProphetNetDecoder.forward()
Author: meguruin
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.15.0
- Platform: colab
- Python version: 3.7.12
- PyTorch version (GPU?): 1.10.0+cu111
- Tensorflow version (GPU?): 2.7.0
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help
@patrickvonplaten, @LysandreJik
<!-- Your issue 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, DeBERTa, DeBERTa-v2, ELECTRA, MobileBert, SqueezeBert: @LysandreJik
- T5, BART, Marian, Pegasus, EncoderDecoder: @patrickvonplaten
- Blenderbot, MBART: @patil-suraj
- Longformer, Reformer, TransfoXL, XLNet, FNet, BigBird: @patrickvonplaten
- FSMT: @stas00
- Funnel: @sgugger
- GPT-2, GPT: @patrickvonplaten, @LysandreJik
- RAG, DPR: @patrickvonplaten, @lhoestq
- TensorFlow: @Rocketknight1
- JAX/Flax: @patil-suraj
- TAPAS, LayoutLM, LayoutLMv2, LUKE, ViT, BEiT, DEiT, DETR, CANINE: @NielsRogge
- GPT-Neo, GPT-J, CLIP: @patil-suraj
- Wav2Vec2, HuBERT, SpeechEncoderDecoder, UniSpeech, UniSpeechSAT, SEW, SEW-D, Speech2Text: @patrickvonplaten, @anton-l

If the model isn't in the list, ping @LysandreJik who will redirect you to the correct contributor.

Library:

- Benchmarks: @patrickvonplaten
- Deepspeed: @stas00
- Ray/raytune: @richardliaw, @amogkam
- Text generation: @patrickvonplaten @narsil
- Tokenizers: @SaulLu
- Trainer: @sgugger
- Pipelines: @Narsil
- Speech: @patrickvonplaten, @anton-l
- Vision: @NielsRogge, @sgugger

Documentation: @sgugger

Model hub:

- for issues with a model, report at https://discuss.huggingface.co/ and tag the model's creator.

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

For research projetcs, please ping the contributor directly. For example, on the following projects:

- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

Model I am using (Bert, XLNet ...): ProphetNet

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

When I try to convert ProphetNetModel to onnx, I found that  "past_key_values" of decoder output is not the same shape as in official document.
The description of `ProphetNetDecoderModelOutput` says that:
> past_key_values (List[torch.FloatTensor], optional, returned when use_cache=True is passed or when config.use_cache=True) — List of torch.FloatTensor of length config.n_layers, with each tensor of shape (2, batch_size, num_attn_heads, decoder_sequence_length, embed_size_per_head)).

However, I get past_key_values just like `BaseModelOutputWithPastAndCrossAttentions`.
> past_key_values (tuple(tuple(torch.FloatTensor)), optional, returned when use_cache=True is passed or when config.use_cache=True) — Tuple of tuple(torch.FloatTensor) of length config.n_layers, with each tuple having 2 tensors of shape (batch_size, num_heads, sequence_length, embed_size_per_head)) and optionally if config.is_encoder_decoder=True 2 additional tensors of shape (batch_size, num_heads, encoder_sequence_length, embed_size_per_head).

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

```
from transformers import ProphetNetTokenizer, ProphetNetEncoder, ProphetNetDecoder

tokenizer = ProphetNetTokenizer.from_pretrained('microsoft/prophetnet-large-uncased')
encoder = ProphetNetEncoder.from_pretrained('microsoft/prophetnet-large-uncased')
decoder = ProphetNetDecoder.from_pretrained('microsoft/prophetnet-large-uncased')
# assert model.config.is_decoder, f"{model.__class__} has to be configured as a decoder."
enc_inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
dec_inputs = tokenizer("
", return_tensors="pt")
encoder_outputs = encoder(
    input_ids=enc_inputs["input_ids"],
    attention_mask=enc_inputs["attention_mask"],
    return_dict=True,
)
decoder_outputs = decoder(
    input_ids=dec_inputs["input_ids"],
    encoder_hidden_states=encoder_outputs["last_hidden_state"],
    encoder_attention_mask=enc_inputs["attention_mask"],
    past_key_values=None,
    return_dict=True,
)
print(decoder_outputs.keys())
# odict_keys(['last_hidden_state', 'last_hidden_state_ngram', 'past_key_values'])

print(len(decoder_outputs["past_key_values"])) 
# 12
print(len(decoder_outputs["past_key_values"][0]))
# 4
print(decoder_outputs["past_key_values"][0][0].shape)
# torch.Size([1, 16, 4, 64])
```

## Expected behavior
`len(decoder_outputs["past_key_values"]) == 12` and `decoder_outputs["past_key_values"][0].shape = (2, batch_size, num_attn_heads, decoder_sequence_length, embed_size_per_head))`

<!-- A clear and concise description of what you would expect to happen. -->

Comments:
For ONNX related issues, gently pinging @lewtun here

@patrickvonplaten, thanks.
I think that this issue relates not only using ONNX because it is contradiction between document and actual outputs. 

Ok, I see so the problem is the documentation here? There might very well be a bug in the documentation...
The following looks correct to me:

```
print(len(decoder_outputs["past_key_values"])) 
# 12
print(len(decoder_outputs["past_key_values"][0]))
# 4
print(decoder_outputs["past_key_values"][0][0].shape)
# torch.Size([1, 16, 4, 64])
```

We have 12 layers. ProphetNet is an encoder-decoder model so it caches 4 tensors (decoder value, decoder key as well as projected encoder key and projected encoder value matrices for the cross attention layer). 

Would you like to open a PR maybe to fix the documentation is you've found the bug it seems?

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.