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

different behavior of rel_entr #21192

Open
sh0416 opened this issue May 12, 2024 · 0 comments
Open

different behavior of rel_entr #21192

sh0416 opened this issue May 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@sh0416
Copy link
Contributor

sh0416 commented May 12, 2024

Description

import jax
import jax.numpy as jnp
from scipy.special import rel_entr

p = jnp.array([0.7, 0.3, 0.0, 0.0])
q = jnp.array([0.0, 0.3, 0.7, 0.0])
print(jax.scipy.special.rel_entr(p, q))
p = np.asarray(p)
q = np.asarray(q)
print(rel_entr(p, q))

shows

[       inf 0.00000000 0.69999999 0.00000000]  # jax result
[       inf 0.00000000 0.00000000 0.00000000]  # scipy result

System info (python version, jaxlib version, accelerator, etc.)

jax:    0.4.25
jaxlib: 0.4.25
numpy:  1.26.4
python: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0]
jax.devices (1 total, 1 local): [cuda(id=0)]
process_count: 1
platform: uname_result(system='Linux', node='gpusystem', release='5.15.0-100-generic', version='#110-Ubuntu SMP Wed Feb 7 13:27:48 UTC 2024', machine='x86_64')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants