code: def _bilinearly_interpolate(data, x, y):
      """Performs bilinenar interpolation of grid data at user defined
      coordinates.
  
      This interpolation function:
        a) implicitly pads the input data with 0s.
        b) returns 0 when sampling outside the (padded) image.
      The effect is that the sampled signal smoothly goes to 0 outside the
      original input domain, rather than producing a jump discontinuity at
      the image boundaries.
      Args:
        data: numpy array of shape `[data_height, data_width]` containing data
          samples assumed to be defined at the corresponding pixel coordinates.
        x: numpy array of shape `[warp_height, warp_width]` containing
          x coordinates at which interpolation will be performed.
        y: numpy array of shape `[warp_height, warp_width]` containing
          y coordinates at which interpolation will be performed.
      Returns:
        Numpy array of shape `[warp_height, warp_width]` containing interpolated
          values.
      """
      shape = x.shape
      x = np.asarray(x) + 1
      y = np.asarray(y) + 1
      data = np.pad(data, 1, "constant", constant_values=0)
  
      x_0 = np.floor(x).astype(int)
      x_1 = x_0 + 1
      y_0 = np.floor(y).astype(int)
      y_1 = y_0 + 1
  
      x_0 = np.clip(x_0, 0, data.shape[1] - 1)
      x_1 = np.clip(x_1, 0, data.shape[1] - 1)
      y_0 = np.clip(y_0, 0, data.shape[0] - 1)
      y_1 = np.clip(y_1, 0, data.shape[0] - 1)
  
      i_a = data[y_0, x_0]
      i_b = data[y_1, x_0]
      i_c = data[y_0, x_1]
      i_d = data[y_1, x_1]
  
      w_a = (x_1 - x) * (y_1 - y)
      w_b = (x_1 - x) * (y - y_0)
      w_c = (x - x_0) * (y_1 - y)
      w_d = (x - x_0) * (y - y_0)
  
      samples = w_a * i_a + w_b * i_b + w_c * i_c + w_d * i_d
      samples = samples.reshape(shape)
  
      return samples
  
file_path: addons/tensorflow_addons/image/tests/resampler_ops_test.py
imports: import numpy
  import pytest
  import tensorflow
  from tensorflow_addons.image import resampler_ops
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _bilinearly_interpolate(data, x, y) and returns: samples