[TVMJS] Check DataType.NUMPY2STR when saving array #17174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, the
dtype
string used bytvmjs.dump_ndarray_cache
was generated asstr(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 checkDataType.NUMPY2STR
for the datatype string, allowing round-trip save/load of float8 arrays.