get_image_num_channels¶ torchvision.transforms.functional.get_image_num_channels(img: Tensor) → int[source]¶ 返回图像的通道数。 Parameters: img (PIL Image 或 Tensor) – 要检查的图像。 Returns: 通道数量。 Return type: int