For some reason, when used with unfixed/symbolic shapes, the combination of AveragePooling2D, Conv2D, and Reshape causes PyTorch's tracer to freeze dimensions, making the export with unfixed shapes impossible. If the dims are marked as static, the export will go through.
I believe, this is a Keras-side issue as an identical model in pure Pytorch will be converted just fine, retaining the unfixed nature of the dimensions.
Colab to reproduce:
https://colab.research.google.com/drive/1VGox3Uw4RrcPDSlcgHIMZgBz_JYEjIRm
P.S. here I use a pure call to torch.onnx.export as the Keras wrapper is being fixed at this moment: #22076