forked from pyro-ppl/numpyro
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): use version-specific PRNGKey seeds for improved test reli…
…ability
- Loading branch information
Showing
3 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright Contributors to the Pyro project. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
import sys | ||
|
||
|
||
def get_python_version_specific_seed( | ||
seed_for_py_3_9: int, seed_not_for_py_3_9: int | ||
) -> int: | ||
"""After release of `jax==0.5.0`, we need different seeds for tests in Python 3.9 | ||
and other versions. This function returns the seed based on the Python version. | ||
:param seed_for_py_3_9: Seed for Python 3.9 | ||
:param seed_not_for_py_3_9: Seed for other versions of Python | ||
:return: Seed based on the Python version | ||
""" | ||
if sys.version_info.minor == 9: | ||
return seed_for_py_3_9 | ||
else: | ||
return seed_not_for_py_3_9 |