Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add IODataTypeConverter surgeon to GraphSurgeries pass#1929

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-1928

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJun 23, 2025
edited
Loading

This PR adds a newIODataTypeConverter surgeon to theGraphSurgeries pass, providing the same functionality as the standaloneOnnxIODataTypeConverter pass but integrated into the graph surgeries framework.

Changes Made

New Surgeon Implementation

  • AddedIODataTypeConverter class inheriting fromProtoSurgeon
  • Implements full datatype conversion functionality:
    • Input/output datatype conversion with Cast node insertion
    • Name pattern matching using regex
    • Comprehensive datatype validation
    • Proper I/O mapping for graph transformation

Key Features

  • Parameter Compatibility: Uses the same parameters asOnnxIODataTypeConverter:
    • source_dtype: Source datatype integer value
    • target_dtype: Target datatype integer value
    • name_pattern: Regex pattern for selective conversion (default: "logits")
  • Graph Transformation: Adds Cast nodes at graph boundaries to convert datatypes
  • Validation: Validates ONNX datatype values and rejects invalid types
  • Integration: Seamlessly works within the existing GraphSurgeries framework

Usage Example

{"type":"GraphSurgeries","surgeries": [        {"surgeon":"IODataTypeConverter","source_dtype":10,"target_dtype":1,"name_pattern":"logits"        }    ]}

This converts all inputs/outputs matching "logits" from FLOAT16 (10) to FLOAT (1).

Documentation and Testing

  • Added comprehensive documentation with transformation examples
  • Included unit tests covering both valid and invalid datatype scenarios
  • Verified equivalence with the originalOnnxIODataTypeConverter pass

This implementation provides a migration path for users to move from the standalone pass to the more flexible GraphSurgeries framework, supporting the long-term goal of consolidating ONNX transformations.

Fixes#1928.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

Co-authored-by: devang-ml <47577486+devang-ml@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] Graph surgery to convert input and output types.Add IODataTypeConverter surgeon to GraphSurgeries passJun 23, 2025
@CopilotCopilotAI requested a review fromdevang-mlJune 23, 2025 19:24
Copilot finished work on behalf ofdevang-mlJune 23, 2025 19:24
@roboman-tech
Copy link

@devang-ml, It doesn't removeOnnxIODataTypeConverter from theOlive codebase.
If it doesn't want to remove old pass, then it needs to updatedocs and mentionOnnxIODataTypeConverter pass as deprecated.
Instead, recommend usingIODataTypeConverter to users.

@roboman-techroboman-tech mentioned this pull requestJun 30, 2025
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@devang-mldevang-mlAwaiting requested review from devang-ml

At least 1 approving review is required to merge this pull request.

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Graph surgery to convert input and output types.
3 participants
@Copilot@roboman-tech@devang-ml

[8]ページ先頭

©2009-2025 Movatter.jp