8

I am using Theano. The OS is Ubuntu. The Theano is UPTODATE. I am wondering why I am getting by from theano.tensor.signal.downsample import max_pool_2d command.

ImportError: No module named downsample.

Amn Kh
  • 531
  • 3
  • 7
  • 19

4 Answers4

8

update theano and lasagne

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

Lasagne vs Theano possible version mismatch (Windows)

Zhu Xiaohu
  • 589
  • 6
  • 8
5

The downsample module has been moved to pool, so try declaring it as:

from theano.tensor.signal.pool import pool_2d

After changing delete your theano cache with the command:

theano-cache purge
l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • `theano-cache purge File "", line 1 theano-cache purge ^ SyntaxError: invalid syntax` – Amn Kh Sep 14 '16 at 23:56
  • Try doing the following ( [code here](https://gist.github.com/anonymous/afa341ef477eb95a1ebcda44f7f967b6) ) to find the location of the cache, that's what you'll want to delete to make sure the imports are updated. – l'L'l Sep 15 '16 at 00:04
  • Thank you. It gives me an address. What is the next? – Amn Kh Sep 15 '16 at 00:08
  • You'll want to delete the contents, as it's the cache which contains outdated imports. – l'L'l Sep 15 '16 at 00:09
  • Thank you. Now. `ImportError: No module named Theano.tensor.signal.pool` – Amn Kh Sep 15 '16 at 00:12
  • It should be **lowercase** "theano", not "Theano". As a test try doing the following: https://gist.github.com/anonymous/8a65c27f4e65e0ed5ad8ce124dab36af – l'L'l Sep 15 '16 at 00:15
  • 1
    ^ did you try lowercase "theano"? If the error persists then you must not have a completely current version -- `sudo pip install --upgrade --no-deps theano` – l'L'l Sep 15 '16 at 00:25
1

Try to update the Theano using this link.

pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
Gunjan naik
  • 501
  • 1
  • 7
  • 18
1

Same issue [theano v.0.9.0dev1.dev-2...]; changed

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

to

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

in /lib/python2.7/site-packages/lasagne/layers/pool.py

Prakhar Agarwal
  • 2,724
  • 28
  • 31