class_docstr: Random sampler using the categorical (multinomial) distribution.
docstr: Samples cluster IDs using the categorical (multinomial) distribution.
  
  Arguments:
    logits: A float tensor of shape `[batch_size, num_clusters]` representing
      a batch of log likelihoods for all possible clusters.
  
  Returns:
    An int tensor of shape `[batch_size]`, the sampled cluster IDs.
docstr_tok: ["Samples","cluster","IDs","using","the","categorical","(","multinomial",")","distribution",".","Arguments",":","logits",":","A","float","tensor","of","shape","`","[","batch_size",",","num_clusters","]","`","representing","a","batch","of","log","likelihoods","for","all","possible","clusters",".","Returns",":","An","int","tensor","of","shape","`","[","batch_size","]","`",",","the","sampled","cluster","IDs","."]
code: def sample(self, logits):
      """Samples cluster IDs using the categorical (multinomial) distribution.
  
      Arguments:
        logits: A float tensor of shape `[batch_size, num_clusters]` representing
          a batch of log likelihoods for all possible clusters.
  
      Returns:
        An int tensor of shape `[batch_size]`, the sampled cluster IDs.
      """
      return tf.random.categorical(logits, 1, dtype=tf.int32)[:, 0]
  
file_path: neural-structured-learning/research/neural_clustering/models/ncp_wrapper.py
imports: from neural_clustering.utils.data_utils import batch_remap_label_ids
  import tensorflow
label_desc: Use image node_id 1 for calling the CategoricalSampler obj's underlying member method code with example usage: obj.sample(logits) and returns: tf