1.参考资料
image.png其中在In[7]中报错:
/home/deeplearning/anaconda3/bin/python /home/deeplearning/PycharmProjects/pyworker/com/xiuhong/mxnet/gression/demo.py
/home/deeplearning/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py:46: DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead
import OpenSSL.SSL
Traceback (most recent call last):
File “/home/deeplearning/PycharmProjects/pyworker/com/xiuhong/mxnet/gression/demo.py”, line 11, in
print(pd)
File “/home/deeplearning/anaconda3/lib/python3.6/site-packages/mxnet/gluon/parameter.py”, line 484, in repr
for v in self.values()]))
File “/home/deeplearning/anaconda3/lib/python3.6/site-packages/mxnet/gluon/parameter.py”, line 484, in
for v in self.values()]))
File “/home/deeplearning/anaconda3/lib/python3.6/site-packages/mxnet/gluon/parameter.py”, line 120, in repr
return s.format(**self.dict)
KeyError: ‘shape’
Process finished with exit code 1
2.解决
是mxnet1.0的parameter的bug。如果你不想从源码再安装一遍的话,可以在源代码parametr.py里面把报错那行换成pull request里面的那句就行了:
return s.format(**self.__dict__)
换成return s.format(name=self.name, shape=self.shape, dtype=self.dtype)
参考地址:
https://discuss.gluon.ai/t/topic/3626/2
https://github.com/apache/incubator-mxnet/commit/d77d937eaf7e13a30320368d316516bd9da52ca5
网友评论