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

fix np_uniform_impl3 for handling size=() #8997

Closed
wants to merge 2 commits into from

Conversation

masaaldosey
Copy link

Closes #8975.

Simply added this suggestion by @kc611.

@masaaldosey masaaldosey changed the title [WIP] fix np_uniform_impl3 for handling size=() fix np_uniform_impl3 for handling size=() Jun 1, 2023
@kc611
Copy link
Collaborator

kc611 commented Jun 1, 2023

Thank you @masaaldosey for your contributions, could you please also add the original example in the issue (#8975 (comment)) as a test?

The tests for the uniform distribution in the old random number generator API are present at:

def test_random_uniform(self):
self._check_uniform(jit_binary("random.uniform"), get_py_state_ptr())
def test_numpy_uniform(self):
self._check_uniform(jit_binary("np.random.uniform"), get_np_state_ptr())
def test_numpy_uniform_kwargs(self):
self._check_any_distrib_kwargs(
jit_with_kwargs("np.random.uniform", ['low', 'high']),
get_np_state_ptr(),
'uniform',
paramlist=[{'low': 1.5, 'high': 1e6},
{'low': -2.5, 'high': 1e3},
{'low': 1.5, 'high': -2.5}])

Nice username btw 😄

@kc611 kc611 added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Jun 1, 2023
@kc611 kc611 self-assigned this Jun 1, 2023
Copy link
Collaborator

@kc611 kc611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested as per above comment. (#8997 (comment))

@masaaldosey
Copy link
Author

@kc611 haha! thank you! have added the test. please let me know if more changes are needed 😸

@masaaldosey masaaldosey requested a review from kc611 June 2, 2023 11:23
jit_with_kwargs("np.random.uniform", ['low', 'high', 'size']),
get_np_state_ptr(),
'uniform',
paramlist=[{'low' : 0.0, 'high' : 1.0, 'size': None}])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size needs to check for () and not None.

Suggested change
paramlist=[{'low' : 0.0, 'high' : 1.0, 'size': None}])
paramlist=[{'low' : 0.0, 'high' : 1.0, 'size': ()}])

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kc611! I applied the suggestion and ran the test locally. The test fails because of dtype mismatch (see attached screenshot). I think I need to fiddle around with this method. But I am not sure. Could you help me with this?

image

@github-actions
Copy link

github-actions bot commented Sep 6, 2023

This pull request is marked as stale as it has had no activity in the past 3 months. Please respond to this comment if you're still interested in working on this. Many thanks!

@github-actions github-actions bot added the stale Marker label for stale issues. label Sep 6, 2023
@github-actions github-actions bot added the abandoned - stale PRs automatically closed due to stale status label Sep 13, 2023
@github-actions github-actions bot closed this Sep 13, 2023
Kamakshi8104 added a commit to Kamakshi8104/numba that referenced this pull request Jan 9, 2024
Kamakshi8104 added a commit to Kamakshi8104/numba that referenced this pull request Jan 9, 2024
Kamakshi8104 added a commit to Kamakshi8104/numba that referenced this pull request Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - Waiting on author Waiting for author to respond to review abandoned - stale PRs automatically closed due to stale status stale Marker label for stale issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numba RandomState overload fails with empty size
3 participants