Skip to content

Commit

Permalink
auto-inferred dtype should be int64 when value exceeds int32 range
Browse files Browse the repository at this point in the history
  • Loading branch information
wrongtest-intellif committed Aug 24, 2022
1 parent 8360984 commit f1719af
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/tvm/runtime/object_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ def _scalar_type_inference(value):
# We intentionally convert the float to float32 since it's more common in DL.
dtype = "float32"
elif isinstance(value, int):
# We intentionally convert the python int to int32 since it's more common in DL.
dtype = "int32"
# We intentionally prefer convert the python int to int32 since it's more common in DL.
if -2147483648 <= value and value < 2147483648:
dtype = "int32"
else:
dtype = "int64"
else:
raise NotImplementedError(
"Cannot automatically inference the type." " value={}".format(value)
Expand Down

0 comments on commit f1719af

Please sign in to comment.