replace native python deprecated floor function by torch version 
Author: ManuelFay
Pull request: yes

# What does this PR do?

Removes deprecation warning in LayoutLMV2 runs, caused by deprecated native floor divide.


Fixes # (issue)


## 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?

I ran the tests and the linter !


## 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.

@NielsRogge (Since I Know you wrote it, thanks a ton by the way !)

Comments:
@NielsRogge @LysandreJik  Any updates/reasons not to merge this ?

@LysandreJik according to the [docs](https://pytorch.org/docs/stable/generated/torch.div.html) of PyTorch's torch.div:

> "floor" - rounds the results of the division down. Equivalent to floor division in Python (the // operator)

So that seems good to me. However, in which PyTorch version was the `rounding_mode` argument added?

If it was only added in torch 1.10, then this will break on any previous PyTorch version.

That's not what the warning says though:

```
>>> import torch
>>> torch.tensor(2) // torch.tensor(1)
__main__:1: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
tensor(2)
```
Your last comment @NielsRogge is aligned with @patrickvonplaten's comment here: https://github.com/huggingface/transformers/pull/14577#issuecomment-986587459

So looking at the linked issue, it seems the custom division function that takes into account the torch version has not been written yet. Should I write it ? 
There's probably no better fix but my worry is that using a custom tensor div function may hinder the readibility of the code a bit. Any suggestions on how to make this change as transparent as possible ?

As for the "floor" vs "trunc" debate, it only behaves differently with negative input values so it shouldn't change a thing in this case. In a more general case (if we write a function in the file_utils.py), I am guessing it would be better to keep the exact behavior by using "trunc" by default, and enable "floor" as an argument. We would however have to rewrite the "floor" behaviour for the native python division in torch versions < 1.8

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.

Sorry just getting back to this now - could you leverage the code introduced in https://github.com/huggingface/transformers/pull/15180 to keep support for previous PyTorch versions?

Messed up the rebase, I'll just create a new PR #15457 for cleanliness and close this one