Skip to content

Commit

Permalink
Use jnp.where for Delta.log_prob (cf. jax-ml/jax#25935).
Browse files Browse the repository at this point in the history
  • Loading branch information
tillahoffmann committed Jan 16, 2025
1 parent 986da95 commit 8d766bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion numpyro/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ def sample(self, key, sample_shape=()):

@validate_sample
def log_prob(self, value):
log_prob = jnp.log(value == self.v)
log_prob = jnp.where(value == self.v, 0, -jnp.inf)
log_prob = sum_rightmost(log_prob, len(self.event_shape))
return log_prob + self.log_density

Expand Down

0 comments on commit 8d766bf

Please sign in to comment.