Skip to content

Fix ONNX optional input handling by preserving positional indices in getNodeInputs()#1

Closed
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-resize-v11-input-handling
Closed

Fix ONNX optional input handling by preserving positional indices in getNodeInputs()#1
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-resize-v11-input-handling

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 6, 2026

getNodeInputs() compacted the returned vector by skipping empty input names, breaking positional indexing for any op with optional inputs. For Resize v11, this caused the ROI input (index 1, commonly empty) to shift scales and sizes to wrong indices, and incorrectly rejected valid nodes.

Changes

  • getNodeInputs() refactor — returns nullptr for empty input names instead of skipping them; inputs[N] now always refers to the Nth ONNX input regardless of preceding optional inputs
  • Resize.cpp convertResizeV11 — drops the onnx_node.input() workaround; uses getNodeInputs() directly with clean positional access:
    • inputs[0] → X, inputs[1] → ROI (nullptr when absent), inputs[2] → scales, inputs[3] → sizes
  • Conv.cpp / ConvTranspose.cpp — bias detection updated from inputs.size() > 2 to inputs.size() > 2 && inputs[2] != nullptr to correctly handle a bias with an empty name
  • Test — added ConverterContextTest/getNodeInputs_preserves_positional_indices verifying that a node with inputs ["a", "", "b"] yields [a, nullptr, b]
// Before: skipped empty names → compacted vector
// ["X", "", "scales"]  →  [x, scales]   // inputs[1] is wrongly scales

// After: nullptr for absent inputs → positional vector preserved
// ["X", "", "scales"]  →  [x, nullptr, scales]   // inputs[2] is correctly scales

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ndling

Co-authored-by: arkq <6979798+arkq@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix input handling for Resize v11 in ONNXNodeConverterRegistry Add ONNX Resize v10/v11 converters with correct optional input handling Mar 6, 2026
Copilot finished work on behalf of arkq March 6, 2026 06:18
…inputs

Co-authored-by: arkq <6979798+arkq@users.noreply.github.com>
Copilot AI changed the title Add ONNX Resize v10/v11 converters with correct optional input handling Fix ONNX optional input handling by preserving positional indices in getNodeInputs() Mar 6, 2026
Copilot finished work on behalf of arkq March 6, 2026 06:32
@arkq arkq closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants