diff --git a/paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu b/paddle/fluid/inference/tensorrt/plugin/pool_op_plugin.cu index 21eb89d135efa654b0f0f894980f68393f7cadea..52959d8f90b6d1c587b4e25347e29030dcb6981f 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 875fa92002a43680eda8441adb3a2c19fc96553b..a1bb927b73e07eab17ac6daed405c6e679855586 100644 --- a/paddle/phi/kernels/funcs/pooling.cu +++ b/paddle/phi/kernels/funcs/pooling.cu @@ -460,7 +460,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; auto pool_divmods = FastDivModForPooling(input_channels, output_width, output_height); @@ -491,6 +490,7 @@ void Pool2dDirectCUDAFunctor::operator()( pool_compute, exclusive, output); + } else { int thread_num = 1024; #ifdef WITH_NV_JETSON