mindspore.dataset.vision.c_transforms.HWC2CHW
- class mindspore.dataset.vision.c_transforms.HWC2CHW[source]
Transpose the input image from shape <H, W, C> to shape <C, H, W>. The input image should be 3 channels image.
Note
This operation supports running on Ascend or GPU platforms by Offload.
- Raises
RuntimeError – If given tensor shape is not <H, W, C>.
- Supported Platforms:
CPU
Ascend
GPU
Examples
>>> transforms_list = [c_vision.Decode(), ... c_vision.RandomHorizontalFlip(0.75), ... c_vision.RandomCrop(512), ... c_vision.HWC2CHW()] >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns=["image"])