neuralnetworksanddeeplearning 第六章的代码问题

import network3 

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

接着出现问题:

Traceback (most recent call last):
  File "", line 1, in 
  File "./network3.py", line 45, in 
    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( ... )

你可能感兴趣的:(neuralnetworksanddeeplearning 第六章的代码问题)