def test_not_nan(self, num_centroids: int, tau: int, magnitude: float):
    """Check that we don't get Inf."""

    def compute_ll(key: chex.PRNGKey) -> float:
      num_obs = jax.random.poisson(key, 1, [num_centroids])
      nu = num_obs / jnp.sum(num_obs)

      q_hat = jnp.ones([num_centroids, tau]) * (10 ** magnitude)
      q_hat += jnp.expand_dims(nu == 0, 1).astype(jnp.float32)
      q_hat = jnp.clip(q_hat, 0, 1)

      return utils.log_sum_prod(nu, q_hat)

    keys = jax.random.split(jax.random.PRNGKey(0), 10)
    log_likelihoods = jax.jit(jax.vmap(compute_ll))(keys)
    assert jnp.all(jnp.isfinite(log_likelihoods))