prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Doc Description Wrong
  Hello, 
  
  I find python doc in [get_depth_image_from_path](https://github.com/nerfstudio-project/nerfstudio/blob/main/nerfstudio/data/utils/data_utils.py) is wrong about the return tensor shape, 
  
  it should be [height, width, 1] not [width, height, 1].
  
  ![图片](https://github.com/nerfstudio-project/nerfstudio/assets/20349525/e6acb5ee-4f66-44ad-b21e-1161b1df61b3)
  
  a simple verification:
  
  ![图片](https://github.com/nerfstudio-project/nerfstudio/assets/20349525/dfd65f57-7f8b-44ab-897b-d06793c03375)
  
  
  
  </issue>
  <code>
  [start of nerfstudio/data/utils/data_utils.py]
  1 # Copyright 2022 the Regents of the University of California, Nerfstudio Team and contributors. All rights reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 """Utility functions to allow easy re-use of common operations across dataloaders"""
  16 from pathlib import Path
  17 from typing import List, Tuple, Union
  18 
  19 import cv2
  20 import numpy as np
  21 import torch
  22 from PIL import Image
  23 
  24 
  25 def get_image_mask_tensor_from_path(filepath: Path, scale_factor: float = 1.0) -> torch.Tensor:
  26     """
  27     Utility function to read a mask image from the given path and return a boolean tensor
  28     """
  29     pil_mask = Image.open(filepath)
  30     if scale_factor != 1.0:
  31         width, height = pil_mask.size
  32         newsize = (int(width * scale_factor), int(height * scale_factor))
  33         pil_mask = pil_mask.resize(newsize, resample=Image.NEAREST)
  34     mask_tensor = torch.from_numpy(np.array(pil_mask)).unsqueeze(-1).bool()
  35     if len(mask_tensor.shape) != 3:
  36         raise ValueError("The mask image should have 1 channel")
  37     return mask_tensor
  38 
  39 
  40 def get_semantics_and_mask_tensors_from_path(
  41     filepath: Path, mask_indices: Union[List, torch.Tensor], scale_factor: float = 1.0
  42 ) -> Tuple[torch.Tensor, torch.Tensor]:
  43     """
  44     Utility function to read segmentation from the given filepath
  45     If no mask is required - use mask_indices = []
  46     """
  47     if isinstance(mask_indices, List):
  48         mask_indices = torch.tensor(mask_indices, dtype=torch.int64).view(1, 1, -1)
  49     pil_image = Image.open(filepath)
  50     if scale_factor != 1.0:
  51         width, height = pil_image.size
  52         newsize = (int(width * scale_factor), int(height * scale_factor))
  53         pil_image = pil_image.resize(newsize, resample=Image.NEAREST)
  54     semantics = torch.from_numpy(np.array(pil_image, dtype="int64"))[..., None]
  55     mask = torch.sum(semantics == mask_indices, dim=-1, keepdim=True) == 0
  56     return semantics, mask
  57 
  58 
  59 def get_depth_image_from_path(
  60     filepath: Path,
  61     height: int,
  62     width: int,
  63     scale_factor: float,
  64     interpolation: int = cv2.INTER_NEAREST,
  65 ) -> torch.Tensor:
  66     """Loads, rescales and resizes depth images.
  67     Filepath points to a 16-bit or 32-bit depth image, or a numpy array `*.npy`.
  68 
  69     Args:
  70         filepath: Path to depth image.
  71         height: Target depth image height.
  72         width: Target depth image width.
  73         scale_factor: Factor by which to scale depth image.
  74         interpolation: Depth value interpolation for resizing.
  75 
  76     Returns:
  77         Depth image torch tensor with shape [width, height, 1].
  78     """
  79     if filepath.suffix == ".npy":
  80         image = np.load(filepath) * scale_factor
  81         image = cv2.resize(image, (width, height), interpolation=interpolation)
  82     else:
  83         image = cv2.imread(str(filepath.absolute()), cv2.IMREAD_ANYDEPTH)
  84         image = image.astype(np.float64) * scale_factor
  85         image = cv2.resize(image, (width, height), interpolation=interpolation)
  86     return torch.from_numpy(image[:, :, np.newaxis])
  87
  [end of nerfstudio/data/utils/data_utils.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/nerfstudio/data/utils/data_utils.py b/nerfstudio/data/utils/data_utils.py
  --- a/nerfstudio/data/utils/data_utils.py
  +++ b/nerfstudio/data/utils/data_utils.py
  @@ -74,7 +74,7 @@
           interpolation: Depth value interpolation for resizing.
   
       Returns:
  -        Depth image torch tensor with shape [width, height, 1].
  +        Depth image torch tensor with shape [height, width, 1].
       """
       if filepath.suffix == ".npy":
           image = np.load(filepath) * scale_factor
  
verification_info: {"golden_diff": "diff --git a/nerfstudio/data/utils/data_utils.py b/nerfstudio/data/utils/data_utils.py\n--- a/nerfstudio/data/utils/data_utils.py\n+++ b/nerfstudio/data/utils/data_utils.py\n@@ -74,7 +74,7 @@\n         interpolation: Depth value interpolation for resizing.\n \n     Returns:\n-        Depth image torch tensor with shape [width, height, 1].\n+        Depth image torch tensor with shape [height, width, 1].\n     \"\"\"\n     if filepath.suffix == \".npy\":\n         image = np.load(filepath) * scale_factor\n", "issue": "Doc Description Wrong\nHello, \r\n\r\nI find python doc in [get_depth_image_from_path](https://github.com/nerfstudio-project/nerfstudio/blob/main/nerfstudio/data/utils/data_utils.py) is wrong about the return tensor shape, \r\n\r\nit should be [height, width, 1] not [width, height, 1].\r\n\r\n![\u56fe\u7247](https://github.com/nerfstudio-project/nerfstudio/assets/20349525/e6acb5ee-4f66-44ad-b21e-1161b1df61b3)\r\n\r\na simple verification:\r\n\r\n![\u56fe\u7247](https://github.com/nerfstudio-project/nerfstudio/assets/20349525/dfd65f57-7f8b-44ab-897b-d06793c03375)\r\n\r\n\n", "before_files": [{"content": "# Copyright 2022 the Regents of the University of California, Nerfstudio Team and contributors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Utility functions to allow easy re-use of common operations across dataloaders\"\"\"\nfrom pathlib import Path\nfrom typing import List, Tuple, Union\n\nimport cv2\nimport numpy as np\nimport torch\nfrom PIL import Image\n\n\ndef get_image_mask_tensor_from_path(filepath: Path, scale_factor: float = 1.0) -> torch.Tensor:\n    \"\"\"\n    Utility function to read a mask image from the given path and return a boolean tensor\n    \"\"\"\n    pil_mask = Image.open(filepath)\n    if scale_factor != 1.0:\n        width, height = pil_mask.size\n        newsize = (int(width * scale_factor), int(height * scale_factor))\n        pil_mask = pil_mask.resize(newsize, resample=Image.NEAREST)\n    mask_tensor = torch.from_numpy(np.array(pil_mask)).unsqueeze(-1).bool()\n    if len(mask_tensor.shape) != 3:\n        raise ValueError(\"The mask image should have 1 channel\")\n    return mask_tensor\n\n\ndef get_semantics_and_mask_tensors_from_path(\n    filepath: Path, mask_indices: Union[List, torch.Tensor], scale_factor: float = 1.0\n) -> Tuple[torch.Tensor, torch.Tensor]:\n    \"\"\"\n    Utility function to read segmentation from the given filepath\n    If no mask is required - use mask_indices = []\n    \"\"\"\n    if isinstance(mask_indices, List):\n        mask_indices = torch.tensor(mask_indices, dtype=torch.int64).view(1, 1, -1)\n    pil_image = Image.open(filepath)\n    if scale_factor != 1.0:\n        width, height = pil_image.size\n        newsize = (int(width * scale_factor), int(height * scale_factor))\n        pil_image = pil_image.resize(newsize, resample=Image.NEAREST)\n    semantics = torch.from_numpy(np.array(pil_image, dtype=\"int64\"))[..., None]\n    mask = torch.sum(semantics == mask_indices, dim=-1, keepdim=True) == 0\n    return semantics, mask\n\n\ndef get_depth_image_from_path(\n    filepath: Path,\n    height: int,\n    width: int,\n    scale_factor: float,\n    interpolation: int = cv2.INTER_NEAREST,\n) -> torch.Tensor:\n    \"\"\"Loads, rescales and resizes depth images.\n    Filepath points to a 16-bit or 32-bit depth image, or a numpy array `*.npy`.\n\n    Args:\n        filepath: Path to depth image.\n        height: Target depth image height.\n        width: Target depth image width.\n        scale_factor: Factor by which to scale depth image.\n        interpolation: Depth value interpolation for resizing.\n\n    Returns:\n        Depth image torch tensor with shape [width, height, 1].\n    \"\"\"\n    if filepath.suffix == \".npy\":\n        image = np.load(filepath) * scale_factor\n        image = cv2.resize(image, (width, height), interpolation=interpolation)\n    else:\n        image = cv2.imread(str(filepath.absolute()), cv2.IMREAD_ANYDEPTH)\n        image = image.astype(np.float64) * scale_factor\n        image = cv2.resize(image, (width, height), interpolation=interpolation)\n    return torch.from_numpy(image[:, :, np.newaxis])\n", "path": "nerfstudio/data/utils/data_utils.py"}]}