You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow bias to be float when selecting QDQ node group for Conv Op
Motivation and Context
If the bias is float (non-quantized) while the weights and activations are quantized, the Q and DQ nodes aren't getting properly partitioned into 1 group along with the conv op. As a result, graph finalization error occurs. This change will allow the node group to be formed even when bias is float.
The semantic change to allow dq_nodes.size() == 2 (float-bias Conv) is a functional bug fix with a clear regression risk, but the PR diff contains no unit test. Per team convention, a bug-fix PR must include a reproducing test (CI red), a post-fix verification (CI green), and a kill-test fence — temporarily reverting the fix to confirm the test fails. Without a test, a future accidental revert to the default num_dq_inputs = -1 would go undetected.
Please add two test cases in onnxruntime/test/providers/qnn/:
Float bias: Conv + DQ(input) + DQ(weight), bias as a float initializer (no DQ node) → assert Check() returns true
After passing static_cast<int>(dq_nodes.size()) as num_dq_inputs, the "reject if DQ count mismatches" guard inside CheckQDQNodes becomes a no-op (the passed value always equals the actual value). If Check() is ever called with dq_nodes.size() < 2, CheckQDQNodes can no longer intercept it, and the subsequent dq_nodes[0] at L858 / dq_nodes[1] at L859 would be out-of-bounds.
if (!CheckQDQNodes(graph, ort_api, node, redundant_clip_node, dq_nodes, q_nodes, static_cast<int>(dq_nodes.size()))) {
return false;
}
if (dq_nodes.size() < 2) {
return false; // Conv requires at least DQ nodes for input and weight
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Allow bias to be float when selecting QDQ node group for Conv Op
Motivation and Context
If the bias is float (non-quantized) while the weights and activations are quantized, the Q and DQ nodes aren't getting properly partitioned into 1 group along with the conv op. As a result, graph finalization error occurs. This change will allow the node group to be formed even when bias is float.
The bias quantization is handled in #483