import tensorflow as tf

        qdist = distributions.QuantizedDistribution(
            base_dist_cls=distributions.Normal,
            mu=mu,
            sigma=sigma)
        x = np.arange(-100, 100, 2).astype(dtype)

        tf.initialize_all_variables().run()

        proba = qdist.log_prob(x)
        grads = tf.gradients(proba, [mu, sigma])

        self._assert_all_finite(proba.eval())
        self._assert_all_finite(grads[0].eval())
        self._assert_all_finite(grads[1].eval())

  def test_prob_and_grad_gives_finite_results_for_common_events(self):
    with self.test_session():
      mu = tf.Variable(0.0, name="mu")
