code: def ref_nearest_interpolate_1d(
      x, output_size, align_corners, half_pixel, half_pixel_for_nn
  ):
      oshape = output_size  # output-width
      ishape = x.shape[-1:]  # input-width
      xx = x.reshape(-1, *ishape)
      ib = np.arange(xx.shape[0])  # batch index
  
      scale = (
          compute_scale_for_nn(
              ishape[0], oshape[0], align_corners, half_pixel_for_nn
          ),
      )  # x
  
      # Real input indices as floats
      index = (
          get_source_index_for_nn(
              scale[0],
              np.arange(oshape[0]),
              half_pixel,
              half_pixel_for_nn,
          ),
      )
  
      # Nearest input indices per axis
      index_1 = (np.minimum(index[0].astype(np.int32), ishape[0] - 1),)
  
      # Nearest input
      yy = xx[np.ix_(ib, index_1[0])]
  
      return yy.reshape(x.shape[: -len(oshape)] + oshape)
  
imports: from __future__ import division
  import pytest
  import numpy
  import nnabla.functions
  import refs
  from nbla_test_utils import list_context
label_desc: Use image node_id 9 for calling a global function with example usage: ref_nearest_interpolate_1d(x, output_size, align_corners, half_pixel, half_pixel_for_nn) and returns: yy