You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/12/28 11:34:17 UTC

[GitHub] [incubator-mxnet] dibgerge opened a new issue #19720: `Distribution` repr fails if cached_property not initialized

dibgerge opened a new issue #19720:
URL: https://github.com/apache/incubator-mxnet/issues/19720


   ## Description
   When defining a `Categorical` distribution using `logit` and then trying to display the distribution in the repl, it failed due to `KeyError: prob`. This error will happen to any distribution which contains `cached_properties` as part of its arguments declared `arg_contraints`.    
   
   ### Error Message
   ```python
   ~/workplace/incubator-mxnet/python/mxnet/gluon/probability/distributions/distribution.py in __repr__(self)
       181         if 'symbol' not in mode.__name__:
       182             for k, _ in self.arg_constraints.items():
   --> 183                 v = self.__dict__[k]
       184                 if isinstance(v, Number):
       185                     shape_v = ()
   
   KeyError: 'prob'
   ```
   ## To Reproduce
   
   ```python
   from mxnet import np
   from mxnet.gluon.probability import Categorical
   
   a = np.array([1, 2, 3])
   dist = Categorical(1, logit=a)
   
   >>> dist
   
   #KeyError
   ```
   
   ## What have you tried to solve it?
   
   Simply calling the undeclared `cached_property` first solves it. That is: 
   
   ```python
   a = np.array([1, 2, 3])
   dist = Categorical(1, logit=a)
   dist.prob
   
   >>> dist
   
   # Categorical(prob: size (3,), logit: size (3,), F: mxnet.ndarray, event_dim: 0)
   # ...Works
   ```
   
   ## Environment
   
   ***We recommend using our script for collecting the diagnostic information with the following command***
   `curl --retry 10 -s https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py | python3`
   
   <details>
   <summary>Environment Information</summary>
   
   ```
   ----------Python Info----------
   Version      : 3.7.8
   Compiler     : GCC 7.5.0
   Build        : ('default', 'Nov 17 2020 23:45:15')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 20.3.3
   Directory    : /home/ubuntu/software/anaconda3/envs/deep/lib/python3.7/site-packages/pip
   ----------MXNet Info-----------
   Version      : 2.0.0
   Directory    : /home/ubuntu/workplace/incubator-mxnet/python/mxnet
   Commit hash file "/home/ubuntu/workplace/incubator-mxnet/python/mxnet/COMMIT_HASH" not found. Not installed from pre-built package or built from source.
   Library      : ['/home/ubuntu/workplace/incubator-mxnet/python/mxnet/../../build/libmxnet.so']
   Build features:
   ✔ CUDA
   ✔ CUDNN
   ✖ NCCL
   ✖ TENSORRT
   ✖ CUTENSOR
   ✔ 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
   ✖ DIST_KVSTORE
   ✔ INT64_TENSOR_SIZE
   ✔ SIGNAL_HANDLER
   ✖ DEBUG
   ✖ TVM_OP
   ----------System Info----------
   Platform     : Linux-5.4.0-1030-aws-x86_64-with-debian-buster-sid
   system       : Linux
   node         : ip-172-31-43-72
   release      : 5.4.0-1030-aws
   version      : #31~18.04.1-Ubuntu SMP Tue Nov 17 10:48:34 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):              36
   On-line CPU(s) list: 0-35
   Thread(s) per core:  2
   Core(s) per socket:  18
   Socket(s):           1
   NUMA node(s):        1
   Vendor ID:           GenuineIntel
   CPU family:          6
   Model:               85
   Model name:          Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
   Stepping:            4
   CPU MHz:             1505.072
   BogoMIPS:            5999.99
   Hypervisor vendor:   KVM
   Virtualization type: full
   L1d cache:           32K
   L1i cache:           32K
   L2 cache:            1024K
   L3 cache:            25344K
   NUMA node0 CPU(s):   0-35
   Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0019 sec, LOAD: 0.7875 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0360 sec, LOAD: 0.0374 sec.
   Error open Gluon Tutorial(cn): https://zh.gluon.ai, <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)>, DNS finished in 0.008315324783325195 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0127 sec, LOAD: 0.1201 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0018 sec, LOAD: 0.0826 sec.
   Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403: Forbidden, DNS finished in 0.0003726482391357422 sec.
   ```
   
   </details>
   


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] szha closed issue #19720: `Distribution` repr fails if cached_property not initialized

Posted by GitBox <gi...@apache.org>.
szha closed issue #19720:
URL: https://github.com/apache/incubator-mxnet/issues/19720


   


----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org