Visualize a single (x, y) position along the given direction

def direction_neuron(layer_name, vec, batch=None, x=None, y=None, cossim_pow=0):
  """Visualize a single (x, y) position along the given direction"""
  def inner(T):
    layer = T(layer_name)
    shape = tf.shape(layer)
    x_ = shape[1] // 2 if x is None else x
    y_ = shape[2] // 2 if y is None else y
    if batch is None:
      return _dot_cossim(layer[:, x_, y_], vec[None], cossim_pow=cossim_pow)
    else:
      return _dot_cossim(layer[batch, x_, y_], vec, cossim_pow=cossim_pow)
  return inner