docstr: Test that dynamically-sized events with unknown shape work.
docstr_tok: ["Test","that","dynamically-sized","events","with","unknown","shape","work","."]
code: def testCDFWithDynamicEventShapeKnownNdims(self):
      """Test that dynamically-sized events with unknown shape work."""
      batch_size = 2
      make_ph = tf1.placeholder_with_default
      histograms = lambda h: make_ph(
          np.float32(h), shape=(batch_size, None)
      )
      event = lambda e: make_ph(np.float32(e), shape=(batch_size,))
      dist = lambda h: categorical.Categorical(  # pylint: disable=g-long-lambda
          probs=histograms(h), validate_args=True
      )
      cdf_op = lambda h, e: dist(h).cdf(event(e))
  
      # Feed values in with different shapes...
      # three classes.
      event_feed_one = [0, 1]
      histograms_feed_one = [[0.5, 0.3, 0.2], [1.0, 0.0, 0.0]]
      expected_cdf_one = [0.5, 1.0]
  
      # six classes.
      event_feed_two = [2, 5]
      histograms_feed_two = [
          [0.9, 0.0, 0.0, 0.0, 0.0, 0.1],
          [0.15, 0.2, 0.05, 0.35, 0.13, 0.12],
      ]
      expected_cdf_two = [0.9, 1.0]
  
      actual_cdf_one = self.evaluate(
          cdf_op(histograms_feed_one, event_feed_one)
      )
      actual_cdf_two = self.evaluate(
          cdf_op(histograms_feed_two, event_feed_two)
      )
  
      self.assertAllClose(expected_cdf_one, actual_cdf_one)
      self.assertAllClose(expected_cdf_two, actual_cdf_two)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.util import deferred_tensor
label_desc: Use image node_id 8 for calling the CategoricalTest obj's underlying member method code with example usage: obj.testCDFWithDynamicEventShapeKnownNdims() without return types