code: def test_6d_array_indexing(key, nn_type):
      b, c, s0, s1, s2, s3 = 8, 16, 1, 7, 6, 4
      x_np = np.random.rand(b, c, s0, s1, s2, s3)
      x_nn = nn.NdArray.from_numpy_array(x_np)
  
      with nn.auto_forward(True):
          y_nn = x_nn.__getitem__(
              eval("Key2Key()[{key}]".format(key=key))
          )
          y_np = x_np.__getitem__(
              eval("Key2Key()[{key}]".format(key=key))
          )
          assert allclose(y_nn, y_np)
  
      with nn.auto_forward(True):
          data = np.random.rand(
              *eval("x_np[{key}].shape".format(key=key))
          )
          # The next two lines must not be swapped because a boolean key like
          # "x_np > 0.5" must first be used for x_nn before it modifies x_np.
          x_nn.__setitem__(
              eval("Key2Key()[{key}]".format(key=key)), data
          )
          x_np.__setitem__(
              eval("Key2Key()[{key}]".format(key=key)), data
          )
          assert allclose(x_nn, x_np)
  
      with nn.auto_forward(True):
          # The next two lines must not be swapped because a boolean key like
          # "x_np > 0.5" must first be used for x_nn before it modifies x_np.
          x_nn.__setitem__(eval("Key2Key()[{key}]".format(key=key)), 69)
          x_np.__setitem__(eval("Key2Key()[{key}]".format(key=key)), 69)
          assert allclose(x_nn, x_np)
  
file_path: nnabla/python/test/test_indexing.py
imports: import pytest
  import numpy
  import nnabla
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 5 for calling a global function with example usage: test_6d_array_indexing(key, nn_type) without return types