sxjscience commented on a change in pull request #17325: Fix Flaky Test Higher
Order Grad
URL: https://github.com/apache/incubator-mxnet/pull/17325#discussion_r367132201
##########
File path: python/mxnet/test_utils.py
##########
@@ -102,6 +102,16 @@ def random_arrays(*shapes):
return arrays
+def random_uniform_arrays(*shapes, low=0.0, high=1.0):
+ """Generate some random numpy arrays."""
+ arrays = [np.array(np.random.uniform(low, high), dtype=default_dtype())
+ if len(s) == 0 else np.random.uniform(low, high,
size=s).astype(default_dtype())
+ for s in shapes]
Review comment:
The if-condition is not necessary. We can directly write
```python
arrays = [np.random.uniform(low, high, size=s) for s in shapes]
```
----------------------------------------------------------------
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