code: def dot_compare(layer, batch=1, cossim_pow=0):
      def inner(T):
          acts1 = T(layer)[0]
          acts2 = T(layer)[batch]
          dot = tf.reduce_sum(acts1 * acts2)
          mag = tf.sqrt(tf.reduce_sum(acts2**2))
          cossim = dot / (1e-6 + mag)
          cossim = tf.maximum(0.1, cossim)
          return dot * cossim**cossim_pow
  
      return inner
  
file_path: lucid/lucid/recipes/caricature.py
imports: from os.path import join
  import json
  import numpy
  import tensorflow
  import scipy.ndimage
  import lucid.modelzoo.vision_models
  import lucid.optvis.objectives
  import lucid.optvis.param
  import lucid.optvis.render
  import lucid.optvis.transform
  from lucid.misc.io import show, load, save
  from lucid.misc.io.reading import read
  from lucid.misc.ndimage_utils import resize
  import lucid.misc.io.showing
  from lucid.modelzoo.vision_base import SerializedModel
label_desc: Use image node_id 1 for calling a global function with example usage: dot_compare(layer, batch, cossim_pow) and returns: inner, unknown