Skip to content

Conversation

tehbone
Copy link
Contributor

@tehbone tehbone commented Feb 2, 2024

Description

This removes the invocation of convert_endian() from numpy_helper.to_array() in favor of another implementation, since convert_endian() modifies the TensorProto.

Motivation and Context

This change was needed due to observed issues when trying to load an ONNX model that was exported on a s390x system via tf2onnx. Debugging showed that the TeensorProto was being modified by endianness conversion operations, which led to model incorrectness under certain circumstances.

Fixes #5901.

Signed-off-by: Tabari Alexander <tehbone@gmail.com>
@tehbone tehbone requested a review from a team as a code owner February 2, 2024 20:07
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (d08208f) 56.65% compared to head (c936743) 56.65%.

Files Patch % Lines
onnx/numpy_helper.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5904   +/-   ##
=======================================
  Coverage   56.65%   56.65%           
=======================================
  Files         506      506           
  Lines       30192    30193    +1     
  Branches     4555     4555           
=======================================
+ Hits        17104    17105    +1     
  Misses      12266    12266           
  Partials      822      822           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justinchuby
Copy link
Member

Thank you!

@justinchuby justinchuby added this pull request to the merge queue Feb 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 2, 2024
@justinchuby justinchuby added this pull request to the merge queue Feb 2, 2024
Merged via the queue into onnx:main with commit 3d976ff Feb 2, 2024
linshokaku pushed a commit to linshokaku/onnx that referenced this pull request Oct 2, 2024
### Description
This removes the invocation of `convert_endian()` from
`numpy_helper.to_array()` in favor of another implementation, since
convert_endian() modifies the TensorProto.

### Motivation and Context
This change was needed due to observed issues when trying to load an
ONNX model that was exported on a s390x system via tf2onnx. Debugging
showed that the TeensorProto was being modified by endianness conversion
operations, which led to model incorrectness under certain
circumstances.

Fixes onnx#5901.

Signed-off-by: Tabari Alexander <tehbone@gmail.com>
Signed-off-by: Linsho Kaku <linsho@preferred.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

numpy_helper.to_array modifies TensorProto on big endian systems
2 participants