Sampling
The
sample
method generates samples from a distribution, and in this process, it does not consider the gradient of the parameters. This is used when differentiation through the sampling process is not necessary. On the other hand, rsample
refers to reparameterization sampling, which enables gradient-based optimization through the sampling process (loss calculation Pathwise derivative).torch.distributions members
torch.distributions functions