prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Bugs when using RandomRGBShift
  ### Describe the bug
  
  When running RandomRGBShift augmentation on gpus I came across this error 
  
  ```
    File "/usr/local/lib/python3.8/dist-packages/kornia/augmentation/_2d/intensity/random_rgb_shift.py", line 100, in apply_transform
      return shift_rgb(inp, params['r_shift'], params['g_shift'], params['b_shift'])
    File "/usr/local/lib/python3.8/dist-packages/kornia/enhance/shift_rgb.py", line 17, in shift_rgb
      shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)
  ValueError: only one element tensors can be converted to Python scalars
  ```
  after checking the code I think the problem is that 
  ```
  shifts = [params['r_shift'], params['g_shift'], params['b_shift']]
  shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)
  ```
  and also I am not sure about `.view(1,3,1,1)` shouldn't it be `.view(-1,3,1,1)`
  
  ### Reproduction steps
  
  ```bash
  1. setting up RandomRGBShift augmentation
  2. Using RandomRGBShift augmentation with gpus and batchsize > 1
  ```
  
  
  ### Expected behavior
  
  ```
    File "/usr/local/lib/python3.8/dist-packages/kornia/augmentation/_2d/intensity/random_rgb_shift.py", line 100, in apply_transform
      return shift_rgb(inp, params['r_shift'], params['g_shift'], params['b_shift'])
    File "/usr/local/lib/python3.8/dist-packages/kornia/enhance/shift_rgb.py", line 17, in shift_rgb
      shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)
  ValueError: only one element tensors can be converted to Python scalars
  ```
  
  ### Environment
  
  ```shell
  - PyTorch Version : 1.10
  - Linux
  - How you installed PyTorch (`pip`):
  - Python version: 3.8
  - cuda:11.3.0-cudnn8
  ```
  
  
  ### Additional context
  
  _No response_
  
  </issue>
  <code>
  [start of kornia/enhance/shift_rgb.py]
  1 import torch
  2 
  3 from kornia.testing import KORNIA_CHECK_IS_COLOR, KORNIA_CHECK_IS_TENSOR
  4 
  5 
  6 def shift_rgb(image: torch.Tensor, r_shift: torch.Tensor, g_shift: torch.Tensor, b_shift: torch.Tensor) -> torch.Tensor:
  7     """Shift rgb channels.
  8 
  9     Shift each image's channel by either r_shift for red, g_shift for green and b_shift for blue channels.
  10     """
  11 
  12     KORNIA_CHECK_IS_TENSOR(image)
  13     KORNIA_CHECK_IS_COLOR(image, f"with shape {image.shape}")
  14 
  15     shifts = [r_shift, g_shift, b_shift]
  16 
  17     shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)
  18 
  19     return shifted
  20
  [end of kornia/enhance/shift_rgb.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/kornia/enhance/shift_rgb.py b/kornia/enhance/shift_rgb.py
  --- a/kornia/enhance/shift_rgb.py
  +++ b/kornia/enhance/shift_rgb.py
  @@ -14,6 +14,6 @@
   
       shifts = [r_shift, g_shift, b_shift]
   
  -    shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)
  +    shifted = (image + torch.stack(shifts).view(-1, 3, 1, 1).to(image)).clamp_(min=0, max=1)
   
       return shifted
  
verification_info: {"golden_diff": "diff --git a/kornia/enhance/shift_rgb.py b/kornia/enhance/shift_rgb.py\n--- a/kornia/enhance/shift_rgb.py\n+++ b/kornia/enhance/shift_rgb.py\n@@ -14,6 +14,6 @@\n \n     shifts = [r_shift, g_shift, b_shift]\n \n-    shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)\n+    shifted = (image + torch.stack(shifts).view(-1, 3, 1, 1).to(image)).clamp_(min=0, max=1)\n \n     return shifted\n", "issue": "Bugs when using RandomRGBShift\n### Describe the bug\r\n\r\nWhen running RandomRGBShift augmentation on gpus I came across this error \r\n\r\n```\r\n  File \"/usr/local/lib/python3.8/dist-packages/kornia/augmentation/_2d/intensity/random_rgb_shift.py\", line 100, in apply_transform\r\n    return shift_rgb(inp, params['r_shift'], params['g_shift'], params['b_shift'])\r\n  File \"/usr/local/lib/python3.8/dist-packages/kornia/enhance/shift_rgb.py\", line 17, in shift_rgb\r\n    shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)\r\nValueError: only one element tensors can be converted to Python scalars\r\n```\r\nafter checking the code I think the problem is that \r\n```\r\nshifts = [params['r_shift'], params['g_shift'], params['b_shift']]\r\nshifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)\r\n```\r\nand also I am not sure about `.view(1,3,1,1)` shouldn't it be `.view(-1,3,1,1)`\r\n\r\n### Reproduction steps\r\n\r\n```bash\r\n1. setting up RandomRGBShift augmentation\r\n2. Using RandomRGBShift augmentation with gpus and batchsize > 1\r\n```\r\n\r\n\r\n### Expected behavior\r\n\r\n```\r\n  File \"/usr/local/lib/python3.8/dist-packages/kornia/augmentation/_2d/intensity/random_rgb_shift.py\", line 100, in apply_transform\r\n    return shift_rgb(inp, params['r_shift'], params['g_shift'], params['b_shift'])\r\n  File \"/usr/local/lib/python3.8/dist-packages/kornia/enhance/shift_rgb.py\", line 17, in shift_rgb\r\n    shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)\r\nValueError: only one element tensors can be converted to Python scalars\r\n```\r\n\r\n### Environment\r\n\r\n```shell\r\n- PyTorch Version : 1.10\r\n- Linux\r\n- How you installed PyTorch (`pip`):\r\n- Python version: 3.8\r\n- cuda:11.3.0-cudnn8\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\n", "before_files": [{"content": "import torch\n\nfrom kornia.testing import KORNIA_CHECK_IS_COLOR, KORNIA_CHECK_IS_TENSOR\n\n\ndef shift_rgb(image: torch.Tensor, r_shift: torch.Tensor, g_shift: torch.Tensor, b_shift: torch.Tensor) -> torch.Tensor:\n    \"\"\"Shift rgb channels.\n\n    Shift each image's channel by either r_shift for red, g_shift for green and b_shift for blue channels.\n    \"\"\"\n\n    KORNIA_CHECK_IS_TENSOR(image)\n    KORNIA_CHECK_IS_COLOR(image, f\"with shape {image.shape}\")\n\n    shifts = [r_shift, g_shift, b_shift]\n\n    shifted = (image + torch.Tensor(shifts).view(1, 3, 1, 1).to(image)).clamp_(min=0, max=1)\n\n    return shifted\n", "path": "kornia/enhance/shift_rgb.py"}]}