code: def grid_sample_helper(draw, dtype, mode, mode_3d, padding_mode):
      dtype = draw(dtype)
      align_corners = draw(st.booleans())
      dims = draw(st.integers(4, 5))
      height = draw(helpers.ints(min_value=5, max_value=10))
      width = draw(helpers.ints(min_value=5, max_value=10))
      channels = draw(helpers.ints(min_value=1, max_value=3))
  
      grid_h = draw(helpers.ints(min_value=2, max_value=4))
      grid_w = draw(helpers.ints(min_value=2, max_value=4))
      batch = draw(helpers.ints(min_value=1, max_value=5))
  
      padding_mode = draw(st.sampled_from(padding_mode))
      if dims == 4:
          mode = draw(st.sampled_from(mode))
          x = draw(
              helpers.array_values(
                  dtype=dtype[0],
                  shape=[batch, channels, height, width],
                  min_value=-1,
                  max_value=1,
              )
          )
  
          grid = draw(
              helpers.array_values(
                  dtype=dtype[0],
                  shape=[batch, grid_h, grid_w, 2],
                  min_value=-1,
                  max_value=1,
              )
          )
      elif dims == 5:
          mode = draw(st.sampled_from(mode_3d))
          depth = draw(helpers.ints(min_value=10, max_value=15))
          grid_d = draw(helpers.ints(min_value=5, max_value=10))
          x = draw(
              helpers.array_values(
                  dtype=dtype[0],
                  shape=[batch, channels, depth, height, width],
                  min_value=-1,
                  max_value=1,
              )
          )
  
          grid = draw(
              helpers.array_values(
                  dtype=dtype[0],
                  shape=[batch, grid_d, grid_h, grid_w, 3],
                  min_value=-1,
                  max_value=1,
              )
          )
      return dtype, x, grid, mode, padding_mode, align_corners
  
file_path: ivy/ivy_tests/test_ivy/test_frontends/test_torch/test_nn/test_functional/test_vision_functions.py
imports: from hypothesis import assume, strategies
  import ivy
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_frontend_test
  from ivy_tests.test_ivy.test_functional.test_experimental.test_nn.test_layers import _interp_args
label_desc: Use image node_id 4 for calling a global function with example usage: grid_sample_helper(draw, dtype, mode, mode_3d, padding_mode) and returns: dtype,  x,  grid,  mode,  padding_mode,  align_corners