-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
I used the “ort.ModelCompiler” api to compile a Float16 model which has a Reciprocal op inside it for QNN Execution Provider. The compilation fails and the error log is below.
[E:onnxruntime:, qnn_model_wrapper.cc:167 onnxruntime::qnn::QnnModelWrapper::CreateQnnInputOutputTensors] Data length mismatch for static tensor. node_name: output_0 tensor_name: _divisor. size calculated from shape: 2, tensor.clientBuf.dataSize: 4
possible cause
A possible cause is that ONNX runtime hard codes using 4 bytes (float) while converting Reciprocal to Div. However, the model is float16, so it expects data size as 2.
onnxruntime/onnxruntime/core/providers/qnn/builder/opbuilder/reciprocal_op_builder.cc
Line 78 in f86a0ed
| std::memcpy(divisor_data.data(), &one, sizeof(float)); |
repro
Reciprocal-FLOAT16.txt is an example model which only has a single Reciprocal node on it. Please rename the file extension from txt to onnx. The compile code on QNN is like below
model_compiler = ort.ModelCompiler(
sess_options,
"Reciprocal-FLOAT16.onnx",
)
model_compiler.compile_to_file(output_path)