lanking520 commented on issue #12140: Impossible to provide arguments to 
random_normal in scala ?
URL: 
https://github.com/apache/incubator-mxnet/issues/12140#issuecomment-412416142
 
 
   Hi @mdespriee 
   Nice try with Scala package! In your case, you can implement in the 
following ways:
   ```Scala
   Symbol.random_normal(i.output)()(Map("loc" -> mean, ...))
   ```
   Just put all of your args in the map. You can always check [Python API 
example](http://mxnet.apache.org/api/python/symbol/symbol.html#mxnet.symbol.random_normal).
 
   
   BTW, in the future, you can call `Symbol.api.random_normal`. This is a brand 
new api set introduced in v1.3 (not coming yet..) here is an example:
   ```Scala
     /**
     * <pre>
     * Draw random samples from a normal (Gaussian) distribution.
     * 
     * .. note:: The existing alias ``normal`` is deprecated.
     * 
     * Samples are distributed according to a normal distribution parametrized 
by *loc* (mean) and *scale* (standard deviation).
     * 
     * Example::
     * 
     *    normal(loc=0, scale=1, shape=(2,2)) = [[ 1.89171135, -1.16881478],
     *                                           [-1.23474145,  1.55807114]]
     * 
     * 
     * Defined in src/operator/random/sample_op.cc:L85
     * </pre>
     * @param loc               Mean of the distribution.
     * @param scale             Standard deviation of the distribution.
     * @param shape             Shape of the output.
     * @param ctx               Context of output, in format 
[cpu|gpu|cpu_pinned](n). Only used for imperative calls.
     * @param dtype             DType of the output in case this can't be 
inferred. Defaults to float32 if not defined (dtype=None).
     * @return org.apache.mxnet.Symbol
     */
   @Experimental
   def random_normal (loc : Option[org.apache.mxnet.Base.MXFloat] = None, scale 
: Option[org.apache.mxnet.Base.MXFloat] = None, shape : 
Option[org.apache.mxnet.Shape] = None, ctx : Option[String] = None, dtype : 
Option[String] = None, name : String = null, attr : Map[String, String] = null) 
: org.apache.mxnet.Symbol
   ```
   @mxnet-label-bot can you label this as [scala] ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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