class_docstr: The :class:`CachingImagingCallback` is an :class:`ImagingCallback` which caches batches of images from the given
  state key up to the required amount before passing this along with state to the implementing class, once per epoch.
  
  Args:
      key (StateKey): The :class:`.StateKey` containing image data (tensor of size [b, c, w, h])
      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.
      num_images: The number of images to cache
class_docstr_tok: ["The",":","class",":","`","CachingImagingCallback","`","is","an",":","class",":","`","ImagingCallback","`","which","caches","batches","of","images","from","the","given","state","key","up","to","the","required","amount","before","passing","this","along","with","state","to","the","implementing","class",",","once","per","epoch",".","Args",":","key","(","StateKey",")",":","The",":","class",":","`",".StateKey","`","containing","image","data","(","tensor","of","size","[","b",",","c",",","w",",","h","]",")","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",".","num_images",":","The","number","of","images","to","cache"]
docstr: This method should be implemented by the overriding class to return an image from the cache.
  
  Args:
      cache (tensor): The collected cache of size (num_images, C, W, H)
      state (dict): The trial state dict
  
  Returns:
      The processed image
docstr_tok: ["This","method","should","be","implemented","by","the","overriding","class","to","return","an","image","from","the","cache",".","Args",":","cache","(","tensor",")",":","The","collected","cache","of","size","(","num_images",",","C",",","W",",","H",")","state","(","dict",")",":","The","trial","state","dict","Returns",":","The","processed","image"]
code: def on_cache(self, cache, state):
      """This method should be implemented by the overriding class to return an image from the cache.
  
      Args:
          cache (tensor): The collected cache of size (num_images, C, W, H)
          state (dict): The trial state dict
  
      Returns:
          The processed image
      """
      raise NotImplementedError
  
imports: import torchbearer
  from torchbearer import Callback
  import torch
label_desc: Use image node_id 2 for calling the CachingImagingCallback obj's underlying member method code with example usage: obj.on_cache(cache, state) without return types