Skip to content

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
@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