get_image_num_channels¶ torchvision.transforms.functional.get_image_num_channels(img: Tensor) → int[來源]¶ 返回圖像的通道數。 參數: img (PIL Image 或 Tensor) – 要檢查的圖像。 返回: 通道數。 返回類型: int