def METHOD_NAME(self):
    if self.codebook_indices is None:
        from itertools import product
        p = [range(self.num_vars)] * self.groups
        inds = list(product(*p))
        self.codebook_indices = torch.tensor(
            inds, dtype=torch.long, device=self.vars.device
        ).flatten()
        if not self.combine_groups:
            self.codebook_indices = self.codebook_indices.view(
                self.num_vars ** self.groups, -1
            )
            for b in range(1, self.groups):
                self.codebook_indices[:, b] += self.num_vars * b
            self.codebook_indices = self.codebook_indices.flatten()
    return self.codebook_indices