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: The function updates original input(X) and top-k token ids for the Causal/Masked LM.
  
  It mimics the caching mechanism to update the original input and topk token ids
  that are to be explained and which updates for every new row of explanation.
  
  Parameters
  ----------
  X: np.ndarray
      Input(Text) for an explanation row.
docstr_tok: ["The","function","updates","original","input","(","X",")","and","top-k","token","ids","for","the","Causal\/Masked","LM",".","It","mimics","the","caching","mechanism","to","update","the","original","input","and","topk","token","ids","that","are","to","be","explained","and","which","updates","for","every","new","row","of","explanation",".","Parameters","--","--","--","--","--","X",":","np.ndarray","Input","(","Text",")","for","an","explanation","row","."]
code: def update_cache_X(self, X):
      """The function updates original input(X) and top-k token ids for the Causal/Masked LM.
  
      It mimics the caching mechanism to update the original input and topk token ids
      that are to be explained and which updates for every new row of explanation.
  
      Parameters
      ----------
      X: np.ndarray
          Input(Text) for an explanation row.
      """
      # check if the source sentence has been updated (occurs when explaining a new row)
      if (self.X is None) or (not np.array_equal(self.X, X)):
          self.X = X
          self.output_names = (
              self.get_output_names_and_update_topk_token_ids(self.X)
          )
  
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 3 for calling the TopKLM obj's underlying member method code with example usage: obj.update_cache_X(X) without return types