code: def categorical(
      logits, num_samples, dtype=None, seed=None, name=None
  ):
      """Draws samples from a categorical distribution.
  
      Example:
  
      ```python
      # samples has shape [1, 5], where each value is either 0 or 1 with equal
      # probability.
      samples = tf.random.categorical(tf.math.log([[0.5, 0.5]]), 5)
      ```
  
      Args:
        logits: 2-D Tensor with shape `[batch_size, num_classes]`.  Each slice
          `[i, :]` represents the unnormalized log-probabilities for all classes.
        num_samples: 0-D.  Number of independent samples to draw for each row slice.
        dtype: The integer type of the output: `int32` or `int64`. Defaults to
          `int64`.
        seed: A Python integer. Used to create a random seed for the distribution.
          See `tf.random.set_seed` for behavior.
        name: Optional name for the operation.
  
      Returns:
        The drawn samples of shape `[batch_size, num_samples]`.
      """
      with ops.name_scope(name, "categorical", [logits]):
          return multinomial_categorical_impl(
              logits, num_samples, dtype, seed
          )
  
imports: import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_random_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import shape_util
  from tensorflow.python.ops.gen_random_ops import *
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import dispatch
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 7 for calling a global function with example usage: categorical(logits, num_samples, dtype, seed, name) and returns: multinomial_categorical_impl