code: def warp_by_grid_nearest_2d(
      inp, grid, mode, padding_mode, align_corners, channel_last
  ):
      B, C, Hi, Wi = inp.shape
      B, Ho, Wo, _ = grid.shape
      out = np.zeros((B, C, Ho, Wo))
      for b, c, h, w in product(
          range(B), range(C), range(Ho), range(Wo)
      ):
          xf = unnormalize_grid(grid[b, h, w, 0], Wi, align_corners)
          yf = unnormalize_grid(grid[b, h, w, 1], Hi, align_corners)
          xf = get_src_findex_by_pad(
              xf, Wi, padding_mode, align_corners
          )
          yf = get_src_findex_by_pad(
              yf, Hi, padding_mode, align_corners
          )
          xi = np.floor(xf + 0.5)
          yi = np.floor(yf + 0.5)
          xi = int(xi)
          yi = int(yi)
  
          val = get_pixel_value_2d(inp, b, c, yi, xi, Hi, Wi)
          out[b, c, h, w] = val
      return out
  
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nbla_test_utils import list_context
  from refs import generate_transformation_2d, generate_transformation_3d, affine_grid_2d, affine_grid_3d, ChannelLastToFirstTranspose
  from itertools import product
label_desc: Use image node_id 11 for calling a global function with example usage: warp_by_grid_nearest_2d(inp, grid, mode, padding_mode, align_corners, channel_last) and returns: out