mindspore.ops.DataFormatDimMap
- class mindspore.ops.DataFormatDimMap(*args, **kwargs)[source]
Returns the dimension index in the destination data format given in the source data format.
- Parameters
src_format (string) – An optional value for source data format. The format can be ‘NHWC’ and ‘NCHW’. Default: ‘NHWC’.
dst_format (string) – An optional value for destination data format. The format can be ‘NHWC’ and ‘NCHW’. Default: ‘NCHW’.
- Inputs:
input_x (Tensor) - A Tensor with each element as a dimension index in source data format. The suggested values is 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
Examples
>>> input_x = Tensor([0, 1, 2, 3], mindspore.int32) >>> dfdm = ops.DataFormatDimMap() >>> output = dfdm(input_x) >>> print(output) [0 3 1 2]