🚨 Update image_processing_vitmatte.py
Author: rb-synth
Pull request: yes
Labels: name: run-slow

In the previous implementation, if either dimension wasn't divisible by factor, then both would be padded even if only one needed it.

For example, for divisible factor 32, if I have an image of size `(1024, 819)`, then I would expect a padded size of `(1024, 832)`. However, with the current implementation, even though 1024 is divisible by 32, it will be padded by a full 32 pixels, and the output size is `(1056, 832)`.

This PR fixes that 🐛  by computing dimensions individually.

Comments:
Test added! https://github.com/huggingface/transformers/pull/30566/commits/be4e44be08e275891234c71f061e020ebb54d060

@rb-synth Great! Last thing is to make sure the slow tests for the model still pass: 

```
RUN_SLOW=1 pytest tests/models/vitmatte/
```

Once you've confirmed they're all passing (or not different from running on main) then we're good to merge! 

doesn't work locally for me (neither does `main`).

```
RUN_SLOW=1 pytest tests/models/vitmatte/
=================================================================================================================================== test session starts ===================================================================================================================================
platform darwin -- Python 3.9.19, pytest-8.2.0, pluggy-1.5.0
rootdir: /Users/richard.brown/Downloads/transformers
configfile: pyproject.toml
collected 121 items / 1 error                                                                                                                                                                                                                                                             

========================================================================================================================================= ERRORS ==========================================================================================================================================
________________________________________________________________________________________________________ ERROR collecting tests/models/vitmatte/test_image_processing_vitmatte.py _________________________________________________________________________________________________________
../../Documents/Code/miniconda3/envs/temp/lib/python3.9/unittest/case.py:462: in __hash__
    return hash((type(self), self._testMethodName))
E   AttributeError: 'VitMatteImageProcessingTester' object has no attribute '_testMethodName'
==================================================================================================================================== warnings summary =====================================================================================================================================
../../Documents/Code/miniconda3/envs/temp/lib/python3.9/site-packages/_pytest/config/__init__.py:1448
  /Users/richard.brown/Documents/Code/miniconda3/envs/temp/lib/python3.9/site-packages/_pytest/config/__init__.py:1448: PytestConfigWarning: Unknown config option: doctest_glob
  
    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================================================= short test summary info =================================================================================================================================
ERROR tests/models/vitmatte/test_image_processing_vitmatte.py::VitMatteImageProcessingTester - AttributeError: 'VitMatteImageProcessingTester' object has no attribute '_testMethodName'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================================================================================================== 1 warning, 1 error in 8.19s ===============================================================================================================================

```

@rb-synth Interesting - it looks like there's an issue with test setup / env. Running `pip install -e .[testing]` should install all the necessary packages for running, which sometimes cause issues like this. 

Last night, we merge in a feature enabling us to run specific slow model tests on our github action runners. This is useful as sometimes there's differences which arise from hardward and environments. 

To enable this for the vitmatte tests could you: 
* Rebase on main to include the latest changes
* Push an empty commit with the message `[run-slow]vitmatte`

Have done that now

Also tried the testing on a different machine and it completed without any issues:
```
RUN_SLOW=1 pytest tests/models/vitmatte
=================================================================================================================================== test session starts ===================================================================================================================================
platform linux -- Python 3.10.14, pytest-7.4.4, pluggy-1.5.0
rootdir: /home/Documents/Code/transformers
configfile: pyproject.toml
plugins: timeout-2.3.1, xdist-3.6.1
collected 122 items                                                                                                                                                                                                                                                                       

tests/models/vitmatte/test_image_processing_vitmatte.py ............                                                                                                                                                                                                                [  9%]
tests/models/vitmatte/test_modeling_vitmatte.py .........ssssss...sssssssss...........s.......s....sss.sssssssssssssssssssssssssssss.s...s....sss..ss....ssss.                                                                                                                      [100%]
```

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_30566). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@rb-synth Great! The slow tests on the github action runners are also all passing; and the quality checks are unrelated to this PR so we can merge. 

I'm going to mark the PR title with an 🚨  - as there's a possibility this could cause downstream changes for users who were relying on the previous behaviour. As this padding behaviour is more correct, and slow model tests are all OK, I think it's OK.