code: def unnormalize_grid(s, S, align_corners):
      if align_corners:
          # [-1, 1] <--> [0, S - 1]
          return (s + 1.0) * (S - 1) / 2.0
      else:
          # [-1, 1] <--> [0.5, S - 0.5] = [0 + 0.5, S - 1 + 0.5]
          return ((s + 1.0) * S - 1.0) / 2.0
  
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 2 for calling a global function with example usage: unnormalize_grid(s, S, align_corners) and returns: unknown, unknown