Skip to content

Commit

Permalink
A small fix for Python 3.12 compatibility
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705909143
  • Loading branch information
tensorflower-gardener committed Dec 13, 2024
1 parent f786954 commit 6f44991
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tf_keras/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ def _create_seed(self, user_specified_seed):
if user_specified_seed is not None:
return user_specified_seed
elif getattr(_SEED_GENERATOR, "generator", None):
return _SEED_GENERATOR.generator.randint(1, 1e9)
return _SEED_GENERATOR.generator.randint(1, int(1e9))
else:
return random.randint(1, int(1e9))

Expand Down
4 changes: 2 additions & 2 deletions tf_keras/utils/tf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def get_random_seed():
the random seed as an integer.
"""
if getattr(backend._SEED_GENERATOR, "generator", None):
return backend._SEED_GENERATOR.generator.randint(1, 1e9)
return backend._SEED_GENERATOR.generator.randint(1, int(1e9))
else:
return random.randint(1, 1e9)
return random.randint(1, int(1e9))


def is_tensor_or_tensor_list(v):
Expand Down

0 comments on commit 6f44991

Please sign in to comment.