How to use dynamic shapes in TensorRT

I want to use dynamic shapes in TensorRT, but there is a fully connected layer in my network, and a resizing operation must be performed after entering the network.
Then set dynamic batch and dynamic input (nchw) when addInput;
After that, an addResize is added, and it is stipulated that addResize sets the output dimension to be the same as the input dimension, then doesn’t addResize fix both batch and chw?I now have a fixed chw, but dynamic batch processing, how do I realize this operation?