code: def _bilinear_interpolate(
      input,  # [N, C, H, W]
      roi_batch_ind,  # [K]
      y,  # [K, PH, IY]
      x,  # [K, PW, IX]
      ymask,  # [K, IY]
      xmask,  # [K, IX]
  ):
      _, channels, height, width = input.shape
  
      # deal with inverse element out of feature map boundary
      y = y.clip(0, None)
      x = x.clip(0, None)
      y_low = y.astype(ivy.int32)
      x_low = x.astype(ivy.int32)
      y_high = ivy.where(y_low >= height - 1, height - 1, y_low + 1)
      y_low = ivy.where(y_low >= height - 1, height - 1, y_low)
      y = ivy.where(y_low >= height - 1, y.astype(input.dtype), y)
  
      x_high = ivy.where(x_low >= width - 1, width - 1, x_low + 1)
      x_low = ivy.where(x_low >= width - 1, width - 1, x_low)
      x = ivy.where(x_low >= width - 1, x.astype(input.dtype), x)
  
      ly = y - y_low
      lx = x - x_low
      hy = 1.0 - ly
      hx = 1.0 - lx
  
      def masked_index(
          y,  # [K, PH, IY]
          x,  # [K, PW, IX]
      ):
          if ymask is not None:
              assert xmask is not None
              y = ivy.where(ymask[:, None, :], y, 0)
              x = ivy.where(xmask[:, None, :], x, 0)
          return input[
              roi_batch_ind[:, None, None, None, None, None],
              ivy.arange(channels, device=input.device)[
                  None, :, None, None, None, None
              ],
              y[:, None, :, None, :, None],  # prev [K, PH, IY]
              x[:, None, None, :, None, :],  # prev [K, PW, IX]
          ]  # [K, C, PH, PW, IY, IX]
  
      v1 = masked_index(y_low, x_low)
      v2 = masked_index(y_low, x_high)
      v3 = masked_index(y_high, x_low)
      v4 = masked_index(y_high, x_high)
  
      # all ws preemptively [K, C, PH, PW, IY, IX]
      def outer_prod(y, x):
          return (
              y[:, None, :, None, :, None]
              * x[:, None, None, :, None, :]
          )
  
      w1 = outer_prod(hy, hx)
      w2 = outer_prod(hy, lx)
      w3 = outer_prod(ly, hx)
      w4 = outer_prod(ly, lx)
  
      val = w1 * v1 + w2 * v2 + w3 * v3 + w4 * v4
      return val
  
imports: from typing import Optional, Tuple, Union, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 25 for calling a global function with example usage: _bilinear_interpolate(input, roi_batch_ind, y, x, ymask, xmask) and returns: val, input, unknown