code: def check_spatial_dims(input_tensor, criteria):
      """
      valid each of the spatial dims against `criteria`
      criteria can be a lambda function
      e.g. lambda x : x > 10 checks whether each dim is greater than 10
      """
      input_shape = input_tensor.shape
      if not input_shape.is_fully_defined():
          # skip checking if the input has dynamic shapes
          return True
      input_shape.with_rank_at_least(3)
      spatial_dims = input_shape[1:-1].as_list()
      all_dims_satisfied = np.all([criteria(x) for x in spatial_dims])
      if not all_dims_satisfied:
          import inspect
  
          raise ValueError(
              "input tensor's spatial dimensionality"
              " not compatible, please tune "
              "the input window sizes. "
              "(e.g. lambda x : x % 8 == 0 checks whether each dimension is divisible by 8)\n{}".format(
                  inspect.getsource(criteria)
              )
          )
      return all_dims_satisfied
  
imports: from __future__ import absolute_import, print_function
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: check_spatial_dims(input_tensor, criteria) and returns: all_dims_satisfied, True