Rewrite ProphetNet to adapt converting ONNX friendly
Author: jiafatom
Pull request: yes

# What does this PR do?

We want to convert ProphetNet (pytorch model) to ONNX, but it needs some source code change to adapt it. The current code cannot convert to ONNX because torch.new generates constant dimension for Tensor in IR graph, which is not suitable if we want to do dynamic input axes for the converter. So we use torch.full instead.
This PR does not (should not) change any model behavior.

Fixes # (issue)
After this PR, the model can be converted to ONNX.

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [X] 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?
@qiweizhen @patrickvonplaten @Zhylkaaa


Comments:
This PR is originally from https://github.com/huggingface/transformers/pull/8675
Since ProphetNet gets refactored, now this PR is enough.
@patrickvonplaten, you are previously ok with this change, could you please sign off? or perhaps @mfuntowicz ?
Thanks!

Could someone take a look? Thank you! @qiweizhen @patrickvonplaten @Zhylkaaa @mfuntowicz

> Sorry, I am not really familiar with onnx, but for me this code is even more elegant than using `new` (which I guess is now discouraged in favor of `new_*`).
> But wouldn't it be more flexible to use `dtype=hidden_states.dtype` instead of `np.float32` to be sure that results are identical?

Thanks, done.


@patrickvonplaten the CI failure "check_code_quality" says:

would reformat src/transformers/models/prophetnet/modeling_prophetnet.py
Oh no! 💥 💔 💥
1 file would be reformatted, 909 files would be left unchanged.

How to reformat that? Thanks.

You can simply run `make style`

> You can simply run `make style`

@patrickvonplaten  I got the following errors when I run `make style`. I am using Ubuntu 20.04. Thanks
~/dev/transformers$ make style
black examples tests src utils
make: black: Command not found
make: *** [Makefile:54: style] Error 127


do you have black installed? (if not I guess you should use `python -m pip install black`)

> do you have black installed? (if not I guess you should use `python -m pip install black`)

Thanks, it works!

@patrickvonplaten could you please approve this PR and merge? The CI failure seems unrelated. Thank you!

Hey @jiafatom,

Could you run `make style` to get the `check_code_quality` test passing? 

@patrickvonplaten I actually ran `make style` and `make quality` (I guess that's what this test is using), but there are no warnings or errors, so I don't know what this is about either.

> @patrickvonplaten actually ran `make style` and `make quality` (I guess that's what this test is using), but there are no warnings or errors, so I don't know what this is about either.

Thanks, yes, actually I ran `make style` several times, it is fine in my local dev box, but still see this error in CI.