You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/02/06 13:32:31 UTC

[GitHub] [incubator-mxnet] xidulu commented on issue #17529: np.random.gamma(1, 0) and np.random.gamma(0, 0) hang

xidulu commented on issue #17529: np.random.gamma(1,0) and np.random.gamma(0,0) hang
URL: https://github.com/apache/incubator-mxnet/issues/17529#issuecomment-582907092
 
 
   Hi @D-Roberts, I am the author of `np.random.gamma`. It seems that the rejection sampling got trapped in an infinity loop because of the invalid parameter (scale = 0), as no samples could be accepted according to the standard formula. 
   
   I will create a fix soon.
   
   However,  https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.random.gamma.html the doc for official NumPy says "The scale of the gamma distribution. Should be greater than zero.", 
   So IMO, returning zero is kind of like undefined behavior.
   Do you have any practical examples that involves setting scale to be zero? If not, I would consider raising an ValueError exception rather than returning zero.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services