conv3d_backprop_input
Description
Computes 3D deconvolution of the float16 type with the given 6HD data and FracZ weight.
This API supports bias.
The data tensor has a 6HD shape of (N, D, C1, H, W, C0). The weight tensor has a FracZ shape of (KD x C1 x KH x KW, Cout//C0_out, C0_out, C0).
Prototype
conv3d_backprop_input(filter, out_backprop, filter_size, input_size, para_dict)
Parameters
- filter: a FracZ Tensor of type float16, for the weight of 3D convolution.
- out_backprop: backprop of the 3D convolution. Currently, the float16 type is supported.
- filter_size: a weight for 3D convolution.
- input_size: a feature map for 3D convolution.
- para_dict: a dictionary for the key-value pairs, including the following keys:
- strides: a list of the strides along the D, H, and W directions of the feature map.
- pads: a list of the padding lines along the D, H, and W directions of the feature map.
- dilations: a list of the dilations along the D, H, and W directions of the filter.
- res_dtype: output data type.
- kernel_name: operator name.
- group_dict: a dictionary of 3dx group convolution arguments with respect to the input, including:
1. fmap_c, C dimension size of the feature map.
2. cout, batch size of the weight.
3. groups, argument for group convolution.
4. cout0, which is tbe_platform.C0_SIZE. Defaults to 16.
5. cin0, which is tbe_platform.C0_SIZE. Defaults to 16.
The computation formula is as follows.
lcm(param1, param2): calculates the least common multiple.
mag_factor0 = lcm(fmap_c // groups, cin0) // (fmap_c // groups)
mag_factor1 = lcm(cout // groups, cout0) // (cout // groups)
mag_factor = min(lcm(mag_factor0, mag_factor1), groups)
cin1_g = (mag_factor * fmap_c // groups + cin0 - 1) // cin0
cout_g = (mag_factor * cout // groups + cout0 - 1) // cout0 * cout0
group_dict = {"real_g": (groups + mag_factor - 1) // mag_factor,
"mag_factor": mag_factor,
"cin1_g": cin1_g,
"cout_g": cout_g,
"cin_ori": fmap_c,
"cout_ori": cout}
Returns
res_tensor: result tensor.
Restrictions
This API cannot be used in conjunction with other TBE DSL APIs.
Applicability
Example
from tbe import tvm
from tbe import dsl
shape_dedy = (1, 2, 16, 15, 22, 16)
out_backprop_dtype = "float16"
input_sizes = [1, 4, 30, 44, 128]
shape_filter_ncdhw = [256, 128, 2, 2, 2]
shape_filter_frac = (64, 16, 16, 16)
filter_dtype = "float16"
dedy = tvm.placeholder(shape_dedy, name="dedy",
dtype=out_backprop_dtype)
filters = tvm.placeholder(shape_filter_frac,
name="filter", dtype=filter_dtype)
strides = [1, 2, 2, 2, 1]
pads = [0, 0, 0, 0, 0, 0]
dilations = (1, 1, 1, 1, 1)
res_dtype = "float16"
kernel_name = "conv3d_backprop_input_w_2_2_2_128_256_y_1_2_15_22_256_x_1_4_30_44_128_s_1_2_2_2_1_SAME_d_1_1_g_1"
group_dict = {'real_g': 1, 'mag_factor': 1, 'cin1_g': 8, 'cout_g': 256, 'cin_ori': 128, 'cout_ori': 256}
para_dict = {
"strides": strides,
"pads": pads,
"dilations": dilations,
"res_dtype": res_dtype,
"kernel_name": kernel_name,
"group_dict": group_dict
}
dedx = dsl.conv3d_backprop_input(
filter=filters,
out_backprop=dedy,
filter_size=shape_filter_ncdhw,
input_size=input_sizes,
para_dict=para_dict
)