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 2021/02/26 07:58:33 UTC

[GitHub] [incubator-mxnet] xidulu commented on pull request #18403: Gluon.probability

xidulu commented on pull request #18403:
URL: https://github.com/apache/incubator-mxnet/pull/18403#issuecomment-786478830


   @feevos 
   Hi, in MXNet, you should avoid return anything other than NDArray from the Block, I would say returning a distribution object could be a bad idea.
   Also, according to our design, a distribution object is a light-weight on-the-fly wrapper of statistics functions, that is to say, it is not designed to used as the return value or argument of a function.
   My suggestion for your case would be first creating a HybridBlock called "encoder" that returns \mu and \sigma or create a function called "get_latents" which returns \mu and \sigma. After you acquire the parameters, you can create a `Normal` object with them and call the function you need.
   
   ```python
   z_mu, z_sigma = Encoder(x)
   qz = Normal(z_mu, z_sigma)
   print(qz.sample())
   ```


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