code: def testSamplesAgreeWithCdfForSamplesOverLargeRange(self):
      # Consider the cdf for distribution X, F(x).
      # If U ~ Uniform[0, 1], then Y := F^{-1}(U) is distributed like X since
      # P[Y <= y] = P[F^{-1}(U) <= y] = P[U <= F(y)] = F(y).
      # If F is a bijection, we also have Z = F(X) is Uniform.
      #
      # Make an exponential with large mean (= 100).  This ensures we will get
      # quantized values over a large range.  This large range allows us to
      # pretend that the cdf F is a bijection, and hence F(X) is uniform.
      # Note that F cannot be bijection since it is constant between the
      # integers.  Hence, F(X) (see below) will not be uniform exactly.
      qdist = qd.QuantizedDistribution(
          distribution=exponential.Exponential(rate=0.01),
          validate_args=True,
      )
      # X ~ QuantizedExponential
      x = qdist.sample(10000, seed=test_util.test_seed())
      # Z = F(X), should be Uniform.
      z = qdist.cdf(x)
      # Compare the CDF of Z to that of a Uniform.
      # dist = maximum distance between P[Z <= a] and P[U <= a].
      # We ignore pvalue, since of course this distribution is not exactly, and
      # with so many sample points we would get a false fail.
      dist, _ = stats.kstest(self.evaluate(z), "uniform")
  
      # Since the distribution take values (approximately) in [0, 100], the
      # cdf should have jumps (approximately) every 1/100 of the way up.
      # Assert that the jumps are not more than 2/100.
      self.assertLess(dist, 0.02)
  
imports: import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import exponential
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import quantized_distribution
  from tensorflow_probability.python.distributions import uniform
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 5 for calling the QuantizedDistributionTest obj's underlying member method code with example usage: obj.testSamplesAgreeWithCdfForSamplesOverLargeRange() without return types