Unverified Commit c36cb6d2 authored by Edgar Andrés Margffoy Tuay's avatar Edgar Andrés Margffoy Tuay Committed by GitHub
Browse files

Update image IO ops to reflect CHW tensor layout return (#2695)

parent fc490902
...@@ -33,7 +33,7 @@ def decode_png(input: torch.Tensor) -> torch.Tensor: ...@@ -33,7 +33,7 @@ def decode_png(input: torch.Tensor) -> torch.Tensor:
the raw bytes of the PNG image. the raw bytes of the PNG image.
Returns: Returns:
output (Tensor[image_width, image_height, 3]) output (Tensor[3, image_height, image_width])
""" """
if not isinstance(input, torch.Tensor) or input.numel() == 0 or input.ndim != 1: # type: ignore[attr-defined] if not isinstance(input, torch.Tensor) or input.numel() == 0 or input.ndim != 1: # type: ignore[attr-defined]
raise ValueError("Expected a non empty 1-dimensional tensor.") raise ValueError("Expected a non empty 1-dimensional tensor.")
...@@ -53,7 +53,7 @@ def read_png(path: str) -> torch.Tensor: ...@@ -53,7 +53,7 @@ def read_png(path: str) -> torch.Tensor:
path (str): path of the PNG image. path (str): path of the PNG image.
Returns: Returns:
output (Tensor[image_width, image_height, 3]) output (Tensor[3, image_height, image_width])
""" """
if not os.path.isfile(path): if not os.path.isfile(path):
raise ValueError("Expected a valid file path.") raise ValueError("Expected a valid file path.")
...@@ -73,7 +73,7 @@ def decode_jpeg(input: torch.Tensor) -> torch.Tensor: ...@@ -73,7 +73,7 @@ def decode_jpeg(input: torch.Tensor) -> torch.Tensor:
input (Tensor[1]): a one dimensional int8 tensor containing input (Tensor[1]): a one dimensional int8 tensor containing
the raw bytes of the JPEG image. the raw bytes of the JPEG image.
Returns: Returns:
output (Tensor[image_width, image_height, 3]) output (Tensor[3, image_height, image_width])
""" """
if not isinstance(input, torch.Tensor) or len(input) == 0 or input.ndim != 1: # type: ignore[attr-defined] if not isinstance(input, torch.Tensor) or len(input) == 0 or input.ndim != 1: # type: ignore[attr-defined]
raise ValueError("Expected a non empty 1-dimensional tensor.") raise ValueError("Expected a non empty 1-dimensional tensor.")
...@@ -92,7 +92,7 @@ def read_jpeg(path: str) -> torch.Tensor: ...@@ -92,7 +92,7 @@ def read_jpeg(path: str) -> torch.Tensor:
Arguments: Arguments:
path (str): path of the JPEG image. path (str): path of the JPEG image.
Returns: Returns:
output (Tensor[image_width, image_height, 3]) output (Tensor[3, image_height, image_width])
""" """
if not os.path.isfile(path): if not os.path.isfile(path):
raise ValueError("Expected a valid file path.") raise ValueError("Expected a valid file path.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment