An error occurs when using exprBuilder when customizing the dynamic input op


I customized a plugin reflectPad, which supports dynamic input, but an error was reported in GetOutputDimensions()
my code:

DimsExprs ReflectPadPlugin::getOutputDimensions(
    int outputIndex, const DimsExprs *inputs, int nbInputs, IExprBuilder &exprBuilder)
    assert(inputs[0].nbDims == 4);
    DimsExprs output(inputs[0]);
    output.d[2] = exprBuilder.constant(inputs[0].d[2]->getConstantValue() + mPadT + mPadB); // Segmentation fault
    output.d[3] = exprBuilder.constant(inputs[0].d[3]->getConstantValue() + mPadL + mPadR);
    return output;

I cannot use exprBuilder.contant(error occurred: Segmentation fault) and exprBuilder.operation(error occurred: double free) normally

please help me! I can’t complete any custom ops right now. Thank you!


TensorRT Version: v8.2.0.6
GPU Type: RTX 2080TI
Nvidia Driver Version: 460.80
CUDA Version: 11.2
CUDNN Version:
Operating System + Version: ubuntu 18.04
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Please refer to below links related custom plugin implementation and sample:

While IPluginV2 and IPluginV2Ext interfaces are still supported for backward compatibility with TensorRT 5.1 and 6.0.x respectively, however, we recommend that you write new plugins or refactor existing ones to target the IPluginV2DynamicExt or IPluginV2IOExt interfaces instead.