reminisce commented on a change in pull request #15744: [Numpy] Numpy behavior
random.uniform()
URL: https://github.com/apache/incubator-mxnet/pull/15744#discussion_r310925587
##########
File path: python/mxnet/ndarray/numpy/random.py
##########
@@ -139,6 +139,58 @@ def normal(loc=0.0, scale=1.0, size=None, **kwargs):
[loc, scale], size, dtype, ctx, out, kwargs)
+def uniform(low=0.0, high=1.0, size=None, ctx=None, dtype=None, out=None):
+ """Draw samples from a uniform distribution.
+
+ Samples are uniformly distributed over the half-open interval
+ ``[low, high)`` (includes low, but excludes high). In other words,
+ any value within the given interval is equally likely to be drawn
+ by `uniform`.
+
+ Parameters
+ ----------
+ low : float, ndarray, optional
+ Lower boundary of the output interval. All values generated will be
+ greater than or equal to low. The default value is 0.
+ high : float, ndarray, optional
+ Upper boundary of the output interval. All values generated will be
+ less than high. The default value is 1.0.
+ size : int or tuple of ints, optional
+ Output shape. If the given shape is, e.g., ``(m, n, k)``, then
+ ``m * n * k`` samples are drawn. If size is ``None`` (default),
+ a scalar tensor containing a single value is returned if
+ ``low`` and ``high`` are both scalars.
+ dtype : {'float16', 'float32', 'float64'}, optional
+ Data type of output samples. Default is 'float32'
+ ctx : Context, optional
+ Device context of output. Default is current context.
+
+ Returns
+ -------
+ out : ndarray
+ Drawn samples from the parameterized uniform distribution.
+ """
+ input_type = (isinstance(low, NDArray), isinstance(high, NDArray))
Review comment:
We should not allow `NDArray` as input type. Only `mxnet.numpy.ndarray` is
allowed.
----------------------------------------------------------------
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