We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Crash on resize inverse - missing flag padding_mode
### Describe the bug

The inverse of resize augmentation crashes since the `padding_mode` flag is not set:

```
  File "/home/miquelmr/kornia/kornia/augmentation/_2d/geometric/base.py", line 106, in inverse
    output = self.inverse_transform(in_tensor, flags=flags, transform=transform, size=size)
  File "/home/miquelmr/kornia/kornia/augmentation/_2d/geometric/resize.py", line 88, in inverse_transform
    input, transform[:, :2, :], size, flags["resample"], flags["padding_mode"], flags["align_corners"]
KeyError: 'padding_mode
```

### Reproduction steps

```bash
import kornia.augmentation as K
import torch

img = torch.zeros((3,5,5))

aug = K.Resize(2)

transformed = aug(img)
img_transformed_inv = aug.inverse(transformed)
```


### Expected behavior

No crash

### Environment

```shell
Collecting environment information...
PyTorch version: 1.10.2
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.17

Python version: 3.7.15 (default, Nov 24 2022, 21:12:53)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-4.15.0-196-generic-x86_64-with-debian-buster-sid
Is CUDA available: False
CUDA runtime version: Could not collect
GPU models and configuration: 
GPU 0: NVIDIA TITAN X (Pascal)
GPU 1: NVIDIA TITAN X (Pascal)
GPU 2: NVIDIA TITAN Xp

Nvidia driver version: 520.61.05
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] mypy==0.991
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.21.5
[pip3] torch==1.10.2
[pip3] torchvision==0.2.2
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               10.2.89              hfd86e86_1  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py37h7f8727e_0  
[conda] mkl_fft                   1.3.1            py37hd3c417c_0  
[conda] mkl_random                1.2.2            py37h51133e4_0  
[conda] mypy                      0.991                    pypi_0    pypi
[conda] mypy-extensions           0.4.3                    pypi_0    pypi
[conda] numpy                     1.21.5           py37h6c91a56_3  
[conda] numpy-base                1.21.5           py37ha15fc14_3  
[conda] pytorch                   1.10.2          cpu_py37hfa7516b_0  
[conda] torchvision               0.2.2                      py_3    pytorch
```


### Additional context

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kornia/augmentation/_2d/geometric/resize.py`
Content:
```
1 from typing import Any, Dict, Optional, Tuple, Union
2 
3 import torch
4 
5 from kornia.augmentation import random_generator as rg
6 from kornia.augmentation._2d.geometric.base import GeometricAugmentationBase2D
7 from kornia.constants import Resample
8 from kornia.core import Tensor
9 from kornia.geometry.transform import crop_by_transform_mat, get_perspective_transform, resize
10 from kornia.utils import eye_like
11 
12 
13 class Resize(GeometricAugmentationBase2D):
14     """Resize to size.
15 
16     Args:
17         size: Size (h, w) in pixels of the resized region or just one side.
18         side: Which side to resize, if size is only of type int.
19         resample: Resampling mode.
20         align_corners: interpolation flag.
21         antialias: if True, then image will be filtered with Gaussian before downscaling. No effect for upscaling.
22         keepdim: whether to keep the output shape the same as input (True) or broadcast it
23             to the batch form (False).
24     """
25 
26     def __init__(
27         self,
28         size: Union[int, Tuple[int, int]],
29         side: str = "short",
30         resample: Union[str, int, Resample] = Resample.BILINEAR.name,
31         align_corners: bool = True,
32         antialias: bool = False,
33         p: float = 1.0,
34         return_transform: Optional[bool] = None,
35         keepdim: bool = False,
36     ) -> None:
37         super().__init__(p=1.0, return_transform=return_transform, same_on_batch=True, p_batch=p, keepdim=keepdim)
38         self._param_generator = rg.ResizeGenerator(resize_to=size, side=side)
39         self.flags = dict(
40             size=size, side=side, resample=Resample.get(resample), align_corners=align_corners, antialias=antialias
41         )
42 
43     def compute_transformation(self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any]) -> Tensor:
44         if params["output_size"] == input.shape[-2:]:
45             return eye_like(3, input)
46 
47         transform: Tensor = get_perspective_transform(params["src"], params["dst"])
48         transform = transform.expand(input.shape[0], -1, -1)
49         return transform
50 
51     def apply_transform(
52         self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any], transform: Optional[Tensor] = None
53     ) -> Tensor:
54         B, C, _, _ = input.shape
55         out_size = tuple(params["output_size"][0].tolist())
56         out = torch.empty(B, C, *out_size, device=input.device, dtype=input.dtype)
57 
58         for i in range(B):
59             x1 = int(params["src"][i, 0, 0])
60             x2 = int(params["src"][i, 1, 0]) + 1
61             y1 = int(params["src"][i, 0, 1])
62             y2 = int(params["src"][i, 3, 1]) + 1
63             out[i] = resize(
64                 input[i : i + 1, :, y1:y2, x1:x2],
65                 out_size,
66                 interpolation=flags["resample"].name.lower(),
67                 align_corners=flags["align_corners"]
68                 if flags["resample"] in [Resample.BILINEAR, Resample.BICUBIC]
69                 else None,
70                 antialias=flags["antialias"],
71             )
72         return out
73 
74     def inverse_transform(
75         self,
76         input: Tensor,
77         flags: Dict[str, Any],
78         transform: Optional[Tensor] = None,
79         size: Optional[Tuple[int, int]] = None,
80     ) -> Tensor:
81         if not isinstance(size, tuple):
82             raise TypeError(f'Expected the size be a tuple. Gotcha {type(size)}')
83 
84         if not isinstance(transform, Tensor):
85             raise TypeError(f'Expected the transform be a Tensor. Gotcha {type(transform)}')
86 
87         return crop_by_transform_mat(
88             input, transform[:, :2, :], size, flags["resample"], flags["padding_mode"], flags["align_corners"]
89         )
90 
91 
92 class LongestMaxSize(Resize):
93     """Rescale an image so that maximum side is equal to max_size, keeping the aspect ratio of the initial image.
94 
95     Args:
96         max_size: maximum size of the image after the transformation.
97     """
98 
99     def __init__(
100         self,
101         max_size: int,
102         resample: Union[str, int, Resample] = Resample.BILINEAR.name,
103         align_corners: bool = True,
104         p: float = 1.0,
105         return_transform: Optional[bool] = None,
106     ) -> None:
107         # TODO: Support max_size list input to randomly select from
108         super().__init__(
109             size=max_size,
110             side="long",
111             resample=resample,
112             return_transform=return_transform,
113             align_corners=align_corners,
114             p=p,
115         )
116 
117 
118 class SmallestMaxSize(Resize):
119     """Rescale an image so that minimum side is equal to max_size, keeping the aspect ratio of the initial image.
120 
121     Args:
122         max_size: maximum size of the image after the transformation.
123     """
124 
125     def __init__(
126         self,
127         max_size: int,
128         resample: Union[str, int, Resample] = Resample.BILINEAR.name,
129         align_corners: bool = True,
130         p: float = 1.0,
131         return_transform: Optional[bool] = None,
132     ) -> None:
133         # TODO: Support max_size list input to randomly select from
134         super().__init__(
135             size=max_size,
136             side="short",
137             resample=resample,
138             return_transform=return_transform,
139             align_corners=align_corners,
140             p=p,
141         )
142
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/kornia/augmentation/_2d/geometric/resize.py b/kornia/augmentation/_2d/geometric/resize.py
--- a/kornia/augmentation/_2d/geometric/resize.py
+++ b/kornia/augmentation/_2d/geometric/resize.py
@@ -85,7 +85,7 @@
             raise TypeError(f'Expected the transform be a Tensor. Gotcha {type(transform)}')
 
         return crop_by_transform_mat(
-            input, transform[:, :2, :], size, flags["resample"], flags["padding_mode"], flags["align_corners"]
+            input, transform[:, :2, :], size, flags["resample"].name.lower(), "zeros", flags["align_corners"]
         )

{"golden_diff": "diff --git a/kornia/augmentation/_2d/geometric/resize.py b/kornia/augmentation/_2d/geometric/resize.py\n--- a/kornia/augmentation/_2d/geometric/resize.py\n+++ b/kornia/augmentation/_2d/geometric/resize.py\n@@ -85,7 +85,7 @@\n             raise TypeError(f'Expected the transform be a Tensor. Gotcha {type(transform)}')\n \n         return crop_by_transform_mat(\n-            input, transform[:, :2, :], size, flags[\"resample\"], flags[\"padding_mode\"], flags[\"align_corners\"]\n+            input, transform[:, :2, :], size, flags[\"resample\"].name.lower(), \"zeros\", flags[\"align_corners\"]\n         )\n", "issue": "Crash on resize inverse - missing flag padding_mode\n### Describe the bug\n\nThe inverse of resize augmentation crashes since the `padding_mode` flag is not set:\r\n\r\n```\r\n  File \"/home/miquelmr/kornia/kornia/augmentation/_2d/geometric/base.py\", line 106, in inverse\r\n    output = self.inverse_transform(in_tensor, flags=flags, transform=transform, size=size)\r\n  File \"/home/miquelmr/kornia/kornia/augmentation/_2d/geometric/resize.py\", line 88, in inverse_transform\r\n    input, transform[:, :2, :], size, flags[\"resample\"], flags[\"padding_mode\"], flags[\"align_corners\"]\r\nKeyError: 'padding_mode\r\n```\n\n### Reproduction steps\n\n```bash\nimport kornia.augmentation as K\r\nimport torch\r\n\r\nimg = torch.zeros((3,5,5))\r\n\r\naug = K.Resize(2)\r\n\r\ntransformed = aug(img)\r\nimg_transformed_inv = aug.inverse(transformed)\n```\n\n\n### Expected behavior\n\nNo crash\n\n### Environment\n\n```shell\nCollecting environment information...\r\nPyTorch version: 1.10.2\r\nIs debug build: False\r\nCUDA used to build PyTorch: Could not collect\r\nROCM used to build PyTorch: N/A\r\n\r\nOS: Ubuntu 18.04.6 LTS (x86_64)\r\nGCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0\r\nClang version: Could not collect\r\nCMake version: Could not collect\r\nLibc version: glibc-2.17\r\n\r\nPython version: 3.7.15 (default, Nov 24 2022, 21:12:53)  [GCC 11.2.0] (64-bit runtime)\r\nPython platform: Linux-4.15.0-196-generic-x86_64-with-debian-buster-sid\r\nIs CUDA available: False\r\nCUDA runtime version: Could not collect\r\nGPU models and configuration: \r\nGPU 0: NVIDIA TITAN X (Pascal)\r\nGPU 1: NVIDIA TITAN X (Pascal)\r\nGPU 2: NVIDIA TITAN Xp\r\n\r\nNvidia driver version: 520.61.05\r\ncuDNN version: Could not collect\r\nHIP runtime version: N/A\r\nMIOpen runtime version: N/A\r\n\r\nVersions of relevant libraries:\r\n[pip3] mypy==0.991\r\n[pip3] mypy-extensions==0.4.3\r\n[pip3] numpy==1.21.5\r\n[pip3] torch==1.10.2\r\n[pip3] torchvision==0.2.2\r\n[conda] blas                      1.0                         mkl  \r\n[conda] cudatoolkit               10.2.89              hfd86e86_1  \r\n[conda] mkl                       2021.4.0           h06a4308_640  \r\n[conda] mkl-service               2.4.0            py37h7f8727e_0  \r\n[conda] mkl_fft                   1.3.1            py37hd3c417c_0  \r\n[conda] mkl_random                1.2.2            py37h51133e4_0  \r\n[conda] mypy                      0.991                    pypi_0    pypi\r\n[conda] mypy-extensions           0.4.3                    pypi_0    pypi\r\n[conda] numpy                     1.21.5           py37h6c91a56_3  \r\n[conda] numpy-base                1.21.5           py37ha15fc14_3  \r\n[conda] pytorch                   1.10.2          cpu_py37hfa7516b_0  \r\n[conda] torchvision               0.2.2                      py_3    pytorch\n```\n\n\n### Additional context\n\n_No response_\n", "before_files": [{"content": "from typing import Any, Dict, Optional, Tuple, Union\n\nimport torch\n\nfrom kornia.augmentation import random_generator as rg\nfrom kornia.augmentation._2d.geometric.base import GeometricAugmentationBase2D\nfrom kornia.constants import Resample\nfrom kornia.core import Tensor\nfrom kornia.geometry.transform import crop_by_transform_mat, get_perspective_transform, resize\nfrom kornia.utils import eye_like\n\n\nclass Resize(GeometricAugmentationBase2D):\n    \"\"\"Resize to size.\n\n    Args:\n        size: Size (h, w) in pixels of the resized region or just one side.\n        side: Which side to resize, if size is only of type int.\n        resample: Resampling mode.\n        align_corners: interpolation flag.\n        antialias: if True, then image will be filtered with Gaussian before downscaling. No effect for upscaling.\n        keepdim: whether to keep the output shape the same as input (True) or broadcast it\n            to the batch form (False).\n    \"\"\"\n\n    def __init__(\n        self,\n        size: Union[int, Tuple[int, int]],\n        side: str = \"short\",\n        resample: Union[str, int, Resample] = Resample.BILINEAR.name,\n        align_corners: bool = True,\n        antialias: bool = False,\n        p: float = 1.0,\n        return_transform: Optional[bool] = None,\n        keepdim: bool = False,\n    ) -> None:\n        super().__init__(p=1.0, return_transform=return_transform, same_on_batch=True, p_batch=p, keepdim=keepdim)\n        self._param_generator = rg.ResizeGenerator(resize_to=size, side=side)\n        self.flags = dict(\n            size=size, side=side, resample=Resample.get(resample), align_corners=align_corners, antialias=antialias\n        )\n\n    def compute_transformation(self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any]) -> Tensor:\n        if params[\"output_size\"] == input.shape[-2:]:\n            return eye_like(3, input)\n\n        transform: Tensor = get_perspective_transform(params[\"src\"], params[\"dst\"])\n        transform = transform.expand(input.shape[0], -1, -1)\n        return transform\n\n    def apply_transform(\n        self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any], transform: Optional[Tensor] = None\n    ) -> Tensor:\n        B, C, _, _ = input.shape\n        out_size = tuple(params[\"output_size\"][0].tolist())\n        out = torch.empty(B, C, *out_size, device=input.device, dtype=input.dtype)\n\n        for i in range(B):\n            x1 = int(params[\"src\"][i, 0, 0])\n            x2 = int(params[\"src\"][i, 1, 0]) + 1\n            y1 = int(params[\"src\"][i, 0, 1])\n            y2 = int(params[\"src\"][i, 3, 1]) + 1\n            out[i] = resize(\n                input[i : i + 1, :, y1:y2, x1:x2],\n                out_size,\n                interpolation=flags[\"resample\"].name.lower(),\n                align_corners=flags[\"align_corners\"]\n                if flags[\"resample\"] in [Resample.BILINEAR, Resample.BICUBIC]\n                else None,\n                antialias=flags[\"antialias\"],\n            )\n        return out\n\n    def inverse_transform(\n        self,\n        input: Tensor,\n        flags: Dict[str, Any],\n        transform: Optional[Tensor] = None,\n        size: Optional[Tuple[int, int]] = None,\n    ) -> Tensor:\n        if not isinstance(size, tuple):\n            raise TypeError(f'Expected the size be a tuple. Gotcha {type(size)}')\n\n        if not isinstance(transform, Tensor):\n            raise TypeError(f'Expected the transform be a Tensor. Gotcha {type(transform)}')\n\n        return crop_by_transform_mat(\n            input, transform[:, :2, :], size, flags[\"resample\"], flags[\"padding_mode\"], flags[\"align_corners\"]\n        )\n\n\nclass LongestMaxSize(Resize):\n    \"\"\"Rescale an image so that maximum side is equal to max_size, keeping the aspect ratio of the initial image.\n\n    Args:\n        max_size: maximum size of the image after the transformation.\n    \"\"\"\n\n    def __init__(\n        self,\n        max_size: int,\n        resample: Union[str, int, Resample] = Resample.BILINEAR.name,\n        align_corners: bool = True,\n        p: float = 1.0,\n        return_transform: Optional[bool] = None,\n    ) -> None:\n        # TODO: Support max_size list input to randomly select from\n        super().__init__(\n            size=max_size,\n            side=\"long\",\n            resample=resample,\n            return_transform=return_transform,\n            align_corners=align_corners,\n            p=p,\n        )\n\n\nclass SmallestMaxSize(Resize):\n    \"\"\"Rescale an image so that minimum side is equal to max_size, keeping the aspect ratio of the initial image.\n\n    Args:\n        max_size: maximum size of the image after the transformation.\n    \"\"\"\n\n    def __init__(\n        self,\n        max_size: int,\n        resample: Union[str, int, Resample] = Resample.BILINEAR.name,\n        align_corners: bool = True,\n        p: float = 1.0,\n        return_transform: Optional[bool] = None,\n    ) -> None:\n        # TODO: Support max_size list input to randomly select from\n        super().__init__(\n            size=max_size,\n            side=\"short\",\n            resample=resample,\n            return_transform=return_transform,\n            align_corners=align_corners,\n            p=p,\n        )\n", "path": "kornia/augmentation/_2d/geometric/resize.py"}], "after_files": [{"content": "from typing import Any, Dict, Optional, Tuple, Union\n\nimport torch\n\nfrom kornia.augmentation import random_generator as rg\nfrom kornia.augmentation._2d.geometric.base import GeometricAugmentationBase2D\nfrom kornia.constants import Resample\nfrom kornia.core import Tensor\nfrom kornia.geometry.transform import crop_by_transform_mat, get_perspective_transform, resize\nfrom kornia.utils import eye_like\n\n\nclass Resize(GeometricAugmentationBase2D):\n    \"\"\"Resize to size.\n\n    Args:\n        size: Size (h, w) in pixels of the resized region or just one side.\n        side: Which side to resize, if size is only of type int.\n        resample: Resampling mode.\n        align_corners: interpolation flag.\n        antialias: if True, then image will be filtered with Gaussian before downscaling. No effect for upscaling.\n        keepdim: whether to keep the output shape the same as input (True) or broadcast it\n            to the batch form (False).\n    \"\"\"\n\n    def __init__(\n        self,\n        size: Union[int, Tuple[int, int]],\n        side: str = \"short\",\n        resample: Union[str, int, Resample] = Resample.BILINEAR.name,\n        align_corners: bool = True,\n        antialias: bool = False,\n        p: float = 1.0,\n        return_transform: Optional[bool] = None,\n        keepdim: bool = False,\n    ) -> None:\n        super().__init__(p=1.0, return_transform=return_transform, same_on_batch=True, p_batch=p, keepdim=keepdim)\n        self._param_generator = rg.ResizeGenerator(resize_to=size, side=side)\n        self.flags = dict(\n            size=size, side=side, resample=Resample.get(resample), align_corners=align_corners, antialias=antialias\n        )\n\n    def compute_transformation(self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any]) -> Tensor:\n        if params[\"output_size\"] == input.shape[-2:]:\n            return eye_like(3, input)\n\n        transform: Tensor = get_perspective_transform(params[\"src\"], params[\"dst\"])\n        transform = transform.expand(input.shape[0], -1, -1)\n        return transform\n\n    def apply_transform(\n        self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any], transform: Optional[Tensor] = None\n    ) -> Tensor:\n        B, C, _, _ = input.shape\n        out_size = tuple(params[\"output_size\"][0].tolist())\n        out = torch.empty(B, C, *out_size, device=input.device, dtype=input.dtype)\n\n        for i in range(B):\n            x1 = int(params[\"src\"][i, 0, 0])\n            x2 = int(params[\"src\"][i, 1, 0]) + 1\n            y1 = int(params[\"src\"][i, 0, 1])\n            y2 = int(params[\"src\"][i, 3, 1]) + 1\n            out[i] = resize(\n                input[i : i + 1, :, y1:y2, x1:x2],\n                out_size,\n                interpolation=flags[\"resample\"].name.lower(),\n                align_corners=flags[\"align_corners\"]\n                if flags[\"resample\"] in [Resample.BILINEAR, Resample.BICUBIC]\n                else None,\n                antialias=flags[\"antialias\"],\n            )\n        return out\n\n    def inverse_transform(\n        self,\n        input: Tensor,\n        flags: Dict[str, Any],\n        transform: Optional[Tensor] = None,\n        size: Optional[Tuple[int, int]] = None,\n    ) -> Tensor:\n        if not isinstance(size, tuple):\n            raise TypeError(f'Expected the size be a tuple. Gotcha {type(size)}')\n\n        if not isinstance(transform, Tensor):\n            raise TypeError(f'Expected the transform be a Tensor. Gotcha {type(transform)}')\n\n        return crop_by_transform_mat(\n            input, transform[:, :2, :], size, flags[\"resample\"].name.lower(), \"zeros\", flags[\"align_corners\"]\n        )\n\n\nclass LongestMaxSize(Resize):\n    \"\"\"Rescale an image so that maximum side is equal to max_size, keeping the aspect ratio of the initial image.\n\n    Args:\n        max_size: maximum size of the image after the transformation.\n    \"\"\"\n\n    def __init__(\n        self,\n        max_size: int,\n        resample: Union[str, int, Resample] = Resample.BILINEAR.name,\n        align_corners: bool = True,\n        p: float = 1.0,\n        return_transform: Optional[bool] = None,\n    ) -> None:\n        # TODO: Support max_size list input to randomly select from\n        super().__init__(\n            size=max_size,\n            side=\"long\",\n            resample=resample,\n            return_transform=return_transform,\n            align_corners=align_corners,\n            p=p,\n        )\n\n\nclass SmallestMaxSize(Resize):\n    \"\"\"Rescale an image so that minimum side is equal to max_size, keeping the aspect ratio of the initial image.\n\n    Args:\n        max_size: maximum size of the image after the transformation.\n    \"\"\"\n\n    def __init__(\n        self,\n        max_size: int,\n        resample: Union[str, int, Resample] = Resample.BILINEAR.name,\n        align_corners: bool = True,\n        p: float = 1.0,\n        return_transform: Optional[bool] = None,\n    ) -> None:\n        # TODO: Support max_size list input to randomly select from\n        super().__init__(\n            size=max_size,\n            side=\"short\",\n            resample=resample,\n            return_transform=return_transform,\n            align_corners=align_corners,\n            p=p,\n        )\n", "path": "kornia/augmentation/_2d/geometric/resize.py"}]}