docstr: Test codebooks updatation.
docstr_tok: ["Test","codebooks","updatation","."]
code: def test_update_codebooks(self):
      """Test codebooks updatation."""
      d = 16
      n = 500
      M = 4
      nbits = 6
      K = 1 << nbits
  
      # set a larger value to make the updating process more stable
      lambd = 1e-2
  
      rs = np.random.RandomState(123)
      x = rs.rand(n, d).astype(np.float32)
      codes = rs.randint(0, K, (n, M)).astype(np.int32)
  
      lsq = faiss.LocalSearchQuantizer(d, M, nbits)
      lsq.lambd = lambd
      lsq.train(x)  # just for allocating memory for codebooks
  
      codebooks = faiss.vector_float_to_array(lsq.codebooks)
      codebooks = codebooks.reshape(M, K, d).copy()
  
      lsq.update_codebooks(sp(x), sp(codes), n)
      new_codebooks = faiss.vector_float_to_array(lsq.codebooks)
      new_codebooks = new_codebooks.reshape(M, K, d).copy()
  
      ref_codebooks = update_codebooks_ref(x, codes, K, lambd)
  
      np.testing.assert_allclose(
          new_codebooks, ref_codebooks, atol=1e-3
      )
  
imports: import numpy
  import faiss
  import unittest
  from faiss.contrib import datasets
label_desc: Use image node_id 2 for calling the TestComponents obj's underlying member method code with example usage: obj.test_update_codebooks() without return types