diff --git a/torchvision/io/image.py b/torchvision/io/image.py index 2ba1e9eddd9..3bafabdfd7a 100644 --- a/torchvision/io/image.py +++ b/torchvision/io/image.py @@ -59,7 +59,7 @@ def write_file(filename: str, data: torch.Tensor) -> None: def decode_png(input: torch.Tensor, mode: ImageReadMode = ImageReadMode.UNCHANGED) -> torch.Tensor: """ - Decodes a PNG image into a 3 dimensional RGB Tensor. + Decodes a PNG image into a 3 dimensional RGB or grayscale Tensor. Optionally converts the image to the desired format. The values of the output tensor are uint8 between 0 and 255. @@ -117,7 +117,7 @@ def decode_jpeg( input: torch.Tensor, mode: ImageReadMode = ImageReadMode.UNCHANGED, device: str = "cpu" ) -> torch.Tensor: """ - Decodes a JPEG image into a 3 dimensional RGB Tensor. + Decodes a JPEG image into a 3 dimensional RGB or grayscale Tensor. Optionally converts the image to the desired format. The values of the output tensor are uint8 between 0 and 255. @@ -185,7 +185,7 @@ def write_jpeg(input: torch.Tensor, filename: str, quality: int = 75): def decode_image(input: torch.Tensor, mode: ImageReadMode = ImageReadMode.UNCHANGED) -> torch.Tensor: """ Detects whether an image is a JPEG or PNG and performs the appropriate - operation to decode the image into a 3 dimensional RGB Tensor. + operation to decode the image into a 3 dimensional RGB or grayscale Tensor. Optionally converts the image to the desired format. The values of the output tensor are uint8 between 0 and 255. @@ -207,7 +207,7 @@ def decode_image(input: torch.Tensor, mode: ImageReadMode = ImageReadMode.UNCHAN def read_image(path: str, mode: ImageReadMode = ImageReadMode.UNCHANGED) -> torch.Tensor: """ - Reads a JPEG or PNG image into a 3 dimensional RGB Tensor. + Reads a JPEG or PNG image into a 3 dimensional RGB or grayscale Tensor. Optionally converts the image to the desired format. The values of the output tensor are uint8 between 0 and 255.