Hello,

 

Pull Request: https://github.com/numpy/numpy/pull/8053

 

I would like to expose a tolerance parameter for the function numpy.random.multinomial.

 

The function `multinomial(n, pvals, size=None)` correctly raises exception when `sum(pvals) > 1 + 1e-12` as these values should sum to 1. However, other libraries often cannot or do not guarantee such level of precision.

 

Specifically, I have encountered issues with tensorflow function tf.nn.softmax, which is expected to output a tensor whose values sum to 1, but often with precision of only 1e-8.

 

I propose to expose the `1e-12` tolerance to a non-negative float parameter with default value `1e-12`.

 

Alex