-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IR] Allow tensor created with numpy unsupported dtypes (#1441)
Support all ONNX types in `ir.Tensor` and fix re-serialization of tensor protos that does not use the `raw_data` field to store data. Previously the *_data to raw_data conversion was incorrect when the data type size doesn't match the *_data type size. For numpy unsupported dtypes, the array is represented as the unsigned int type of the same size as the dtype. For example, uint8 for float8, uint16 for bfloat16; with an exception for 4bit types. This PR creates a more performant and robust method to convert tensor proto to numpy array than `onnx.numpy_helper.to_array`. We will upstream the implementation in the future. Additionally - Consolidate all tensorproto classes to the TensorProtoTensor class Tested: unit tests
- Loading branch information
1 parent
84170f7
commit bca6a64
Showing
10 changed files
with
699 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.