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/03/06 14:45:17 UTC

[GitHub] [incubator-mxnet] xidulu opened a new pull request #17778: Add convenient method for numerical Ops under Numpy namespace

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:
users@infra.apache.org


With regards,
Apache Git Services