Prophetnet batch dimension inversion fix
Author: kiansierra
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 -->

Fixes #17455

No longer mixes batch dimension with other dimensions, makes it so that inverting the inputs along the batch dimension also inverts the outputs, and returns the same loss indepent of the batch order.
Currently all tests pass (locally) except integration tests, which I believe are due to the issue at hand as can be seen in this example. Essentially the integration test for generation, returns different outputs based on what other elemnts are in the batch, with this fix it returns the same output as with a batch of 1 
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/12EAAbXZSemzvuoz5g_3WAe0sH1YAZUwk?usp=sharing)

## 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/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [X] 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/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/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. 
@patrickvonplaten @patil-suraj 


Comments:
_The documentation is not available anymore as the PR was closed or merged._

cc @younesbelkada and @ArthurZucker 

Hi @ArthurZucker, thanks for the feedback.
I've implemented the suggestions you mentioned, adding full text notation of expected tensor dimensions and separating tenosr operations in two multiple lines instead of chaining where requested

Thanks for the kind feedback @ArthurZucker.
Just some clarity before merging, I should update the integration tests as described by the attached colab, the current version generates different text based on the other elements in the batch. While new version returns the same output as if generated with a batch size of 1

I've now updated the integration tests, they should pass now