decode_gif¶
- torchvision.io.decode_gif(input: Tensor) Tensor [source]¶
将 GIF 图像解码为 3 或 4 维 RGB 张量。
输出张量的值是介于 0 和 255 之间的 uint8。如果 GIF 中只有一个图像,则输出张量的形状为
(C, H, W)
,如果存在N
个图像,则形状为(N, C, H, W)
。- 参数:
input (Tensor[1]) – 一个包含 GIF 图像原始字节的一维连续 uint8 张量。
- 返回:
output (Tensor[image_channels, image_height, image_width] 或 Tensor[num_images, image_channels, image_height, image_width])