gradoptics.distributions.base_distribution

class gradoptics.distributions.base_distribution.BaseDistribution

Bases: abc.ABC

Base class for probability distributions.

abstract sample(nb_points, device='cpu')

Samples from the distribution

Parameters
  • nb_points – Number of points to sample (int)

  • device – The desired device of returned tensor (str). Default is 'cpu'

Returns

Sampled points (torch.tensor)

abstract pdf(x)

Returns the pdf function evaluated at x

Warning

The pdf may be unnormalized

Parameters

x – Value where the pdf should be evaluated (torch.tensor)

Returns

The pdf function evaluated at x (torch.tensor)