Skip to content

Nans in JAX multinomial dispatch #1327

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

Closed
ricardoV94 opened this issue Mar 28, 2025 · 3 comments · Fixed by #1328
Closed

Nans in JAX multinomial dispatch #1327

ricardoV94 opened this issue Mar 28, 2025 · 3 comments · Fixed by #1328
Labels
bug Something isn't working jax random variables

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Mar 28, 2025

Description

PyMC tests are failing: pymc-devs/pymc#7740

Reproducible example:

import pytensor.tensor as pt

p = pt.eye(3)
rv = pt.random.multinomial(n=5, p=p)
rv.eval(mode="JAX")
# Array([[ 5., nan, nan],
#        [ 0.,  5.,  0.],
#        [ 0.,  0.,  5.]], dtype=float64)

I guess it could be a problem with binomial with p=0?

CC @educhesne

@educhesne
Copy link
Contributor

I am very sorry about this... I think there is a division by zero happening here

@educhesne
Copy link
Contributor

Do you know why it was not caught by the tests in the PR ?

@ricardoV94
Copy link
Member Author

I guess we were not testing edge cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jax random variables
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants