You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/08/07 02:02:48 UTC
[GitHub] [incubator-mxnet] ChaiBapchya opened a new pull request #15772: Add
symbol api for randn and fix shape issue for randn ndarray and symbol api
ChaiBapchya opened a new 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
## Description ##
1. Randn is not currently present in symbol API
Fixes https://github.com/apache/incubator-mxnet/issues/12755
2. Currently randn gives issue when passed NDArray to the randn function parameters loc and scale
```
>>> mx.nd.random.randn((2, 3), loc=a, scale=a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/bapac/workspace/incubator-mxnet/python/mxnet/ndarray/random.py", line 223, in randn
assert isinstance(loc, (int, float))
AssertionError
```
## Checklist ##
### Essentials ###
Please feel free to remove inapplicable items for your PR.
- [ ] Changes are complete (i.e. I finished coding on this PR)
- [ ] All changes have test coverage:
- [ ] Code is well-documented:
- [ ] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change
### Changes ###
Original works as well
loc and scale scalar
```
>>> mx.nd.random.randn(2, 3, loc=5, scale=1)
[[7.2122064 5.774004 6.0434403]
[6.1839256 6.891711 3.7652586]]
<NDArray 2x3 @cpu(0)>
```
loc and scale as NDArray
```
>>> a=mx.nd.array([[1,2],[3,4]])
>>> a
[[1. 2.]
[3. 4.]]
<NDArray 2x2 @cpu(0)>
>>> mx.nd.random.randn(2, 3, loc=a, scale=a)
[[[[-0.771029 0.5486156 1.5793836 ]
[-0.85608196 -0.9768796 0.7919808 ]]
[[ 2.4888437 1.9256786 1.0245001 ]
[ 1.9547654 3.1492283 4.9322524 ]]]
[[[ 5.0588713 4.064883 6.2195086 ]
[ 3.3605237 0.08666945 0.6729102 ]]
[[ 0.8471296 6.967091 -1.8937755 ]
[-0.29237127 -0.16993093 -1.3115396 ]]]]
<NDArray 2x2x2x3 @cpu(0)>
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services