From 5f6b9f1b04a1e167e41774f225f91fa34cf418b7 Mon Sep 17 00:00:00 2001 From: Wang Bojun <105858416+wwbitejotunn@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:28:38 +0800 Subject: [PATCH] [Cherry pick] trt pool2d adaptive ifx (#47069) * draft with debug print * remove debug print * bug fix for ci --- paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu | 8 ++++---- paddle/phi/kernels/funcs/pooling.cu | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu b/paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu index 21eb89d135..52959d8f90 100644 --- a/paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu +++ b/paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu @@ -321,16 +321,16 @@ int PoolPluginDynamic::enqueue(const nvinfer1::PluginTensorDesc *input_desc, paddings[1] = 0; output_shape[2] = 1; output_shape[3] = 1; + if (adaptive_) { + output_shape[2] = h; + output_shape[3] = w; + } } else { auto data_dim = CalcOutputSize( {h, w}, ceil_mode_, adaptive_, ksize_, strides_, paddings_); output_shape[2] = data_dim[0]; output_shape[3] = data_dim[1]; } - if (adaptive_) { - output_shape[2] = h; - output_shape[3] = w; - } if (pool_type_ == "max") { phi::funcs::MaxPool pool_process; diff --git a/paddle/phi/kernels/funcs/pooling.cu b/paddle/phi/kernels/funcs/pooling.cu index 6e4fc414af..425448a382 100644 --- a/paddle/phi/kernels/funcs/pooling.cu +++ b/paddle/phi/kernels/funcs/pooling.cu @@ -388,7 +388,6 @@ void Pool2dDirectCUDAFunctor::operator()( const int stride_width = strides[1]; const int padding_height = paddings[0]; const int padding_width = paddings[1]; - int nthreads = batch_size * output_channels * output_height * output_width; int thread_num = 1024; #ifdef WITH_NV_JETSON -- GitLab