conv3d

功能说明

在给定6HD格式的Data和FracZ格式的Weight的情况下计算float16的3-D卷积。

接口可以支持bias。

Data tensor 的shape是6HD,即(N, D, C1, H, W, C0);Weight Tensor 的shape是 FracZ,即 (KD*C1*KH*KW, Cout//C0_out, C0_out, C0)。

函数原型

conv3d(x, filter, filter_size, para_dict)

参数说明

返回值

res_tensor:表示卷积计算的tensor,即卷积计算的结果输出。

约束说明

此接口暂不支持与其他TBE DSL计算接口混合使用。

支持的芯片型号

Atlas 200/300/500 推理产品

Atlas 训练系列产品

调用示例

from tbe import tvm
from tbe import dsl

shape_fmp_ndc1hwc0 = (1, 32, 1, 240, 352, 16)
fmp_dtype = "float16"
shape_filter = [16, 16, 3, 3, 3]
shape_w_frac_z = (27, 1, 16, 16)
w_dtype = "float16"

data = tvm.placeholder(shape_fmp_ndc1hwc0, name='Fmap', dtype=fmp_dtype)
weight = tvm.placeholder(shape_w_frac_z, name='Filter', dtype=w_dtype)

bias_tensor = None
pads = [1, 1, 1, 1, 1, 1]
stride_dhw = [1, 1, 1]
res_dtype = "float16"
mad_dtype = "float32"
kernel_name = "conv3d_1_32_240_352_1_3_3_3_1_16_1_1_1_SAME_NDHWC_1_0"
group_dict = {'real_g': 1, 'mag_factor': 1, 'cin1_g': 1, 'cout_g': 16, 'cin_ori': 1, 'cout_ori': 16}
dilation_dhw = [1, 1, 1]

para_dict = {
    "dsl_flag": False,
    "bias_tensor": bias_tensor,
    "pads": pads,
    "strides": stride_dhw,
    "res_dtype": res_dtype,
    "mad_dtype": mad_dtype,
    "kernel_name": kernel_name,
    "group_dict": group_dict,
    "dilations": dilation_dhw
}

conv_res = dsl.conv3d(data, weight, shape_filter, para_dict)