-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[runtime][python] Add IRPA entry conversion to/from numpy (#19492)
Add iterop between numpy ndarray and parameter index. This is an adaptation of the original in IREE Turbine https://github.com/iree-org/iree-turbine/blob/142c8a5044a4fedb43a11229f462363b05743b23/iree/turbine/aot/params.py The goal is to maintain compatibility with IRPA files that were already generated with IREE Turbine. At some point we can refactor the IREE Turbine side to use this implementation. Signed-off-by: Boian Petkantchin <[email protected]>
- Loading branch information
Showing
5 changed files
with
214 additions
and
5 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
7 changes: 7 additions & 0 deletions
7
runtime/bindings/python/tests/testdata/generate_tensor_saved_with_iree_turbine.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from iree.turbine.aot import ParameterArchiveBuilder | ||
import torch | ||
|
||
archive = ParameterArchiveBuilder() | ||
tensor = torch.tensor([1, 2, 3, 4], dtype=torch.uint8) | ||
archive.add_tensor("the_torch_tensor", tensor) | ||
archive.save("tensor_saved_with_iree_turbine.irpa") |
Binary file added
BIN
+4 KB
runtime/bindings/python/tests/testdata/tensor_saved_with_iree_turbine.irpa
Binary file not shown.