class_docstr: Generates scores (log odds) for the top-k tokens for Causal/Masked LM.
      
class_docstr_tok: ["Generates","scores","(","log","odds",")","for","the","top-k","tokens","for","Causal\/Masked","LM","."]
docstr: Computes log odds scores for a given batch of masked inputs for the top-k tokens for Causal/Masked LM.
  
  Parameters
  ----------
  masked_X: numpy.ndarray
      An array containing a list of masked inputs.
  
  X: numpy.ndarray
      An array containing a list of original inputs
  
  Returns
  -------
  numpy.ndarray
      A numpy array of log odds scores for top-k tokens for every input pair (masked_X, X)
docstr_tok: ["Computes","log","odds","scores","for","a","given","batch","of","masked","inputs","for","the","top-k","tokens","for","Causal\/Masked","LM",".","Parameters","--","--","--","--","--","masked_X",":","numpy.ndarray","An","array","containing","a","list","of","masked","inputs",".","X",":","numpy.ndarray","An","array","containing","a","list","of","original","inputs","Returns","--","--","--","-","numpy.ndarray","A","numpy","array","of","log","odds","scores","for","top-k","tokens","for","every","input","pair","(","masked_X",",","X",")"]
code: def __call__(self, masked_X, X):
      """Computes log odds scores for a given batch of masked inputs for the top-k tokens for Causal/Masked LM.
  
      Parameters
      ----------
      masked_X: numpy.ndarray
          An array containing a list of masked inputs.
  
      X: numpy.ndarray
          An array containing a list of original inputs
  
      Returns
      -------
      numpy.ndarray
          A numpy array of log odds scores for top-k tokens for every input pair (masked_X, X)
      """
      output_batch = None
      self.update_cache_X(X[:1])
      start_batch_idx, end_batch_idx = 0, len(masked_X)
      while start_batch_idx < end_batch_idx:
          logits = self.get_lm_logits(
              masked_X[
                  start_batch_idx : start_batch_idx + self.batch_size
              ]
          )
          logodds = self.get_logodds(logits)
          if output_batch is None:
              output_batch = logodds
          else:
              output_batch = np.concatenate((output_batch, logodds))
          start_batch_idx += self.batch_size
      return output_batch
  
file_path: shap/shap/models/_topk_lm.py
imports: import numpy
  import scipy.special
  from .._serializable import Deserializer, Serializer
  from ..utils import safe_isinstance
  from ..utils.transformers import MODELS_FOR_CAUSAL_LM, getattr_silent
  from ._model import Model
label_desc: Use image node_id 2 for calling the TopKLM obj's underlying member method code with example usage: obj.__call__(masked_X, X) and returns: output_batch