We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Update `make test-all`
```Makefile
# TODO: Add cuda-float16 when #649 is solved
test-all: FORCE
	pytest -v --device all --dtype float32,float64 --cov=kornia test/ --flake8 --mypy
```
Maybe instead of just adding `float16`, we can use `--dtype all`? (https://github.com/kornia/kornia/blob/5d1d8cc8c4fb3e398b429edd2cc25ef40d6299ce/conftest.py#L77)

--- 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/enhance/core.py`
Content:
```
1 from kornia.core import Module, Tensor
2 from kornia.testing import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR
3 
4 
5 def add_weighted(src1: Tensor, alpha, src2: Tensor, beta, gamma) -> Tensor:
6     r"""Calculate the weighted sum of two Tensors.
7 
8     .. image:: _static/img/add_weighted.png
9 
10     The function calculates the weighted sum of two Tensors as follows:
11 
12     .. math::
13         out = src1 * alpha + src2 * beta + gamma
14 
15     Args:
16         src1: Tensor with an arbitrary shape, equal to shape of src2.
17         alpha: weight of the src1 elements as Union[float, Tensor].
18         src2: Tensor with an arbitrary shape, equal to shape of src1.
19         beta: weight of the src2 elements as Union[float, Tensor].
20         gamma: scalar added to each sum as Union[float, Tensor].
21 
22     Returns:
23         Weighted Tensor with shape equal to src1 and src2 shapes.
24 
25     Example:
26         >>> input1 = torch.rand(1, 1, 5, 5)
27         >>> input2 = torch.rand(1, 1, 5, 5)
28         >>> output = add_weighted(input1, 0.5, input2, 0.5, 1.0)
29         >>> output.shape
30         torch.Size([1, 1, 5, 5])
31 
32     Notes:
33         Tensor alpha/beta/gamma have to be with shape broadcastable to src1 and src2 shapes.
34     """
35     KORNIA_CHECK_IS_TENSOR(src1)
36     KORNIA_CHECK_IS_TENSOR(src2)
37     KORNIA_CHECK(src1.shape == src2.shape, f"src1 and src2 have different shapes. Got {src1.shape} and {src2.shape}")
38     if isinstance(alpha, Tensor):
39         KORNIA_CHECK(src1.shape == alpha.shape, "alpha has a different shape than src.")
40     if isinstance(beta, Tensor):
41         KORNIA_CHECK(src1.shape == beta.shape, "beta has a different shape than src.")
42     if isinstance(gamma, Tensor):
43         KORNIA_CHECK(src1.shape == gamma.shape, "gamma has a different shape than src.")
44 
45     return src1 * alpha + src2 * beta + gamma
46 
47 
48 class AddWeighted(Module):
49     r"""Calculate the weighted sum of two Tensors.
50 
51     The function calculates the weighted sum of two Tensors as follows:
52 
53     .. math::
54         out = src1 * alpha + src2 * beta + gamma
55 
56     Args:
57         alpha: weight of the src1 elements as Union[float, Tensor].
58         beta: weight of the src2 elements as Union[float, Tensor].
59         gamma: scalar added to each sum as Union[float, Tensor].
60 
61     Shape:
62         - Input1: Tensor with an arbitrary shape, equal to shape of Input2.
63         - Input2: Tensor with an arbitrary shape, equal to shape of Input1.
64         - Output: Weighted tensor with shape equal to src1 and src2 shapes.
65 
66     Example:
67         >>> input1 = torch.rand(1, 1, 5, 5)
68         >>> input2 = torch.rand(1, 1, 5, 5)
69         >>> output = AddWeighted(0.5, 0.5, 1.0)(input1, input2)
70         >>> output.shape
71         torch.Size([1, 1, 5, 5])
72 
73     Notes:
74         Tensor alpha/beta/gamma have to be with shape broadcastable to src1 and src2 shapes.
75     """
76 
77     def __init__(self, alpha, beta, gamma) -> None:
78         super().__init__()
79         self.alpha = alpha
80         self.beta = beta
81         self.gamma = gamma
82 
83     def forward(self, src1: Tensor, src2: Tensor) -> Tensor:
84         return add_weighted(src1, self.alpha, src2, self.beta, self.gamma)
85
```
--- 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/enhance/core.py b/kornia/enhance/core.py
--- a/kornia/enhance/core.py
+++ b/kornia/enhance/core.py
@@ -1,8 +1,12 @@
-from kornia.core import Module, Tensor
+from typing import Union
+
+from kornia.core import Module, Tensor, tensor
 from kornia.testing import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR
 
 
-def add_weighted(src1: Tensor, alpha, src2: Tensor, beta, gamma) -> Tensor:
+def add_weighted(
+    src1: Tensor, alpha: Union[float, Tensor], src2: Tensor, beta: Union[float, Tensor], gamma: Union[float, Tensor]
+) -> Tensor:
     r"""Calculate the weighted sum of two Tensors.
 
     .. image:: _static/img/add_weighted.png
@@ -35,12 +39,21 @@
     KORNIA_CHECK_IS_TENSOR(src1)
     KORNIA_CHECK_IS_TENSOR(src2)
     KORNIA_CHECK(src1.shape == src2.shape, f"src1 and src2 have different shapes. Got {src1.shape} and {src2.shape}")
+
     if isinstance(alpha, Tensor):
         KORNIA_CHECK(src1.shape == alpha.shape, "alpha has a different shape than src.")
+    else:
+        alpha = tensor(alpha, dtype=src1.dtype, device=src1.device)
+
     if isinstance(beta, Tensor):
         KORNIA_CHECK(src1.shape == beta.shape, "beta has a different shape than src.")
+    else:
+        beta = tensor(beta, dtype=src1.dtype, device=src1.device)
+
     if isinstance(gamma, Tensor):
         KORNIA_CHECK(src1.shape == gamma.shape, "gamma has a different shape than src.")
+    else:
+        gamma = tensor(gamma, dtype=src1.dtype, device=src1.device)
 
     return src1 * alpha + src2 * beta + gamma

{"golden_diff": "diff --git a/kornia/enhance/core.py b/kornia/enhance/core.py\n--- a/kornia/enhance/core.py\n+++ b/kornia/enhance/core.py\n@@ -1,8 +1,12 @@\n-from kornia.core import Module, Tensor\n+from typing import Union\n+\n+from kornia.core import Module, Tensor, tensor\n from kornia.testing import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR\n \n \n-def add_weighted(src1: Tensor, alpha, src2: Tensor, beta, gamma) -> Tensor:\n+def add_weighted(\n+    src1: Tensor, alpha: Union[float, Tensor], src2: Tensor, beta: Union[float, Tensor], gamma: Union[float, Tensor]\n+) -> Tensor:\n     r\"\"\"Calculate the weighted sum of two Tensors.\n \n     .. image:: _static/img/add_weighted.png\n@@ -35,12 +39,21 @@\n     KORNIA_CHECK_IS_TENSOR(src1)\n     KORNIA_CHECK_IS_TENSOR(src2)\n     KORNIA_CHECK(src1.shape == src2.shape, f\"src1 and src2 have different shapes. Got {src1.shape} and {src2.shape}\")\n+\n     if isinstance(alpha, Tensor):\n         KORNIA_CHECK(src1.shape == alpha.shape, \"alpha has a different shape than src.\")\n+    else:\n+        alpha = tensor(alpha, dtype=src1.dtype, device=src1.device)\n+\n     if isinstance(beta, Tensor):\n         KORNIA_CHECK(src1.shape == beta.shape, \"beta has a different shape than src.\")\n+    else:\n+        beta = tensor(beta, dtype=src1.dtype, device=src1.device)\n+\n     if isinstance(gamma, Tensor):\n         KORNIA_CHECK(src1.shape == gamma.shape, \"gamma has a different shape than src.\")\n+    else:\n+        gamma = tensor(gamma, dtype=src1.dtype, device=src1.device)\n \n     return src1 * alpha + src2 * beta + gamma\n", "issue": "Update `make test-all`\n```Makefile\r\n# TODO: Add cuda-float16 when #649 is solved\r\ntest-all: FORCE\r\n\tpytest -v --device all --dtype float32,float64 --cov=kornia test/ --flake8 --mypy\r\n```\r\nMaybe instead of just adding `float16`, we can use `--dtype all`? (https://github.com/kornia/kornia/blob/5d1d8cc8c4fb3e398b429edd2cc25ef40d6299ce/conftest.py#L77)\n", "before_files": [{"content": "from kornia.core import Module, Tensor\nfrom kornia.testing import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR\n\n\ndef add_weighted(src1: Tensor, alpha, src2: Tensor, beta, gamma) -> Tensor:\n    r\"\"\"Calculate the weighted sum of two Tensors.\n\n    .. image:: _static/img/add_weighted.png\n\n    The function calculates the weighted sum of two Tensors as follows:\n\n    .. math::\n        out = src1 * alpha + src2 * beta + gamma\n\n    Args:\n        src1: Tensor with an arbitrary shape, equal to shape of src2.\n        alpha: weight of the src1 elements as Union[float, Tensor].\n        src2: Tensor with an arbitrary shape, equal to shape of src1.\n        beta: weight of the src2 elements as Union[float, Tensor].\n        gamma: scalar added to each sum as Union[float, Tensor].\n\n    Returns:\n        Weighted Tensor with shape equal to src1 and src2 shapes.\n\n    Example:\n        >>> input1 = torch.rand(1, 1, 5, 5)\n        >>> input2 = torch.rand(1, 1, 5, 5)\n        >>> output = add_weighted(input1, 0.5, input2, 0.5, 1.0)\n        >>> output.shape\n        torch.Size([1, 1, 5, 5])\n\n    Notes:\n        Tensor alpha/beta/gamma have to be with shape broadcastable to src1 and src2 shapes.\n    \"\"\"\n    KORNIA_CHECK_IS_TENSOR(src1)\n    KORNIA_CHECK_IS_TENSOR(src2)\n    KORNIA_CHECK(src1.shape == src2.shape, f\"src1 and src2 have different shapes. Got {src1.shape} and {src2.shape}\")\n    if isinstance(alpha, Tensor):\n        KORNIA_CHECK(src1.shape == alpha.shape, \"alpha has a different shape than src.\")\n    if isinstance(beta, Tensor):\n        KORNIA_CHECK(src1.shape == beta.shape, \"beta has a different shape than src.\")\n    if isinstance(gamma, Tensor):\n        KORNIA_CHECK(src1.shape == gamma.shape, \"gamma has a different shape than src.\")\n\n    return src1 * alpha + src2 * beta + gamma\n\n\nclass AddWeighted(Module):\n    r\"\"\"Calculate the weighted sum of two Tensors.\n\n    The function calculates the weighted sum of two Tensors as follows:\n\n    .. math::\n        out = src1 * alpha + src2 * beta + gamma\n\n    Args:\n        alpha: weight of the src1 elements as Union[float, Tensor].\n        beta: weight of the src2 elements as Union[float, Tensor].\n        gamma: scalar added to each sum as Union[float, Tensor].\n\n    Shape:\n        - Input1: Tensor with an arbitrary shape, equal to shape of Input2.\n        - Input2: Tensor with an arbitrary shape, equal to shape of Input1.\n        - Output: Weighted tensor with shape equal to src1 and src2 shapes.\n\n    Example:\n        >>> input1 = torch.rand(1, 1, 5, 5)\n        >>> input2 = torch.rand(1, 1, 5, 5)\n        >>> output = AddWeighted(0.5, 0.5, 1.0)(input1, input2)\n        >>> output.shape\n        torch.Size([1, 1, 5, 5])\n\n    Notes:\n        Tensor alpha/beta/gamma have to be with shape broadcastable to src1 and src2 shapes.\n    \"\"\"\n\n    def __init__(self, alpha, beta, gamma) -> None:\n        super().__init__()\n        self.alpha = alpha\n        self.beta = beta\n        self.gamma = gamma\n\n    def forward(self, src1: Tensor, src2: Tensor) -> Tensor:\n        return add_weighted(src1, self.alpha, src2, self.beta, self.gamma)\n", "path": "kornia/enhance/core.py"}], "after_files": [{"content": "from typing import Union\n\nfrom kornia.core import Module, Tensor, tensor\nfrom kornia.testing import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR\n\n\ndef add_weighted(\n    src1: Tensor, alpha: Union[float, Tensor], src2: Tensor, beta: Union[float, Tensor], gamma: Union[float, Tensor]\n) -> Tensor:\n    r\"\"\"Calculate the weighted sum of two Tensors.\n\n    .. image:: _static/img/add_weighted.png\n\n    The function calculates the weighted sum of two Tensors as follows:\n\n    .. math::\n        out = src1 * alpha + src2 * beta + gamma\n\n    Args:\n        src1: Tensor with an arbitrary shape, equal to shape of src2.\n        alpha: weight of the src1 elements as Union[float, Tensor].\n        src2: Tensor with an arbitrary shape, equal to shape of src1.\n        beta: weight of the src2 elements as Union[float, Tensor].\n        gamma: scalar added to each sum as Union[float, Tensor].\n\n    Returns:\n        Weighted Tensor with shape equal to src1 and src2 shapes.\n\n    Example:\n        >>> input1 = torch.rand(1, 1, 5, 5)\n        >>> input2 = torch.rand(1, 1, 5, 5)\n        >>> output = add_weighted(input1, 0.5, input2, 0.5, 1.0)\n        >>> output.shape\n        torch.Size([1, 1, 5, 5])\n\n    Notes:\n        Tensor alpha/beta/gamma have to be with shape broadcastable to src1 and src2 shapes.\n    \"\"\"\n    KORNIA_CHECK_IS_TENSOR(src1)\n    KORNIA_CHECK_IS_TENSOR(src2)\n    KORNIA_CHECK(src1.shape == src2.shape, f\"src1 and src2 have different shapes. Got {src1.shape} and {src2.shape}\")\n\n    if isinstance(alpha, Tensor):\n        KORNIA_CHECK(src1.shape == alpha.shape, \"alpha has a different shape than src.\")\n    else:\n        alpha = tensor(alpha, dtype=src1.dtype, device=src1.device)\n\n    if isinstance(beta, Tensor):\n        KORNIA_CHECK(src1.shape == beta.shape, \"beta has a different shape than src.\")\n    else:\n        beta = tensor(beta, dtype=src1.dtype, device=src1.device)\n\n    if isinstance(gamma, Tensor):\n        KORNIA_CHECK(src1.shape == gamma.shape, \"gamma has a different shape than src.\")\n    else:\n        gamma = tensor(gamma, dtype=src1.dtype, device=src1.device)\n\n    return src1 * alpha + src2 * beta + gamma\n\n\nclass AddWeighted(Module):\n    r\"\"\"Calculate the weighted sum of two Tensors.\n\n    The function calculates the weighted sum of two Tensors as follows:\n\n    .. math::\n        out = src1 * alpha + src2 * beta + gamma\n\n    Args:\n        alpha: weight of the src1 elements as Union[float, Tensor].\n        beta: weight of the src2 elements as Union[float, Tensor].\n        gamma: scalar added to each sum as Union[float, Tensor].\n\n    Shape:\n        - Input1: Tensor with an arbitrary shape, equal to shape of Input2.\n        - Input2: Tensor with an arbitrary shape, equal to shape of Input1.\n        - Output: Weighted tensor with shape equal to src1 and src2 shapes.\n\n    Example:\n        >>> input1 = torch.rand(1, 1, 5, 5)\n        >>> input2 = torch.rand(1, 1, 5, 5)\n        >>> output = AddWeighted(0.5, 0.5, 1.0)(input1, input2)\n        >>> output.shape\n        torch.Size([1, 1, 5, 5])\n\n    Notes:\n        Tensor alpha/beta/gamma have to be with shape broadcastable to src1 and src2 shapes.\n    \"\"\"\n\n    def __init__(self, alpha, beta, gamma) -> None:\n        super().__init__()\n        self.alpha = alpha\n        self.beta = beta\n        self.gamma = gamma\n\n    def forward(self, src1: Tensor, src2: Tensor) -> Tensor:\n        return add_weighted(src1, self.alpha, src2, self.beta, self.gamma)\n", "path": "kornia/enhance/core.py"}]}