how to reset input dimensions after load .prototxt and before create engine

I tried somethine like this, but not working:

1: constructNetwork(parser, builder, network, config); // just like samples.
2: network->getInput(0)->setDimensions(Dims3{1,1,1});
3: builder->buildEngineWithConfig(*network, *config)…; // just like samples.

line 2 can run ok, but line 3 report error on an Eltwise layer:

elementwise inputs must have same dimensions or follow broadcast rules…

if i comment line 2 out, everything is ok.

so, what’s happening here? why this not working? and what should i do?

Hi,

Could you please share the script and model file so we can better help?

Thanks