Created
April 12, 2018 04:14
-
-
Save mrkn/98e4bd96068a02b173cdd5e9e4c0df2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
$ python | |
Python 3.6.4 (default, Apr 3 2018, 09:35:44) | |
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from mxnet.gluon.parameter import ParameterDict | |
>>> pd1 = ParameterDict() | |
>>> pd2 = ParameterDict() | |
>>> pd1.get('a') | |
Parameter a (shape=None, dtype=<class 'numpy.float32'>) | |
>>> pd1.get('b') | |
Parameter b (shape=None, dtype=<class 'numpy.float32'>) | |
>>> pd1.get('c') | |
Parameter c (shape=None, dtype=<class 'numpy.float32'>) | |
>>> pd2.get('d') | |
Parameter d (shape=None, dtype=<class 'numpy.float32'>) | |
>>> pd2.get('b') | |
Parameter b (shape=None, dtype=<class 'numpy.float32'>) | |
>>> pd2.get('e') | |
Parameter e (shape=None, dtype=<class 'numpy.float32'>) | |
>>> pd1 | |
( | |
Parameter a (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter b (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter c (shape=None, dtype=<class 'numpy.float32'>) | |
) | |
>>> pd2 | |
( | |
Parameter d (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter b (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter e (shape=None, dtype=<class 'numpy.float32'>) | |
) | |
>>> pd1.update(pd2) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/Users/mrkn/.pyenv/versions/3.6.4/Python.framework/Versions/3.6/lib/python3.6/site-packages/mxnet/gluon/parameter.py", line 557, in update | |
"Parameters with the same name %s"%k | |
AssertionError: Cannot update self with other because they have different Parameters with the same name b | |
>>> pd1 | |
( | |
Parameter a (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter b (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter c (shape=None, dtype=<class 'numpy.float32'>) | |
Parameter d (shape=None, dtype=<class 'numpy.float32'>) | |
) | |
>>> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment