Skip to content

[WIP] AddCastNode in insert_cast_transformer.cc sets invalid dtype -1 #25064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 14, 2025

Analyzing the issue where AddCastNode in insert_cast_transformer.cc sets invalid dtype -1.

Initial investigation plan:

  • Examined the AddCastNode function in insert_cast_transformer.cc
  • Identified the issue is with the to_type parameter being set to -1
  • Verified that TensorProto_DataType_FLOAT (1) and TensorProto_DataType_FLOAT16 (10) are valid enum values
  • Located the call sites in ApplyImpl function that call AddCastNode
  • Create a minimal reproduction test
  • Identify the root cause of the -1 value
  • Implement the fix
  • Run tests to verify the fix

The error occurs when processing fp16 models with CPU execution provider, specifically with RandomNormalLike operations. The Cast node creation fails due to an invalid to attribute value of -1.

Next steps: Create a focused test and identify where the -1 value originates.

Fixes #16449.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
@justinchuby
Copy link
Contributor

@copilot try again

Copy link
Contributor Author

Copilot AI commented Jun 14, 2025

@copilot try again

I've analyzed the issue more deeply. After reverting my validation approach, I'm investigating the root cause where the -1 value originates. The issue appears to be specific to RandomNormalLike operations with fp16 models on CPU. I found a test model that reproduces the problem and am now tracing through the code paths to identify where the invalid value is being generated rather than just validating against it.

Co-authored-by: justinchuby <11205048+justinchuby@users.noreply.github.com>
Copilot finished work on behalf of justinchuby June 14, 2025 22:23
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.

AddCastNode in insert_cast_transformer.cc sets invalid dtype -1
2 participants