bricksdont opened a new issue #19073:
URL: https://github.com/apache/incubator-mxnet/issues/19073
## Description
Multinomial sampling produces impossible values.
If I understand correctly, if `mx.random.multinomial` is given a
distribution such as:
dist = mx.nd.array([0.3, 0.2, 0.4, 0.1])
sample = mx.random.multinomial(dist)
Since, [according to the documentation, outputs are
0-indexed,](https://mxnet.incubator.apache.org/versions/1.6/api/python/docs/api/ndarray/random/index.html#mxnet.ndarray.random.multinomial)
the sample value can be either 0, 1, 2 or 3 - but never 4. But in Sockeye and
in simple tests (see below), very often 5 would be returned.
### Error Message
The actual error appears in Sockeye, please refer to this issue for details:
https://github.com/awslabs/sockeye/issues/866
To summarize, calling `random.multinomial` on some occasions returns
impossible values.
## To Reproduce
To reproduce the Sockeye error that is thrown:
https://gist.github.com/bricksdont/58dfa0964201c83961a30f23406baa5d
To reproduce the MXnet behaviour in isolation:
https://gist.github.com/bricksdont/e0304b9cc6ecbcc868368353d6e6262c
### Steps to reproduce
Run the shell scripts as indicated in the gists above, e.g.
python sample_mxnet.py --seed 1 --context cpu --num-trials 10
--dist-size 20
## Environment
We recommend using our script for collecting the diagnositc information. Run
the following command and paste the outputs below:
```
curl --retry 10 -s
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
| python
----------Python Info----------
Version : 3.5.2
Compiler : GCC 5.4.0 20160609
Build : ('default', 'Apr 16 2020 17:47:17')
Arch : ('64bit', 'ELF')
------------Pip Info-----------
Version : 20.2.2
Directory :
/net/cephfs/scratch/mathmu/map-volatility/venvs/sockeye3-cpu/lib/python3.5/site-packages/pip
----------MXNet Info-----------
Version : 1.6.0
Directory :
/net/cephfs/scratch/mathmu/map-volatility/venvs/sockeye3-cpu/lib/python3.5/site-packages/mxnet
Commit Hash : 6eec9da55c5096079355d1f1a5fa58dcf35d6752
Library :
['/net/cephfs/scratch/mathmu/map-volatility/venvs/sockeye3-cpu/lib/python3.5/site-packages/mxnet/libmxnet.so']
Build features:
✖ CUDA
✖ CUDNN
✖ NCCL
✖ CUDA_RTC
✖ TENSORRT
✔ CPU_SSE
✔ CPU_SSE2
✔ CPU_SSE3
✔ CPU_SSE4_1
✔ CPU_SSE4_2
✖ CPU_SSE4A
✔ CPU_AVX
✖ CPU_AVX2
✔ OPENMP
✖ SSE
✔ F16C
✖ JEMALLOC
✔ BLAS_OPEN
✖ BLAS_ATLAS
✖ BLAS_MKL
✖ BLAS_APPLE
✔ LAPACK
✖ MKLDNN
✔ OPENCV
✖ CAFFE
✖ PROFILER
✔ DIST_KVSTORE
✖ CXX14
✖ INT64_TENSOR_SIZE
✔ SIGNAL_HANDLER
✖ DEBUG
✖ TVM_OP
----------System Info----------
Platform : Linux-4.15.0-101-generic-x86_64-with-Ubuntu-16.04-xenial
system : Linux
node : login0
release : 4.15.0-101-generic
version : #102~16.04.1-Ubuntu SMP Mon May 11 11:38:16 UTC 2020
----------Hardware Info----------
machine : x86_64
processor : x86_64
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 8
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel Core Processor (Haswell, no TSX)
Stepping: 1
CPU MHz: 2394.454
BogoMIPS: 4788.90
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc
rep_good nopl cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1
sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand
hypervisor lahf_lm abm invpcid_single pti fsgsbase bmi1 avx2 smep bmi2 erms
invpcid xsaveopt arat
----------Network Test----------
Setting timeout: 10
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0138 sec, LOAD:
0.4219 sec.
Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403:
Forbidden, DNS finished in 0.003739595413208008 sec.
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0034
sec, LOAD: 0.5792 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0445 sec, LOAD:
0.7186 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0868 sec, LOAD:
0.2290 sec.
Timing for FashionMNIST:
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
DNS: 0.2111 sec, LOAD: 0.7232 sec.
----------Environment----------
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]