Help Center/ Atlas 300 Application (Model 3000)/ TE API Reference/ Compute APIs/ te.lang.cce.compute_five2four(input, raw_shape_4D)
Updated on 2022-03-13 GMT+08:00

te.lang.cce.compute_five2four(input, raw_shape_4D)

Converts the 5D data format NC1HWC0 to the 4D data format NCHW. The supported type is float16.

This API is defined in dim_conv.py.

Parameter Description

  • input: input tensor, 5D format (N,C1,H,W,C0), tvm.tensor type
  • raw_shape_4D: dimension of the tensor after conversion

Return Value

res_tensor: tensor after the data format is converted into the 4D format (N,C,H,W), tvm.tensor type

Calling Example

import tvm
import te.lang.cce
raw_shape = (N,C,H,W)
input_shape = (N,(C+15)//16,H,W,16)
in_dtype = "float16"
input = tvm.placeholder(input_shape, name='input', dtype=in_dtype)
res = te.lang.cce.compute_five2four(input, raw_shape)
# res.shape = (N,C,H,W)