Skip to content

Commit

Permalink
[ODLA/TRT] fix:dilation for conv/deconv
Browse files Browse the repository at this point in the history
(cherry picked from commit 47cbb8c52b9bc01052521304140e2749e6b4b748)
  • Loading branch information
littlefatfat authored and weimingzha0 committed May 9, 2022
1 parent 197e923 commit 7aced99
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ODLA/platforms/tensorrt/odla_tensorrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1869,13 +1869,15 @@ odla_value odla_Conv(odla_value input, odla_memory_layout input_layout,
static_cast<int>(kernel_dims.dims[3])},
kernel_weights, bias_weights);
conv->setStride(nvinfer1::DimsHW(strides[0], strides[1]));
conv->setDilation(nvinfer1::DimsHW(dilations[0], dilations[1]));
#else
auto conv = g_comp->network->addConvolutionNd(
*input, oc,
nvinfer1::DimsHW{static_cast<int>(kernel_dims.dims[2]),
static_cast<int>(kernel_dims.dims[3])},
kernel_weights, bias_weights);
conv->setStrideNd(nvinfer1::DimsHW(strides[0], strides[1]));
conv->setDilationNd(nvinfer1::DimsHW(dilations[0], dilations[1]));
#endif
conv->setPrePadding(nvinfer1::DimsHW(paddings_front[0], paddings_front[1]));
conv->setPostPadding(nvinfer1::DimsHW(paddings_back[0], paddings_back[1]));
Expand Down Expand Up @@ -1916,13 +1918,15 @@ odla_value odla_DeConv(odla_value input, odla_memory_layout input_layout,
static_cast<int>(kernel_dims.dims[3])},
kernel_weights, bias_weights);
conv->setStride(nvinfer1::DimsHW(strides[0], strides[1]));
conv->setDilation(nvinfer1::DimsHW(dilations[0], dilations[1]));
#else
auto conv = g_comp->network->addDeconvolutionNd(
*input, oc,
nvinfer1::DimsHW{static_cast<int>(kernel_dims.dims[2]),
static_cast<int>(kernel_dims.dims[3])},
kernel_weights, bias_weights);
conv->setStrideNd(nvinfer1::DimsHW(strides[0], strides[1]));
conv->setDilationNd(nvinfer1::DimsHW(dilations[0], dilations[1]));
#endif

conv->setPrePadding(nvinfer1::DimsHW(paddings_front[0], paddings_front[1]));
Expand Down

0 comments on commit 7aced99

Please sign in to comment.