gradoptics.inference.rejection_sampling
- gradoptics.inference.rejection_sampling.rejection_sampling(pdf, nb_point, proposal_distribution, m=None, batch_size=1000000, eps=1e-15, device='cpu')
Samples from an unnormalized pdf using rejection sampling
- Parameters
pdf – Function that evaluates the unnormalized pdf of a data point (
Callable
)nb_point – Number of points to sample (
int
)proposal_distribution – Proposal distribution (
BaseDistribution
)m – M (
float
)batch_size – Batch size (
int
)eps – Parameter used for numerical stability (
float
). Default is'1e-15'
device – The desired device of returned tensor (
str
). Default is'cpu'
- Returns
Sampled points (
torch.tensor
)