Skip to content
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

[TVMJS] Check DataType.NUMPY2STR when saving array #17174

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, the dtype string used by tvmjs.dump_ndarray_cache was generated as str(np_array.dtype). While this works in most cases, there are a few naming differences between TVM datatypes and numpy datatypes, such as "float8_e4m3fn" in Numpy being equivalent to "e4m3_float8" in TVM.

This commit updates dump_ndarray_cache to check DataType.NUMPY2STR for the datatype string, allowing round-trip save/load of float8 arrays.

Prior to this commit, the `dtype` string used by
`tvmjs.dump_ndarray_cache` was generated as `str(np_array.dtype)`.
While this works in most cases, there are a few naming differences
between TVM datatypes and numpy datatypes, such as `"float8_e4m3fn"`
in Numpy being equivalent to `"e4m3_float8"` in TVM.

This commit updates `dump_ndarray_cache` to check `DataType.NUMPY2STR`
for the datatype string, allowing round-trip save/load of float8
arrays.
@Lunderberg Lunderberg merged commit 070546e into apache:main Jul 18, 2024
19 checks passed
@Lunderberg Lunderberg deleted the tvmjs_check_datatype_numpy2str branch July 18, 2024 21:12
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.

2 participants