class_docstr: Low-level lattice tests 
class_docstr_tok: ["Low-level","lattice","tests"]
code: def run_ZnSphereCodecAlt(self, dim, r2):
      # dim = 32
      # r2 = 14
      codec = faiss.ZnSphereCodecAlt(dim, r2)
      rs = np.random.RandomState(123)
      n = 100
      codes = rs.randint(codec.nv, size=n, dtype="uint64")
      x = np.empty((n, dim), dtype="float32")
      codec.decode_multi(n, swig_ptr(codes), swig_ptr(x))
      codes2 = np.empty(n, dtype="uint64")
      codec.encode_multi(n, swig_ptr(x), swig_ptr(codes2))
  
      assert np.all(codes == codes2)
  
imports: from __future__ import print_function
  import numpy
  import unittest
  import faiss
  from common_faiss_tests import get_dataset_2
  from faiss.contrib.datasets import SyntheticDataset
  from faiss.contrib.inspect_tools import get_additive_quantizer_codebooks
label_desc: Use image node_id 4 for calling the LatticeTest obj's underlying member method code with example usage: obj.run_ZnSphereCodecAlt(dim, r2) without return types