Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

ImportError: cannot import name downsample #235

Open
zyui opened this issue Apr 24, 2017 · 17 comments
Open

ImportError: cannot import name downsample #235

zyui opened this issue Apr 24, 2017 · 17 comments

Comments

@zyui
Copy link

zyui commented Apr 24, 2017

`from sknn import ae
import numpy as np
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)

x = np.asarray(range(0,16))

nn = ae.AutoEncoder(
layers=[
ae.Layer("Sigmoid", units=4),
ae.Layer("Sigmoid", units=8),
ae.Layer("Sigmoid", units=4)
],
learning_rate=0.02)
nn.fit(x)`

And then comes the arror_Traceback (most recent call last):
File "/Users/zzzyui/Desktop/CSE514A/hw4/ae1.py", line 17, in
learning_rate=0.02)
File "/Library/Python/2.7/site-packages/sknn/nn.py", line 513, in init
self._setup()
File "/Library/Python/2.7/site-packages/sknn/ae.py", line 100, in setup
backend.setup()
File "/Library/Python/2.7/site-packages/sknn/backend/init.py", line 24, in setup
from . import lasagne
File "/Library/Python/2.7/site-packages/sknn/backend/lasagne/init.py", line 5, in
from .mlp import MultiLayerPerceptronBackend
File "/Library/Python/2.7/site-packages/sknn/backend/lasagne/mlp.py", line 25, in
import lasagne.layers
File "/Library/Python/2.7/site-packages/lasagne/init.py", line 19, in
from . import layers
File "/Library/Python/2.7/site-packages/lasagne/layers/init.py", line 7, in
from .pool import *
File "/Library/Python/2.7/site-packages/lasagne/layers/pool.py", line 6, in
from theano.tensor.signal import downsample
ImportError: cannot import name downsample

@MarcAbonce
Copy link

Related to #234.
The only workaround I found for now is to force pip to downgrade Theano to 0.7.

@dibidave
Copy link

This issue is happening because the latest released version of Lasagne (0.1) still uses downsample from Theano, but the latest released of Theano no longer supports downsample. @zyui @a01200356 If you prefer to use the newest version of Theano, you could alternatively upgrade Lasagne to the development version via pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip (a la http://lasagne.readthedocs.io/en/latest/user/installation.html)

@609805584
Copy link

change from theano.tensor.signal.pool import max_pool_2d
to from theano.tensor.signal.pool import pool_2d

@ovcharenkoo
Copy link

@dibidave Worked for me, thanks!

@NalaLionQueen
Copy link

@dibidave It works for me! Thank you!

@Jaircito
Copy link

@dibidave worked for me, thank you!

@msiraj83
Copy link

msiraj83 commented Nov 6, 2017

@dibidave ..thanks its work for me..

@syys96
Copy link

syys96 commented Jan 4, 2018

@dibidave It works for me, thank you!

@pyrole
Copy link

pyrole commented Jan 29, 2018

@dibidave, Thanks..that worked

@t-rodriguez
Copy link

Worked for me too, thanks, @dibidave.

@ynandwan
Copy link

ynandwan commented Apr 5, 2018

@dibidave Thanks! It worked

@quanap5
Copy link

quanap5 commented May 9, 2018

Thank you so much @dibidave It worked .

@anbai106
Copy link

anbai106 commented Sep 5, 2018

Sorry to reask this question again:

I installed the theano with version of 1.0.2, but I can not import the downsample module, I saw several posts for the same issue, and I tried to upgrade the version of Lasagne
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

, but it did not work for me.

I saw that the question was asked with theano for version of 0.8. So I wonder if anyone has the same issue for the lasted version of theano and has some workaround?

Thanks in advance

@gabefair
Copy link

pip install -I theano==0.7 for anyone who needs it

@khodjabekova
Copy link

@dibidave Thanks a lot!!!

@nhanph
Copy link

nhanph commented Sep 12, 2019

@dibidave that works for me too. Thanks a lot!

@bhavikapanara
Copy link

You just need to install Theano & Lasagne again by following commands.

pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests