code: def create_inputs(
      rng, batch_size, channels, size_out, size_inp, align_corners
  ):
      if len(size_out) == 2:
          inp = rng.randn(
              batch_size, channels, size_inp[0], size_inp[1]
          ).astype(np.float32)
          affine = generate_transformation_2d(rng, batch_size)
          grid_s = affine_grid_2d(affine, size_out, align_corners)
      elif len(size_out) == 3:
          inp = rng.randn(
              batch_size,
              channels,
              size_inp[0],
              size_inp[1],
              size_inp[2],
          ).astype(np.float32)
          affine = generate_transformation_3d(rng, batch_size)
          grid_s = affine_grid_3d(affine, size_out, align_corners)
      return inp, grid_s
  
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 1 for calling a global function with example usage: create_inputs(rng, batch_size, channels, size_out, size_inp, align_corners) and returns: inp,  grid_s