Skip to content

Commit

Permalink
updated the condition if dtype is int32
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarvesh-Kesharwani committed Dec 24, 2022
1 parent 17f1e40 commit 3fb2931
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tensorflow/python/framework/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,10 +1597,10 @@ def convert_to_tensor(value,
if isinstance(value, Tensor):
if dtype is not None:
#checking for integer overflow
if (abs(value) > (1 << 31) - 1):
if (dtype == dtypes.int32) and (abs(value) > (1 << 31) - 1):
raise RuntimeError(
_add_error_prefix(
"integer overflow for dtype int32",
f"input value exceeds int32 dtype limit",
name=name))
if not dtype.is_compatible_with(value.dtype):
raise ValueError(
Expand Down

0 comments on commit 3fb2931

Please sign in to comment.