class_docstr: Subclasses AttributionPriorExplainer to avoid pre-specified batch size. Will adapt batch
  size based on shape of input tensor.
docstr: Arguments:
  background_dataset: PyTorch dataset - may not work with iterable-type (vs map-type) datasets
  random_alpha: boolean - Whether references should be interpolated randomly (True, corresponds
      to Expected Gradients) or on a uniform grid (False - corresponds to Integrated Gradients)
docstr_tok: ["Arguments",":","background_dataset",":","PyTorch","dataset","-","may","not","work","with","iterable-type","(","vs","map-type",")","datasets","random_alpha",":","boolean","-","Whether","references","should","be","interpolated","randomly","(","True",",","corresponds","to","Expected","Gradients",")","or","on","a","uniform","grid","(","False","-","corresponds","to","Integrated","Gradients",")"]
code: def __init__(
      self, background_dataset, random_alpha=True, scale_by_inputs=True
  ):
      """
      Arguments:
      background_dataset: PyTorch dataset - may not work with iterable-type (vs map-type) datasets
      random_alpha: boolean - Whether references should be interpolated randomly (True, corresponds
          to Expected Gradients) or on a uniform grid (False - corresponds to Integrated Gradients)
      """
      self.random_alpha = random_alpha
      self.k = None
      self.scale_by_inputs = scale_by_inputs
      self.ref_set = background_dataset
      self.ref_sampler = DataLoader(
          dataset=background_dataset,
          batch_size=1,
          shuffle=True,
          drop_last=True,
      )
      self.refs_needed = -1
      return
  
imports: import functools
  import operator
  import torch
  from torch.autograd import grad
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 to create a new VariableBatchExplainer object from inherited base classes: AttributionPriorExplainer with example: obj = VariableBatchExplainer(background_dataset, random_alpha, scale_by_inputs)