code: def test_auto_index(setup):
      d = 8
      n = 50
      n_test = 10
      x = np.random.RandomState(0).rand(n, d).astype(np.float32)
      y = np.random.RandomState(1).rand(n_test, d).astype(np.float32)
  
      for chunk_size in (50, 20):
          X = mt.tensor(x, chunk_size=chunk_size)
  
          faiss_index = build_faiss_index(
              X, random_state=0, return_index_type="object"
          )
          d, i = faiss_query(faiss_index, y, 5, nprobe=10)
          indices = i.execute().fetch()
  
          nn = NearestNeighbors()
          nn.fit(x)
          expected_indices = nn.kneighbors(y, 5, return_distance=False)
  
          np.testing.assert_array_equal(indices, expected_indices)
  
file_path: mars/mars/learn/neighbors/tests/test_faiss.py
imports: import numpy
  import pytest
  from ....None import tensor
  from ....core import tile
  from ....session import execute, fetch
  from ..None import NearestNeighbors
  from .._faiss import build_faiss_index, _load_index, faiss_query, _gen_index_string_and_sample_count
label_desc: Use image node_id 4 for calling a global function with example usage: test_auto_index(setup) without return types