HEmile / storchastic

Stochastic Automatic Differentiation library for PyTorch.
GNU General Public License v3.0
180 stars 5 forks source link

Implemented Stochastic Beam Search #61

Closed HEmile closed 4 years ago

HEmile commented 4 years ago

Implemented sampling without replacement from arbitrary stochastic computation graphs using stochastic beam search http://jmlr.org/papers/v21/19-985.html. This implementation can be used to implement the Unordered set estimator (Issue #25), MAPO, Rao-blackwellized REINFORCE, and possibly others.

This required implementing AncestralPlate, a special type of Plate that is able to keep track of what samples are being taken at earlier points, can increase the size of samples and can discard samples at later points in the sampling step.

This pull request requires PyTorch 1.5, as it removes the monkey patching design in favour of the newly introduced __torch_function__ magic method.