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","."]
docstr: Cache images **before** they are passed to handlers. Once per epoch, a single cache will be returned,
  containing the first `num_images` to be returned.
  
  Args:
      num_images (int): The number of images to cache
  
  Returns:
      ImagingCallback: self
docstr_tok: ["Cache","images","*","*","before","*","*","they","are","passed","to","handlers",".","Once","per","epoch",",","a","single","cache","will","be","returned",",","containing","the","first","`","num_images","`","to","be","returned",".","Args",":","num_images","(","int",")",":","The","number","of","images","to","cache","Returns",":","ImagingCallback",":","self"]
code: def cache(self, num_images):
      """Cache images **before** they are passed to handlers. Once per epoch, a single cache will be returned,
      containing the first `num_images` to be returned.
  
      Args:
          num_images (int): The number of images to cache
  
      Returns:
          ImagingCallback: self
      """
      self.on_batch = _cache_images(num_images)(self.on_batch)
      return self
  
imports: import torchbearer
  from torchbearer import Callback
  import torch
label_desc: Use image node_id 13 for calling the ImagingCallback obj's underlying member method code with example usage: obj.cache(num_images) and returns: self