Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserWarning: downsample module has been moved #4337

Closed
josvanroosmalen opened this issue Apr 5, 2016 · 17 comments
Closed

UserWarning: downsample module has been moved #4337

josvanroosmalen opened this issue Apr 5, 2016 · 17 comments

Comments

@josvanroosmalen
Copy link

Hi,

I just upgraded from Theano 0.7 to 0.8, When I use:

from theano.tensor.signal import downsample

I get:

/usr/local/lib/python3.4/dist-packages/theano/tensor/signal/downsample.py:6: UserWarning: downsample module has been moved to the theano.tensor.signal.pool module. "downsample module has been moved to the theano.tensor.signal.pool module.")

But if I use:

from theano.tensor.signal.pool import downsample

I get:

ImportError: cannot import name 'downsample'

How to fix this or is this a bug?

Thanks,

Jos

@nouiz
Copy link
Member

nouiz commented Apr 5, 2016

Le 5 avr. 2016 13:41, "Jos van Roosmalen" notifications@github.com a
écrit :

Hi,

I just upgraded from Theano 0.7 to 0.8, When I use:

from theano.tensor.signal import downsample

I get:

/usr/local/lib/python3.4/dist-packages/theano/tensor/signal/downsample.py:6:
UserWarning: downsample module has been moved to the
theano.tensor.signal.pool module. "downsample module has been moved to the
theano.tensor.signal.pool module.")

But if I use:

from theano.tensor.signal.pool import downsample

Use

From Theano.tensor.signal import pool

And use the pool_2d() function.

Fred

I get:

ImportError: cannot import name 'downsample'

How to fix this or is this a bug?

Thanks,

Jos


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@nouiz nouiz closed this as completed Apr 5, 2016
@victoriastuart
Copy link

victoriastuart commented Aug 12, 2016

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( ... )

Works!

@nouiz
Copy link
Member

nouiz commented Aug 15, 2016

After this change, you should delete your Theano cache as it can still load
the old module. After that, you should not get errors anymore.

On Thu, Aug 11, 2016 at 10:27 PM, Victoria Stuart notifications@github.com
wrote:

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( ... )


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#4337 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AALC-2Vo0A3ttPvi3zcSjlsIUurEmZGAks5qe9oJgaJpZM4IAd1e
.

@victoriastuart
Copy link

Sorry, I know this thread is closed, but for anyone else searching/reading (as I did) ...

Delete Theano cache [ https://github.com//issues/3818 ]:

You can delete your theano cache with the command

theano-cache purge

If that does not work do this in python to know the path of the cache and delete this directory:

python
import theano
print theano.config.compiledir

josephwinston pushed a commit to josephwinston/VIN that referenced this issue Jan 4, 2017
avivt added a commit to avivt/VIN that referenced this issue Jan 6, 2017
@adrian1906
Copy link

adrian1906 commented Apr 6, 2017

What file(s) do I make the suggested edit?

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

to

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

I modified the base.py file using the first line: from theano.tensor.signal import pool but I'm unable to find the pooled_out line.

@victoriastuart
Copy link

victoriastuart commented Apr 6, 2017

Ahh, sorry: I should have mentioned the file! I believe that the file in question (I had to grep to find it) is:

[victoria@victoria theano]$ rg . -e "pooled_out"    ## rg: "ripgrep"
    convolutional_mlp.py
    163: #pooled_out = downsample.max_pool_2d(
    164: pooled_out = pool.pool_2d(
    174: self.output = T.tanh(pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))

i.e.

/home/victoria/projects/theano/convolutional_mlp.py

which is a file from the Theano tutorial,

http://deeplearning.net/tutorial/lenet.html

with the code linked near the top of that tutorial:

http://deeplearning.net/tutorial/code/convolutional_mlp.py

In my downloaded copy of that script (Aug 2016) I have the following edit:

...
    # downsample each feature map individually, using maxpooling
    #pooled_out = downsample.max_pool_2d(
    pooled_out = pool.pool_2d(
        input=conv_out,
        ds=poolsize,
        ignore_border=True
    )
...

It appears that the online version has been updated, perhaps in response to this Issue/thread, as "downsample.max_pool_2d" no onger appears in that file.

I hope that helps! :-)


My configuration:

Arch Linux x86_64; Intel Core i7-4790 CPU; ... Theano in Python 2.7 virtual environment ...

[victoria@victoria ~]$ thee

[Theano in Anaconda Python 2.7 venv (source activate theano-env)]

(theano-env) [victoria@victoria ~]$ which python

/home/victoria/anaconda3/envs/theano-env/bin/python

(theano-env) [victoria@victoria ~]$ python --version

Python 2.7.12 :: Anaconda custom (64-bit)

(theano-env) [victoria@victoria ~]$ P

[P: python]
Python 2.7.12 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

>>> import theano

>>> theano .__version__
'0.9.0dev1.dev-2a9da88c31f902a39b7ab280ae2a10b46887ff58'

>>> [Ctrl-D]

(theano-env) [victoria@victoria ~]$

@adrian1906
Copy link

Thank you Victoria.

@zxzhijia
Copy link

zxzhijia commented May 22, 2017

@victoriastuart Hi Victoria, I changed my code according to what you said. But it give me an error as below. I was previously using one version of theano 0.9.0. It worked well. But after I update, it doesn't work. Maybe, should reinstall theano 0.9.0 rc1?

runfile('/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10/test_convnet_new.py', wdir='/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10')
Reloaded modules: cutils_ext, tmp7SSxi_, lazylinker_ext.lazylinker_ext, data_utils, tmp7SSxi_.11617ef9bd367a3818a3537ffe37d382, lazylinker_ext, cutils_ext.cutils_ext
Compiling...
theano_layers.py:257: UserWarning: DEPRECATION: the 'ds' parameter is not going to exist anymore as it is going to be replaced by the parameter 'ws'.
impulse = downsample.max_pool_2d(inp, ds=self.poolsize, st=self.stride, ignore_border=self.ignore_border, mode='average_inc_pad')
Traceback (most recent call last):

File "", line 1, in
runfile('/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10/test_convnet_new.py', wdir='/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10')

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
execfile(filename, namespace)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)

File "/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10/test_convnet_new.py", line 136, in
main(**kargs)

File "/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10/test_convnet_new.py", line 96, in main
get_output = theano.function([input_var, input_time], [new_mem, output_time, Ntransmittedspikes, conv1_spikes, conv2_spikes, conv3_spikes], updates=updates)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/compile/function.py", line 326, in function
output_keys=output_keys)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/compile/pfunc.py", line 486, in pfunc
output_keys=output_keys)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/compile/function_module.py", line 1808, in orig_function
output_keys=output_keys)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/compile/function_module.py", line 1478, in init
optimizer_profile = optimizer(fgraph)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", line 98, in call
return self.optimize(fgraph)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", line 87, in optimize
ret = self.apply(fgraph, *args, **kwargs)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", line 241, in apply
sub_prof = optimizer.optimize(fgraph)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", line 87, in optimize
ret = self.apply(fgraph, *args, **kwargs)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", line 241, in apply
sub_prof = optimizer.optimize(fgraph)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", line 87, in optimize
ret = self.apply(fgraph, *args, **kwargs)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/opt.py", line 382, in apply
node.outputs)

File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/opt.py", line 1347, in local_gpua_error_convop
"""

AssertionError:
ConvOp does not work with the gpuarray backend.

Use the new convolution interface to have GPU convolution working:
theano.tensor.nnet.conv2d()

@nouiz
Copy link
Member

nouiz commented May 23, 2017 via email

@zxzhijia
Copy link

@nouiz I see. Thank you. I fixed that problem. But it comes up with a new error saying:

ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/init.py", line 175, in
use(config.device)
File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/init.py", line 162, in use
init_dev(device, preallocate=preallocate)
File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/init.py", line 73, in init_dev
context.cudnn_handle = dnn._make_handle(context)
File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/dnn.py", line 80, in _make_handle
cudnn = _dnn_lib()
File "/space/xzhang/anaconda2/lib/python2.7/site-packages/theano/gpuarray/dnn.py", line 67, in _dnn_lib
raise RuntimeError('Could not find cudnn library (looked for v5[.1])')
RuntimeError: Could not find cudnn library (looked for v5[.1])
Using Theano backend.
Compiling...
/space/xzhang/git_cnn_conversion/MyLasagneCode_CIFAR10/theano_layers.py:257: UserWarning: DEPRECATION: the 'ds' parameter is not going to exist anymore as it is going to be replaced by the parameter 'ws'.
impulse = pool.pool_2d(inp, ds=self.poolsize, st=self.stride, ignore_border=self.ignore_border, mode='average_inc_pad')

@loretoparisi
Copy link

loretoparisi commented Jul 20, 2017

I get this problem when using lasagne:

Traceback (most recent call last):
  File "train.py", line 11, in <module>
    import lasagne
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/__init__.py", line 19, in <module>
    from . import layers
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/layers/__init__.py", line 7, in <module>
    from .pool import *
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/layers/pool.py", line 6, in <module>
    from theano.tensor.signal import downsample
ImportError: cannot import name downsample
entailment
Traceback (most recent call last):
  File "train.py", line 11, in <module>
    import lasagne
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/__init__.py", line 19, in <module>
    from . import layers
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/layers/__init__.py", line 7, in <module>
    from .pool import *
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/layers/pool.py", line 6, in <module>
    from theano.tensor.signal import downsample
ImportError: cannot import name downsample
sentiment
Traceback (most recent call last):
  File "train.py", line 11, in <module>
    import lasagne
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/__init__.py", line 19, in <module>
    from . import layers
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/layers/__init__.py", line 7, in <module>
    from .pool import *
  File "/Users/loretoparisi/Documents/MyProjects/SIF/.env/lib/python2.7/site-packages/lasagne/layers/pool.py", line 6, in <module>
    from theano.tensor.signal import downsample
ImportError: cannot import name downsample

Using:

(.env) [loretoparisi@:mbploreto SIF]$ python -c "import theano; print theano .__version__"
0.9.0

So I have solved in this way:

(.env) [loretoparisi@:mbploreto SIF]$ pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
Collecting https://github.com/Lasagne/Lasagne/archive/master.zip
  Downloading https://github.com/Lasagne/Lasagne/archive/master.zip
     | 235kB 905kB/s
Requirement already up-to-date: numpy in ./.env/lib/python2.7/site-packages (from Lasagne==0.2.dev1)
Installing collected packages: Lasagne
  Found existing installation: Lasagne 0.1
    Uninstalling Lasagne-0.1:
      Successfully uninstalled Lasagne-0.1
  Running setup.py install for Lasagne ... done
Successfully installed Lasagne-0.2.dev1
(.env) [loretoparisi@:mbploreto SIF]$ python -c "import lasagne; print lasagne .__version__"
0.2.dev1

@loretoparisi
Copy link

I have reported it here.

@philipperemy
Copy link

From Theano.tensor.signal import pool

And use the pool_2d() function.

worked for me!

@nouiz
Copy link
Member

nouiz commented Aug 19, 2017 via email

@philipperemy
Copy link

@nouiz yes same thing happened to me. It was due to Lasagne.

@numairmansur
Copy link

If i do

import lasagne

I get

from theano.tensor.signal import downsample
ImportError: cannot import name 'downsample'

is it because of my python version ? (3.5)

@nouiz
Copy link
Member

nouiz commented Sep 25, 2017

This is because your Theano version is too recent compared to your Lasagne version.

Can you update Lasagne to the dev version on github? The one obtained with pip install lasagne is old.

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

No branches or pull requests

8 participants