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/06/17 00:31:32 UTC
[GitHub] [incubator-mxnet] chinakook commented on issue #15231:
mxnet.nd.random.multinomial is very slow on CPU and stucked on GPU
chinakook commented on issue #15231: mxnet.nd.random.multinomial is very slow on CPU and stucked on GPU
URL: https://github.com/apache/incubator-mxnet/issues/15231#issuecomment-502499170
You can get nearly the same result as mx.nd.random.multinomial, but very swift.
```python
sample_list = []
p = [1 / 300000.] * 300000
probs = np.array(p)
sample_times = np.random.multinomial(len(probs), np.array(probs))
for i, t in enumerate(sample_times):
if t > 0:
sample_list.extend([i]*t)
random.shuffle(sample_list)
```
----------------------------------------------------------------
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