onnxruntime
994f3497 - [float16] Reuse Cast nodes for shared always-float inputs (#33090)

Commit
5 days ago
[float16] Reuse Cast nodes for shared always-float inputs (#33090) ### Description `convert_float_to_float16` could emit duplicate Cast node and output names when a shared float tensor fed multiple always-float inputs, such as `Resize` scales. The converted model then failed validation or ONNX Runtime loading. - **Cast reuse:** Cache Cast outputs by source tensor and target type so all consumers share one Cast. - **Regression coverage:** Add coverage for a shared `Resize` scales initializer listed in `graph.value_info`. ```python # Both Resize nodes now consume the same output: resize_1.input[2] == resize_2.input[2] == "scales_cast_to_fp32" ``` ### Motivation and Context Dynamo-based PyTorch ONNX export deduplicates identical constants and records them in `value_info`, exposing this failure for models with multiple upsample layers. <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #33088 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com> Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com> Co-authored-by: Tianlei Wu <tlwu@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
Parents
Loading