pytorch view() is not fully supported using onnx2tensorrt workflow

Hi,
I’m trying to deploy a CNN using tensorrt. The CNN is trained using pytorch, and can be exported to ONNX format easily.
In the forward() pass, there is a reshape between the feature maps and fully connected layers.
My version is:

h = h.view(-1, 20*14*14) # the size -1 is inferred from other dimensions

but ‘-1’ inference do not work in the python tensorrt onnx parser.
I got a error:

terminate called after throwing an instance of 'std::out_of_range'
  what(): Attribute not found: shape
Aborted (core dumped)

I have to specify the first value.

I encounter the same problem,
when executing
parser.convert_to_trtnetwork()

errors come:
terminate called after throwing an instance of ‘std::out_of_range’
what(): Attribute not found: shape

Have you solved it?

I’m not using tensorrt for a while.
Try to specify the batch size explicit, say 32 or 64, it may help

Hi,

I still get this error despite explicitly declaring batch size.