class_docstr: Wrapper model implementing the full NCP clustering algorithm.
  
  This class wraps an instantiated NCP model and performs the full NCP
  clustering algorithm, which sequentially assigns cluster labels to N input
  data points by N forward passes through the NCP model.
  
  Attributes:
    ncp_model: A `NCPBase` model instance.
    sampler: A sampler class with a `sample(logits)` function for posterior
      sampling of cluster labels at inference time, or set to `None` for
      training. The `sample(logits)` function should take as input a float
      tensor of shape `[batch_size, num_clusters]` and return an int tensor of
      shape `[batch_size]` representing the sampled cluster IDs.
docstr: The negative log likelihood (NLL) loss function.
  
  Arguments:
    logits: A `Tensor` of shape `[batch_size, num_points]` representing the
      log likelihoods of the assigned clusters for each point.
  
  Returns:
    A scalar `Tensor`. The NLL loss.
docstr_tok: ["The","negative","log","likelihood","(","NLL",")","loss","function",".","Arguments",":","logits",":","A","`","Tensor","`","of","shape","`","[","batch_size",",","num_points","]","`","representing","the","log","likelihoods","of","the","assigned","clusters","for","each","point",".","Returns",":","A","scalar","`","Tensor","`",".","The","NLL","loss","."]
code: def loss_function(self, logits):
      """The negative log likelihood (NLL) loss function.
  
      Arguments:
        logits: A `Tensor` of shape `[batch_size, num_points]` representing the
          log likelihoods of the assigned clusters for each point.
  
      Returns:
        A scalar `Tensor`. The NLL loss.
      """
      batch_avg_logits = tf.reduce_mean(logits, axis=0)
      nll_loss = -tf.reduce_sum(batch_avg_logits)
      return nll_loss
  
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 3 for calling the NCPWrapper obj's underlying member method code with example usage: obj.loss_function(logits) and returns: nll_loss