xidulu opened a new pull request #17778: Add convenient method for numerical 
Ops under Numpy namespace
URL: https://github.com/apache/incubator-mxnet/pull/17778
 
 
   ## Description ##
   This PR adds convenient method for **numerical** Ops (e.g. `exp`) under 
Numpy namespace (i.e. numpy extension ops not included).
   
   This modification will significantly mitigate your pain of writing endless 
`F.np` in the hybrid_block.
   
   Take sampling from gumbel distribution as an example
   ```python
   # Before
   def gumbel_sample(pi):
       eps = F.np.random.uniform(F.np.zeros_like(pi))
       L = -F.np.log(-F.np.log(eps)) + F.np.log(pi)
   
   # After
   def gumbel_sample(pi):
       eps = F.np.random.uniform(F.np.zeros_like(pi)) # I wish this line get 
shortened in the future.
       L = -(-eps.log()).log() + pi.log()
   ```
   
   
   

----------------------------------------------------------------
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