class_docstr: The :class:`.ClassAppearanceModel` callback implements Figure 1 from
  `Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps <https://arxiv.org/abs/1312.6034>`_.
  This is a simple gradient ascent on an image (initialised to zero) with a sum-squares regularizer. Internally this
  creates a new :class:`.Trial` instance which then performs the optimization.
  
  Args:
      nclasses (int): The number of output classes
      input_size (tuple): The size to use for the input image
      optimizer_factory: A function of parameters which returns an optimizer to use
      logit_key (StateKey): :class:`.StateKey` storing the class logits
      target (int): Target class for the optimisation or RANDOM
      steps (int): Number of optimisation steps to take
      decay (float): Lambda for the L2 decay on the image
      verbose (int): Verbosity level to pass to the internal :class:`.Trial` instance
      transform (callable, optional): A function/transform that  takes in a Tensor and returns a transformed version.
          This will be applied to the image before it is sent to output
class_docstr_tok: ["The",":","class",":","`",".ClassAppearanceModel","`","callback","implements","Figure","1","from","`","Deep","Inside","Convolutional","Networks",":","Visualising","Image","Classification","Models","and","Saliency","Maps","<","https",":","\/\/arxiv.org\/abs\/1312.6034",">","`","_",".","This","is","a","simple","gradient","ascent","on","an","image","(","initialised","to","zero",")","with","a","sum-squares","regularizer",".","Internally","this","creates","a","new",":","class",":","`",".Trial","`","instance","which","then","performs","the","optimization",".","Args",":","nclasses","(","int",")",":","The","number","of","output","classes","input_size","(","tuple",")",":","The","size","to","use","for","the","input","image","optimizer_factory",":","A","function","of","parameters","which","returns","an","optimizer","to","use","logit_key","(","StateKey",")",":",":","class",":","`",".StateKey","`","storing","the","class","logits","target","(","int",")",":","Target","class","for","the","optimisation","or","RANDOM","steps","(","int",")",":","Number","of","optimisation","steps","to","take","decay","(","float",")",":","Lambda","for","the","L2","decay","on","the","image","verbose","(","int",")",":","Verbosity","level","to","pass","to","the","internal",":","class",":","`",".Trial","`","instance","transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","a","Tensor","and","returns","a","transformed","version",".","This","will","be","applied","to","the","image","before","it","is","sent","to","output"]
code: def __init__(
      self,
      nclasses,
      input_size,
      optimizer_factory=lambda params: optim.Adam(params, lr=0.5),
      steps=256,
      logit_key=torchbearer.PREDICTION,
      target=RANDOM,
      decay=0.01,
      verbose=0,
      in_transform=None,
      transform=None,
  ):
      super(ClassAppearanceModel, self).__init__(transform=transform)
  
      self.nclasses = nclasses
      self.input_size = input_size
      self.optimizer_factory = optimizer_factory
      self.logit_key = logit_key
      self.target = target
      self.steps = steps
      self.decay = decay
      self.verbose = verbose
      self.in_transform = in_transform
  
      self._target_keys = []
  
file_path: torchbearer/torchbearer/callbacks/imaging/inside_cnns.py
imports: import torch
  import torch.nn
  import torch.optim
  import torchbearer
  from torchbearer.callbacks.decorators import once_per_epoch
  from .None import imaging
label_desc: Use image node_id 1 to create a new ClassAppearanceModel object from inherited base classes: imaging with example: obj = ClassAppearanceModel(nclasses, input_size, optimizer_factory, steps, logit_key, target, decay, verbose, in_transform, transform)