Is there any C++ API with same functionality as torch.distributions.Categorical?
I found torch::::multinomial that has same input parameters (const Tensor &self, int64_t num_samples, bool replacement = false, Generator *generator = nullptr), but it does not have sample or log_prob APIs.
Separately from this topic, but somewhat related, the implementation for torch.distributions.Normal appears to be here: normal.py. In the sample() function, on line 63, there is a call to torch.normal(). I have not been able to find the implementation for it. Do you think you could provide a link to the file defining torch.normal()?
Thank you very much, seeing the implementation was very useful for me.
Would you also be able to point me to the implementation of the .log_prob() implementation for the normal distribution?
I assumed it is computed as the logarithm of the probability density function. I would like to clarify if that’s the case.