文档首页> Atlas 500应用> TE API参考> compute接口> te.lang.cce.compute_five2four(input, raw_shape_4D)
更新时间:2021-03-18 GMT+08:00
分享

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

把给定5-D “NC1HWC0”数据格式转换为4-D “NCHW”数据格式。支持的数据类型:float16。

该接口在dim_conv.py中定义。

参数说明

  • input:输入tensor,5-D格式(N, C1, H, W, C0),tvm.tensor类型。
  • raw_shape_4D:转换后tensor的维度。

返回值

res_tensor:转换为4-D格式(N, C, H, W)后的tensor,tvm.tensor类型。

调用示例

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)
分享:

    相关文档

    相关产品