docstr: Test LSQ decode
docstr_tok: ["Test","LSQ","decode"]
code: def test_decode(self):
      """Test LSQ decode"""
      d = 16
      n = 500
      M = 4
      nbits = 6
      K = 1 << nbits
  
      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.train(x)
  
      # decode x
      pack_codes = np.zeros((n, lsq.code_size)).astype(np.uint8)
      decoded_x = np.zeros((n, d)).astype(np.float32)
      lsq.pack_codes(n, sp(codes), sp(pack_codes))
      lsq.decode_c(sp(pack_codes), sp(decoded_x), n)
  
      # decode in Python
      codebooks = faiss.vector_float_to_array(lsq.codebooks)
      codebooks = codebooks.reshape(M, K, d).copy()
      decoded_x_ref = decode_ref(x, codebooks, codes)
  
      np.testing.assert_allclose(decoded_x, decoded_x_ref, rtol=1e-6)
  
imports: import numpy
  import faiss
  import unittest
  from faiss.contrib import datasets
label_desc: Use image node_id 1 for calling the TestComponents obj's underlying member method code with example usage: obj.test_decode() without return types