xidulu commented on issue #17412: certain sample_ ops hanging with 
random_normal input
URL: 
https://github.com/apache/incubator-mxnet/issues/17412#issuecomment-577778926
 
 
   The `hang` you describe happened in the rejection sampling implementation of 
`sample_gamma`, which was basically an infinite while loop. I believe this 
`hang` was triggered by invalid parameters of the sampling method, in which 
case there would never be `accepted samples`.
   
   In your example, the `alpha` parameter, if sampled from a standard normal, 
would be a negative number by chance, which could cause problems. However, if 
you generate `alpha` from `U(0,1)`, everything would go as it should be.
   
   -----------------------------------------------
   Appendix: 
   Part of the sample_gamma's docstring
   ```python
     alpha : float or NDArray, optional
           The shape of the gamma distribution. Should be greater than zero.
     beta : float or NDArray, optional
           The scale of the gamma distribution. Should be greater than zero.
           Default is equal to 1.
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to