zhuzilin commented on a change in pull request #8041:
URL: https://github.com/apache/tvm/pull/8041#discussion_r632978037
##########
File path: python/tvm/relay/op/random/kernel.py
##########
@@ -132,3 +132,52 @@ def foo(key):
:py:func:`threefry_generate`.
"""
return _make.threefry_split(key)
+
+
+def uniform(key, shape, dtype="float32", low=0.0, high=1.0):
+ """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.
+
+ Example
+ -------
+
+ .. code-block:: python
+
+ key = threefry_key(0)
+ random_values = uniform(key, (100,), low=0, high=10)
+
+ Parameters
+ ----------
+ key : relay.Expr
+ key that uniquely determines the random values. Multiple uses with the
+ same generator will generate the same random values. This generator
should be
+ treated as an opaque pointer. You can create one from calling
+ :py:func:`threefry_key`, :py:func:`threefry_split`, or
+ :py:func:`threefry_generate`. **Do not use this generator again after
calling
+ this function.**
+
+ shape : Sequence[int]
+ Desired outputs shape of random numbers.
+
+ dtype : str
+ Desired outputs type of random numbers.
+
+ low : float or relay.Expr, optional
+ Lower bound of the uniform distribution.
+
+ high : float or relay.Expr, optional
+ Upper bound of the uniform distribution.
+
+ Returns
Review comment:
Agree~ I've updated the output.
--
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]