PythonBiglove 2018-10-25
downsample 在最新版本里面修改了位置
from theano.tensor.single import downsample (旧版本)
上面以上的的import会有error raise:
from theano.tensor.signal import downsample
ImportError: cannot import name 'downsample'
找到from theano.tensor.single import downsample所在文件,如:
...\lib\site-packages\lasagne\layers\pool.py
把 from theano.tensor.signal import downsample注释掉,改为
from theano.tensor.signal.pool import pool_2d
代码中运用到downsample的地方也要改掉
# 子采样 pooled_out = downsample.max_pool_2d( input=conv_out, ds=poolsize, ignore_border=True )
这里直接将downsample改为pool会出错,因为里面相应的函数有变化
查看pool.py的源码,发现downsample.max_pool_2d()与pool. pool_2d()函数功能相同,用ws代替ds
# 子采样 pooled_out = pool.pool_2d( input=conv_out, ws=poolsize, ignore_border=True )