code: def ref_linear_interpolate_1d(
      x, output_size, align_corners, half_pixel
  ):
      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(ishape[0], oshape[0], align_corners),)  # x
  
      # Real input indices as floats
      index = (
          get_source_index(scale[0], np.arange(oshape[0]), half_pixel),
      )
  
      # Nearest input indices per axis
      index_1 = (index[0].astype(np.int32),)
      index_2 = (np.minimum(index_1[0] + 1, ishape[0] - 1),)
  
      # Unit distance to left and right
      dist_1 = ((index[0] - index_1[0]).reshape(1, -1),)  # x
      dist_2 = (1.0 - dist_1[0],)
  
      val0 = dist_2[0] * xx[np.ix_(ib, index_1[0])]
      val1 = dist_1[0] * xx[np.ix_(ib, index_2[0])]
  
      yy = val0 + val1
  
      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 6 for calling a global function with example usage: ref_linear_interpolate_1d(x, output_size, align_corners, half_pixel) and returns: yy