ocaml-torch icon indicating copy to clipboard operation
ocaml-torch copied to clipboard

Support for probability distributions

Open Kwonsoo opened this issue 4 years ago • 5 comments

Hi,

It seems to me that ocaml-torch does not provide API for torch.distributions. Specifically, it does not implement various probability distributions with some common functions such as sample and log_prob. I think they are important enough and should be implemented here.

Best, Gwonsoo

Kwonsoo avatar Mar 15 '20 12:03 Kwonsoo

Hi, Right I agree that it would be a nice thing to add. The modules from torch.distributions are mostly written in python so this would have to be re-implemented on the ocaml side, the required torch primitives should already be exposed.

LaurentMazare avatar Mar 16 '20 09:03 LaurentMazare

Do you have any specific plans for implementing them?

Kwonsoo avatar Mar 16 '20 10:03 Kwonsoo

Not currently, I can add it to my stack but I'm unsure when I'll get to it. Feel free to have a go at it if you want. Do you have some use cases for this? Also knowing which distributions are the most interesting ones could be helpful.

LaurentMazare avatar Mar 16 '20 10:03 LaurentMazare

We only need normal distributions currently. Thanks for your response.

Kwonsoo avatar Mar 17 '20 11:03 Kwonsoo

Hi Laurent,

I re-opened this issue, and I think it will be helpful for many users if ocaml-torch supports at least normal distributions and multivariate normal distributions (sample and log_prob functions). Normal distributions are easy to implement, but multivariate normal distributions seem to need more care.

Thanks, Gwonsoo

Kwonsoo avatar Jun 28 '21 11:06 Kwonsoo