class_docstr: The :class:`ImagingCallback` provides a generic interface for callbacks which yield images that should be sent to
  a file, tensorboard, visdom etc. without needing bespoke code. This allows the user to easily define custom
  visualisations by only writing the code to produce the image.
  
  Args:
      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",":","`","ImagingCallback","`","provides","a","generic","interface","for","callbacks","which","yield","images","that","should","be","sent","to","a","file",",","tensorboard",",","visdom","etc",".","without","needing","bespoke","code",".","This","allows","the","user","to","easily","define","custom","visualisations","by","only","writing","the","code","to","produce","the","image",".","Args",":","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 process(self, state):
      img = self.on_batch(state)
      if img is not None:
          img = self.transform(img)
          for handler, index in self._handlers:
              if img.dim() == 3:
                  img = img.unsqueeze(0)
              rng = range(img.size(0)) if index is None else index
              try:
                  for i in rng:
                      handler(img[i], i, state)
              except TypeError:
                  handler(img[rng], rng, state)
  
imports: import torchbearer
  from torchbearer import Callback
  import torch
label_desc: Use image node_id 3 for calling the ImagingCallback obj's underlying member method code with example usage: obj.process(state) without return types