class_docstr: Subclasses AttributionPriorExplainer to avoid pre-specified batch size. Will adapt batch
  size based on shape of input tensor.
docstr: Arguments:
  base_model: PyTorch network
  input_tensor: PyTorch tensor to get attributions for, as in normal torch.nn.Module API
  sparse_labels:  np.array of sparse integer labels, i.e. 0-9 for MNIST. Used if you only
      want to explain the prediction for the true class per sample.
  k: int - Number of references to use default for explanations. As low as 1 for training.
      100-200 for reliable explanations. 
docstr_tok: ["Arguments",":","base_model",":","PyTorch","network","input_tensor",":","PyTorch","tensor","to","get","attributions","for",",","as","in","normal","torch.nn.Module","API","sparse_labels",":","np.array","of","sparse","integer","labels",",","i.e",".","0-9","for","MNIST",".","Used","if","you","only","want","to","explain","the","prediction","for","the","true","class","per","sample",".","k",":","int","-","Number","of","references","to","use","default","for","explanations",".","As","low","as","1","for","training",".","100-200","for","reliable","explanations","."]
code: def shap_values(self, model, input_tensor, sparse_labels=None, k=1):
      """
      Arguments:
      base_model: PyTorch network
      input_tensor: PyTorch tensor to get attributions for, as in normal torch.nn.Module API
      sparse_labels:  np.array of sparse integer labels, i.e. 0-9 for MNIST. Used if you only
          want to explain the prediction for the true class per sample.
      k: int - Number of references to use default for explanations. As low as 1 for training.
          100-200 for reliable explanations.
      """
      self.k = k
      n_input = input_tensor.shape[0]
      refs_needed = n_input * self.k
      # This is a reasonable check but prevents compatibility with non-Map datasets
      assert refs_needed <= len(
          self.ref_set
      ), "Can't have more samples*references than there are reference points!"
      reference_tensor = self._get_ref_batch(refs_needed)
      shape = reference_tensor.shape
      reference_tensor = reference_tensor.view(
          n_input, self.k, *(shape[1:])
      ).to(DEFAULT_DEVICE)
      samples_input = self._get_samples_input(
          input_tensor, reference_tensor
      )
      samples_delta = self._get_samples_delta(
          input_tensor, reference_tensor
      )
      grad_tensor = self._get_grads(samples_input, model, sparse_labels)
      mult_grads = (
          samples_delta * grad_tensor
          if self.scale_by_inputs
          else grad_tensor
      )
      expected_grads = mult_grads.mean(1)
  
      return expected_grads
  
imports: import functools
  import operator
  import torch
  from torch.autograd import grad
  from torch.utils.data import DataLoader
label_desc: Use image node_id 3 for calling the VariableBatchExplainer obj's underlying member method code with example usage: obj.shap_values(model, input_tensor, sparse_labels, k) and returns: expected_grads