Skip to content

Implement random_gamma() sampler (with gradients) #3813

@fritzo

Description

@fritzo

Many probability distributions require sampling from the Gamma distribution, including: Gamma, Beta, and Dirichlet.

Since Gamma samplers have complex control flow (for rejection sampling) and are seldom a bottleneck in probabilistic algorithms, it should suffice to implement a CPU-only implementation at first. What is more important than a CUDA implementation is a reparameterized sampler so that stochastic gradients can be propagated through the sampler (see paper and reference implementation by @naesseth).

Tasks

Map of modifications

  • aten/src/TH/THRandom.c/h random single numbers
  • aten/src/TH/generic/THTensorRandom.c/h random tensors
  • aten/src/ATen/Declarations.cwrap bindings for ATen
  • torch/csrc/generic/methods/TensorRandom.cwrap bindings for torch.Tensor
  • torch/autograd/variable.py - Variable
  • torch/distributions.py - Distributions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions