code: def test_fancy_indexing_tensor_execution(setup):
      # test fancy index of type tensor
  
      raw = np.random.random((11, 8, 12, 14))
      arr = tensor(raw, chunk_size=(6, 5, 7, 8))
  
      raw_index = [8, 10, 3, 1, 9, 10]
      index = tensor(raw_index, chunk_size=4)
      arr2 = arr[index]
  
      res = arr2.execute().fetch()
      np.testing.assert_array_equal(res, raw[raw_index])
  
      raw_index = np.random.permutation(8)
      index = tensor(raw_index, chunk_size=3)
      arr3 = arr[:2, ..., index]
  
      res = arr3.execute().fetch()
      np.testing.assert_array_equal(res, raw[:2, ..., raw_index])
  
      raw_index = [1, 3, 9, 10]
      index = tensor(raw_index)
      arr4 = arr[..., index, :5]
  
      res = arr4.execute().fetch()
      np.testing.assert_array_equal(res, raw[..., raw_index, :5])
  
      raw_index1 = [8, 10, 3, 1, 9, 10]
      raw_index2 = [1, 3, 9, 10, 2, 7]
      index1 = tensor(raw_index1, chunk_size=4)
      index2 = tensor(raw_index2, chunk_size=3)
      arr5 = arr[index1, :, index2]
  
      res = arr5.execute().fetch()
      np.testing.assert_array_equal(res, raw[raw_index1, :, raw_index2])
  
      raw_index1 = [1, 3, 5, 7, 9, 10]
      raw_index2 = [1, 9, 9, 10, 2, 7]
      index1 = tensor(raw_index1, chunk_size=3)
      index2 = tensor(raw_index2, chunk_size=4)
      arr6 = arr[index1, :, index2]
  
      res = arr6.execute().fetch()
      np.testing.assert_array_equal(res, raw[raw_index1, :, raw_index2])
  
      raw_index1 = [[8, 10, 3], [1, 9, 10]]
      raw_index2 = [[1, 3, 9], [10, 2, 7]]
      index1 = tensor(raw_index1)
      index2 = tensor(raw_index2, chunk_size=2)
      arr7 = arr[index1, :, index2]
  
      res = arr7.execute().fetch()
      np.testing.assert_array_equal(res, raw[raw_index1, :, raw_index2])
  
      raw_index1 = [[1, 3], [3, 7], [7, 7]]
      raw_index2 = [1, 9]
      index1 = tensor(raw_index1, chunk_size=(2, 1))
      index2 = tensor(raw_index2)
      arr8 = arr[0, index1, :, index2]
  
      res = arr8.execute().fetch()
      np.testing.assert_array_equal(
          res, raw[0, raw_index1, :, raw_index2]
      )
  
      raw_a = np.random.rand(30, 30)
      a = tensor(raw_a, chunk_size=(13, 17))
      b = a.argmax(axis=0)
      c = a[b, arange(30)]
      res = c.execute().fetch()
  
      np.testing.assert_array_equal(
          res, raw_a[raw_a.argmax(axis=0), np.arange(30)]
      )
  
      # test one chunk
      arr = tensor(raw, chunk_size=20)
  
      raw_index = [8, 10, 3, 1, 9, 10]
      index = tensor(raw_index, chunk_size=20)
      arr9 = arr[index]
  
      res = arr9.execute().fetch()
      np.testing.assert_array_equal(res, raw[raw_index])
  
      raw_index1 = [[1, 3], [3, 7], [7, 7]]
      raw_index2 = [1, 9]
      index1 = tensor(raw_index1)
      index2 = tensor(raw_index2)
      arr10 = arr[0, index1, :, index2]
  
      res = arr10.execute().fetch()
      np.testing.assert_array_equal(
          res, raw[0, raw_index1, :, raw_index2]
      )
  
      # test order
      raw = np.asfortranarray(np.random.random((11, 8, 12, 14)))
      arr = tensor(raw, chunk_size=(6, 5, 7, 8))
  
      raw_index = [8, 10, 3, 1, 9, 10]
      index = tensor(raw_index, chunk_size=4)
      arr11 = arr[index]
  
      res = arr11.execute().fetch()
      expected = raw[raw_index].copy("A")
      np.testing.assert_array_equal(res, expected)
      assert res.flags["C_CONTIGUOUS"] == expected.flags["C_CONTIGUOUS"]
      assert res.flags["F_CONTIGUOUS"] == expected.flags["F_CONTIGUOUS"]
  
imports: import numpy
  import scipy.sparse
  import pytest
  from ....config import options
  from ...None import mod, stack, hstack
  from ...datasource import tensor, arange, zeros
  from ..None import take, compress, extract, choose, unravel_index, nonzero, flatnonzero, fill_diagonal
label_desc: Use image node_id 3 for calling a global function with example usage: test_fancy_indexing_tensor_execution(setup) without return types