neuralnetworksanddeeplearning 第六章的代码问题

import network3 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Volumes/File/Dropbox/0uci_classes/ICS274/neural-networks-and-deep-learning/env/lib/python2.7/site-packages/theano/__init__.py", line 55, in <module>
    from theano.compile import \
  File "/Volumes/File/Dropbox/0uci_classes/ICS274/neural-networks-and-deep-learning/env/lib/python2.7/site-packages/theano/compile/__init__.py", line 9, in <module>
    from theano.compile.function_module import *
  File "/Volumes/File/Dropbox/0uci_classes/ICS274/neural-networks-and-deep-learning/env/lib/python2.7/site-packages/theano/compile/function_module.py", line 16, in <module>
    from theano import gof
ImportError: cannot import name gof

参考这个给出的解决办法:

pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

之后又出现如下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./network3.py", line 40, in <module>
    import theano
  File "/Volumes/File/Dropbox/0uci_classes/ICS274/neural-networks-and-deep-learning/env/lib/python2.7/site-packages/theano/__init__.py", line 72, in <module>
    from six import PY3
ImportError: No module named six
pip isntall six

接着出现问题:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./network3.py", line 45, in <module>
    from theano.tensor.signal import downsample
ImportError: cannot import name downsample

参考这里 得到解决办法。是因为 theano 不支持 downsample。

通过修改 network3 :change

from theano.tensor.signal import downsample
...
pooled_out = downsample.max_pool_2d( ... )

to:

from theano.tensor.signal import pool
...
pooled_out = pool.pool_2d( ... )

猜你喜欢

转载自blog.csdn.net/weixin_33965305/article/details/86803860