onnx2trt 踩坑总结

Parsing Error

Gather

  1. Assertion failed: !(data->getType() == nvinfer1::DataType::kINT32 && nbDims == 1) && “Cannot perform gather on a shape tensor!”

Upample

```python
#return F.upsample(x, size=(x.shape[2] * 2, x.shape[3] * 2), mode='bilinear', align_corners=True)
                        # RuntimeError: ONNX symbolic expected a constant value in the trace

#return F.interpolate(x, size=(x.shape[2] * 2, x.shape[3] * 2), mode='bilinear', align_corners=True)
                        # RuntimeError: ONNX symbolic expected a constant value in the trace

#return F.upsample(x, size=(600, 600), mode='bilinear', align_corners=False)
                        # UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.

#return F.interpolate(x, size=(600, 600), mode='bilinear', align_corners=True)
                        # UserWarning: ONNX export failed on upsample_bilinear2d because align_corners == True not supported
                        # RuntimeError: ONNX export failed: Couldn't export operator aten::upsample_bilinear2d

return F.interpolate(x, size=(600, 600), mode='bilinear', align_corners=False) #no warning, all clear
```
Table of Contents