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/10/30 07:50:44 UTC

[GitHub] [incubator-mxnet] canerturkmen opened a new issue #16049: Gluon HybridBlock instantiation with params compares initializers

canerturkmen opened a new issue #16049: Gluon HybridBlock instantiation with params compares initializers
URL: https://github.com/apache/incubator-mxnet/issues/16049
 
 
   ## Description
   HybridBlocks do not initialize with params when parameter initializers are explicitly given, and two initializers don't match (by reference).
   
   ## Environment info (Required)
   ```
   ----------Python Info----------
   Version      : 3.6.5
   Compiler     : GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.10.44.4)
   Build        : ('default', 'Aug 19 2019 21:45:20')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 9.0.3
   Directory    : /Users/caner/VENVS/mxnet/lib/python3.6/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.5.0
   Directory    : /Users/caner/VENVS/mxnet/lib/python3.6/site-packages/mxnet
   Commit Hash   : 75a9e187d00a8b7ebc71412a02ed0e3ae489d91f
   Library      : ['/Users/caner/VENVS/mxnet/lib/python3.6/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
   ----------System Info----------
   Platform     : Darwin-17.7.0-x86_64-i386-64bit
   system       : Darwin
   node         : caner.local
   release      : 17.7.0
   version      : Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
   ----------Hardware Info----------
   machine      : x86_64
   processor    : i386
   b'machdep.cpu.brand_string: Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz'
   b'machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C'
   b'machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM SMAP RDSEED ADX IPT SGX FPU_CSDS MPX CLFSOPT'
   b'machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI'
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0194 sec, LOAD: 0.9172 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.1381 sec, LOAD: 0.4366 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.3400 sec, LOAD: 1.0238 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.1015 sec, LOAD: 1.1239 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0782 sec, LOAD: 1.3505 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0280 sec, LOAD: 0.2009 sec.
   ----------Environment----------
   ```
   ## Error Message:
   ```
   ---------------------------------------------------------------------------
   AssertionError                            Traceback (most recent call last)
   <ipython-input-1-3346a22eb7cb> in <module>
        20 
        21 MyBlock(
   ---> 22     params=bl.collect_params()
        23 )
   
   <ipython-input-1-3346a22eb7cb> in __init__(self, **kwargs)
        11                 shape=(1,),
        12                 allow_deferred_init=False,
   ---> 13                 init=mx.init.Constant(-10.0),
        14             )
        15 
   
   ~/VENVS/mxnet/lib/python3.6/site-packages/mxnet/gluon/parameter.py in get(self, name, **kwargs)
       784                         "does not match with stored for attribute '%s': " \
       785                         "desired '%s' vs stored '%s'."%(
   --> 786                             name, k, str(v), str(getattr(param, k)))
       787                 else:
       788                     setattr(param, k, v)
   
   AssertionError: Cannot retrieve Parameter 'myblock0_some_param' because desired attribute does not match with stored for attribute 'init': desired '<mxnet.initializer.Constant object at 0x10c55e400>' vs stored '<mxnet.initializer.Constant object at 0x10bb41e80>'.
   ```
   
   ## Minimum reproducible example
   ```python
   import mxnet as mx
   from mxnet import gluon
   
   class MyBlock(gluon.HybridBlock):
       def __init__(self, **kwargs):
           super().__init__(**kwargs)
   
           with self.name_scope():
               self.some_param = self.params.get(
                   "some_param",
                   shape=(1,),
                   allow_deferred_init=False,
                   init=mx.init.Constant(-10.0),
               )
               
   bl = MyBlock()
   
   bl.collect_params()
   bl.initialize()
   
   MyBlock(
       params=bl.collect_params()
   )
   ```
   
   ## Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1.
   2.
   
   ## What have you tried to solve it?
   
   1.
   2.
   

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