code: def encode(self, vecs):
          
          assert vecs.dtype == np.float32
          assert vecs.ndim == 2
          N, D = vecs.shape
          assert D == self.Ds * self.M, "input dimension must be Ds * M"
  
          # codes[n][m] : code of n-th vec, m-th subspace
          codes = np.empty((N, self.M), dtype=self.code_dtype)
          for m in range(self.M):
              if self.verbose:
                  print("Encoding the subspace: {} / {}".format(m, self.M))
              vecs_sub = vecs[:, m * self.Ds : (m+1) * self.Ds]
              codes[:, m], _ = vq(vecs_sub, self.codewords[m])
  
          return codes
docs: Encode input vectors into PQ-codes.
  
          Args:
              vecs (np.ndarray): Input vectors with shape=(N, D) and dtype=np.float32.
  
          Returns:
              np.ndarray: PQ codes with shape=(N, M) and dtype=self.code_dtype