class_docstr: Bijector which computes `Y = g(X) = values[X]`.
  
  Example Usage:
  
  ```python
  bijector = CategoricalToDiscrete(map_values=[0.01, 0.1, 1., 10.])
  bijector.forward([1, 3, 2, 1, 0]) = [1., 10., 1., 0.1, 0.01]
  bijector.inverse([1., 10., 1., 0.1, 0.01]) = [1, 3, 2, 1, 0]
  ```
class_docstr_tok: ["Bijector","which","computes","`","Y","=","g","(","X",")","=","values","[","X","]","`",".","Example","Usage",":","``","`","python","bijector","=","CategoricalToDiscrete","(","map_values=","[","0.01",",","0.1",",","1.",",","10",".","]",")","bijector.forward","(","[","1",",","3",",","2",",","1",",","0","]",")","=","[","1.",",","10.",",","1.",",","0.1",",","0.01","]","bijector.inverse","(","[","1.",",","10.",",","1.",",","0.1",",","0.01","]",")","=","[","1",",","3",",","2",",","1",",","0","]","``","`"]
code: def _inverse(self, y):
      map_values = tf.convert_to_tensor(self.map_values)
      flat_y = tf.reshape(y, shape=[-1])
      # Search for the indices of map_values that are closest to flat_y.
      # Since map_values is strictly increasing, the closest is either the
      # first one that is strictly greater than flat_y, or the one before it.
      upper_candidates = tf.minimum(
          tf.size(map_values) - 1,
          tf.searchsorted(map_values, values=flat_y, side="right"),
      )
      lower_candidates = tf.maximum(0, upper_candidates - 1)
      candidates = tf.stack(
          [lower_candidates, upper_candidates], axis=-1
      )
      lower_cand_diff = tf.abs(flat_y - self._forward(lower_candidates))
      upper_cand_diff = tf.abs(flat_y - self._forward(upper_candidates))
      if self.validate_args:
          with tf.control_dependencies(
              [
                  assert_util.assert_near(
                      tf.minimum(lower_cand_diff, upper_cand_diff),
                      0,
                      message="inverse value not found",
                  )
              ]
          ):
              candidates = tf.identity(candidates)
      candidate_selector = tf.stack(
          [
              tf.range(tf.size(flat_y), dtype=tf.int32),
              tf.argmin(
                  [lower_cand_diff, upper_cand_diff],
                  output_type=tf.int32,
              ),
          ],
          axis=-1,
      )
      return tf.reshape(
          tf.gather_nd(candidates, candidate_selector), shape=y.shape
      )
  
file_path: probability/tensorflow_probability/python/bijectors/categorical_to_discrete.py
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.internal import assert_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import parameter_properties
  from tensorflow_probability.python.internal import tensor_util
  from tensorflow_probability.python.internal import tensorshape_util
label_desc: Use image node_id 4 for calling the CategoricalToDiscrete obj's underlying member method code with example usage: obj._inverse(y) and returns: tf