mindspore.ops.DataFormatDimMap
- class mindspore.ops.DataFormatDimMap(src_format='NHWC', dst_format='NCHW')[source]
Returns the dimension index in the destination data format given in the source data format.
- Parameters
- Inputs:
input_x (Tensor) - A Tensor, each element is used as a dimension index of the source data format. The suggested values are in the range [-4, 4). Only supports int32.
- Outputs:
Tensor, Return the dimension index in the given target data format, has the same data type and shape as the input_x.
- Raises
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> from mindspore import Tensor, ops >>> input_x = Tensor([0, 1, 2, 3], mindspore.int32) >>> dfdm = ops.DataFormatDimMap() >>> output = dfdm(input_x) >>> print(output) [0 3 1 2]