def get_subquantizer_distances(self, x, coarse_codes, coarse_split=None):
        """
        Project a given query vector to the local space of the given coarse codes
        and compute the distances of each subvector to the corresponding subquantizer
        clusters.

        :param ndarray x:
            a query  vector
        :param tuple coarse_codes:
            the coarse codes defining which local space to project to
        :param int coarse_split:
            index of the coarse split to get distances for - if None then all splits
            are computed

        :returns list:
            a list of distances to each subquantizer cluster for each subquantizer
        """

        px = self.project(x, coarse_codes)
        subquantizer_dists = []

        if coarse_split is None:
            split_iter = iterate_splits(px, self.num_coarse_splits)
        else:
            split_iter = [(np.split(px, self.num_coarse_splits)[coarse_split], coarse_split)]

        # for cx, split in iterate_splits(px, self.num_coarse_splits):
        for cx, split in split_iter:
            _, _, _, subC = self.get_split_parameters(split)
            subquantizer_dists += [((fx - subC[sub_split]) ** 2).sum(axis=1) for fx, sub_split in iterate_splits(cx, self.num_fine_splits)]

        return subquantizer_dists
dataset/ETHPy150Open yahoo/lopq/python/lopq/model.py/LOPQModel.get_subquantizer_distances/original