Description
Describe the Issue
I converted a model with grid_sampler layer from pytorch 1.9 / 1.10 to onnx format. It works and I can open it in onnxruntime with help of mmcv. But when I make quantization of the model (succesfully) I can't run it in onnxruntime with the following error:
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from var/pretrained/kp2d-v4-quantized.onnx failed:This is an invalid model. Error: Duplicate definition of name (input).
where input - is input variable name
Also, during quantization I see the following warnings:
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator MaxPool. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator MaxPool. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator ReorderOutput. No schema registered for this operator.
Warning: Unsupported operator MaxPool. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator ReorderOutput. No schema registered for this operator.
Warning: Unsupported operator ReorderInput. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator ReorderOutput. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator Conv. No schema registered for this operator.
Warning: Unsupported operator ReorderOutput. No schema registered for this operator.
Warning: Unsupported operator ReorderOutput. No schema registered for this operator.
Reproduction
Quantization code:
from onnxruntime.quantization import quantize_dynamic, QuantType
model_name = onnx_model_path.as_posix()
output_model_name = f"{model_name[:-5]}-quantized.onnx"
quantize_dynamic(
model_input=model_name,
model_output=output_model_name,
per_channel=True,
activation_type=QuantType.QUInt8,
weight_type=QuantType.QUInt8,
optimize_model=False,
)
Environment
Ubuntu 20.04
pytorch 1.9.1/1.10
onnx 1.8.1
onnxruntime 1.8.1
mmcv-full 1.3.15 + compiled extensions _ext*.so for Linux
Question
Does it mean that quantization of models with grid_sampler inside don't support or I do something wrong?