kshitij12345 commented on a change in pull request #15772: Add symbol api for 
randn and fix shape issue for randn ndarray and symbol api
URL: https://github.com/apache/incubator-mxnet/pull/15772#discussion_r311662330
 
 

 ##########
 File path: python/mxnet/symbol/random.py
 ##########
 @@ -113,6 +113,31 @@ def normal(loc=0, scale=1, shape=_Null, dtype=_Null, 
**kwargs):
                           [loc, scale], shape, dtype, kwargs)
 
 
+def randn(*shape, **kwargs):
+    """Draw random samples from a normal (Gaussian) distribution.
+
+    Samples are distributed according to a normal distribution parametrized
+    by *loc* (mean) and *scale* (standard deviation).
+
+
+    Parameters
+    ----------
+    loc : float or NDArray
+        Mean (centre) of the distribution.
+    scale : float or NDArray
+        Standard deviation (spread or width) of the distribution.
+    shape : int or tuple of ints
+        The number of samples to draw. If shape is, e.g., `(m, n)` and `loc` 
and
+        `scale` are scalars, output shape will be `(m, n)`. If `loc` and 
`scale`
+        are NDArrays with shape, e.g., `(x, y)`, then output will have shape
+        `(x, y, m, n)`, where `m*n` samples are drawn for each `[loc, scale)` 
pair.
+    dtype : {'float16', 'float32', 'float64'}
+        Data type of output samples. Default is 'float32'
+    """
+    return _random_helper(_internal._random_normal, _internal._sample_normal,
+                            [loc, scale], shape, dtype, ctx, out, kwargs)
 
 Review comment:
   I don't think this will work as 
   ```
   [loc, scale], shape, dtype, ctx, out
   ```
   are undefined.
   
   Should be similar to
   
https://github.com/apache/incubator-mxnet/blob/c34e9dc85fa6b8196f97ac674e9b1237e664c49b/python/mxnet/ndarray/random.py#L218-L226

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