def METHOD_NAME(self, indices):
    res = indices.new_full(indices.shape[:-1], 0)
    for i in range(self.groups):
        exponent = self.groups - i - 1
        res += indices[..., i] * (self.num_vars ** exponent)
    return res