decode_png¶
-
torchvision.io.
decode_png
(input: torch.Tensor, mode: torchvision.io.image.ImageReadMode = <ImageReadMode.UNCHANGED: 0>) → torch.Tensor[source]¶ 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 in [0, 255].
- Parameters
input (Tensor[1]) – a one dimensional uint8 tensor containing the raw bytes of the PNG image.
mode (ImageReadMode) – the read mode used for optionally converting the image. Default:
ImageReadMode.UNCHANGED
. See ImageReadMode class for more information on various available modes.
- Returns
output (Tensor[image_channels, image_height, image_width])