code: def categorical(logits, num_samples, dtype="int64", seed=None):
      seed = draw_seed(seed)
      rng = np.random.default_rng(seed)
      output = []
      for logits_instance in logits:
          probabilities = softmax(logits_instance)
          classes = np.arange(logits_instance.shape[-1])
          samples = rng.choice(
              classes, size=num_samples, p=probabilities
          )
          output.append(samples)
      return np.array(output).astype(dtype)
  
file_path: keras/keras/backend/numpy/random.py
imports: import numpy
  from keras.backend.config import floatx
  from keras.backend.numpy.nn import softmax
  from keras.random.seed_generator import SeedGenerator
  from keras.random.seed_generator import draw_seed
  from keras.random.seed_generator import make_default_seed
label_desc: Use image node_id 3 for calling a global function with example usage: categorical(logits, num_samples, dtype, seed) and returns: np