code: def trivial_kernel(kernel_shape):
      """
      This function generates a trivial kernel with all 0s except for the
      element in its spatial center
      e.g. trivial_kernel((3, 3, 1, 1,)) returns a kernel of::
  
          [[[[0]], [[0]], [[0]]],
           [[[0]], [[1]], [[0]]],
           [[[0]], [[0]], [[0]]]]
  
      kernel_shape[-1] and kernel_shape[-2] should be 1, so that it operates
      on the spatial dims only.  However, there is no exact spatial centre
      if np.any((kernel_shape % 2) == 0). This is fine in many cases
      as np.sum(trivial_kernel(kernel_shape)) == 1
      """
      assert kernel_shape[-1] == 1
      assert kernel_shape[-2] == 1
      # assert np.all((kernel_shape % 2) == 1)
      kernel = np.zeros(kernel_shape)
      flattened = kernel.reshape(-1)
      flattened[np.prod(kernel_shape) // 2] = 1
      return flattened.reshape(kernel_shape)
  
imports: from __future__ import absolute_import, print_function
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: trivial_kernel(kernel_shape) and returns: flattened