code: def _interpolate_bilinear_with_checks(
      grid: types.TensorLike,
      query_points: types.TensorLike,
      indexing: str,
      name: Optional[str],
  ) -> tf.Tensor:
      """Perform checks on inputs without tf.function decorator to avoid flakiness."""
      if indexing != "ij" and indexing != "xy":
          raise ValueError("Indexing mode must be 'ij' or 'xy'")
  
      grid = tf.convert_to_tensor(grid)
      query_points = tf.convert_to_tensor(query_points)
      grid_shape = tf.shape(grid)
      query_shape = tf.shape(query_points)
  
      with tf.control_dependencies(
          [
              tf.debugging.assert_equal(
                  tf.rank(grid), 4, "Grid must be 4D Tensor"
              ),
              tf.debugging.assert_greater_equal(
                  grid_shape[1], 2, "Grid height must be at least 2."
              ),
              tf.debugging.assert_greater_equal(
                  grid_shape[2], 2, "Grid width must be at least 2."
              ),
              tf.debugging.assert_equal(
                  tf.rank(query_points),
                  3,
                  "Query points must be 3 dimensional.",
              ),
              tf.debugging.assert_equal(
                  query_shape[2],
                  2,
                  "Query points last dimension must be 2.",
              ),
          ]
      ):
          return _interpolate_bilinear_impl(
              grid, query_points, indexing, name
          )
  
file_path: addons/tensorflow_addons/image/dense_image_warp.py
imports: import tensorflow
  from tensorflow_addons.utils import types
  from typing import Optional
label_desc: Use image node_id 2 for calling a global function with example usage: _interpolate_bilinear_with_checks(grid, query_points, indexing, name) and returns: _interpolate_bilinear_impl