def METHOD_NAME(self, sample_shape=torch.Size()):
    if self.bp_iters is None:
        # Brute force.
        d = self.enumerate_support()
        s = torch.arange(d.size(-1), dtype=d.dtype, device=d.device)
        logits = self.logits[s, d].sum(-1)
        METHOD_NAME = Categorical(logits=logits).METHOD_NAME(sample_shape)
        return d[METHOD_NAME]
    if sample_shape:
        return torch.stack(
            [self.METHOD_NAME(sample_shape[1:]) for _ in range(sample_shape[0])]
        )
    # TODO initialize via .mode(), then perform a small number of MCMC steps
    # https://www.cc.gatech.edu/~vigoda/Permanent.pdf
    # https://papers.nips.cc/paper/2012/file/4c27cea8526af8cfee3be5e183ac9605-Paper.pdf
    raise NotImplementedError