Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A small fix for Python 3.12 compatibility #813

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading