get_image_num_channels¶ torchvision.transforms.functional.get_image_num_channels(img: Tensor) → int[原始碼]¶ 返回影像的通道數。 引數: img (PIL Image 或 Tensor) – 要檢查的影像。 返回: 通道數。 返回型別: int