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

[backport] Fix slow test #8117

Merged
merged 1 commit into from
Jan 17, 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
Merge pull request #8115 from kmaehashi/fix-generator-api-slow
Fix slow test
  • Loading branch information
emcastillo authored and chainer-ci committed Jan 17, 2024
commit 0ae702d7443349da6f3e459f9310f6ba6fa79a56
7 changes: 4 additions & 3 deletions cupy/random/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 50,10 @@ def __getattr__(key):
# users use the class for type annotation.
if key == 'Generator':
# Lazy import libraries depending on cuRAND
import cupy.random._generator_api as _generator_api
_cupy.random.Generator = _generator_api.Generator
return _generator_api.Generator
import cupy.random._generator_api
Generator = cupy.random._generator_api.Generator
_cupy.random.Generator = Generator
return Generator
raise AttributeError(f"module '{__name__}' has no attribute '{key}'")


Expand Down
2 changes: 1 addition & 1 deletion tests/cupy_tests/random_tests/test_generator_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 22,7 @@ class GeneratorTestCase(common_distributions.BaseGeneratorTestCase):

def get_rng(self, xp, seed):
if xp is cupy:
return cupy.random._generator_api.Generator(
return cupy.random.Generator(
random._bit_generator.Philox4x3210(seed=seed))
else:
return numpy.random.Generator(numpy.random.MT19937(seed))
Expand Down