Keras: pool_2d() got an unexpected keyword argument 'ws'

Created on 15 Mar 2017  路  11Comments  路  Source: keras-team/keras

#The following github code is not consistent with keras 2.0.0.
I ran cifar10_cnn.py from examples. It is giving error in calling pool_2d(). Function arguments do not seem to be consistent.

Kindly check this.

curl -sSL https://github.com/fchollet/keras/raw/master/examples/cifar10_cnn.py | python

Using Theano backend.
x_train shape: (50000, 32, 32, 3)
50000 train samples
10000 test samples
/home/abhijeet/miniconda2/lib/python2.7/site-packages/keras/backend/theano_backend.py:1703: UserWarning: ['filter_dilation'] are now deprecated in tensor.nnet.abstract_conv.conv2d interface and will be ignored.
filter_dilation=dilation_rate)
Traceback (most recent call last):
File "", line 45, in
File "/home/abhijeet/miniconda2/lib/python2.7/site-packages/keras/models.py", line 455, in add
output_tensor = layer(self.outputs[0])
File "/home/abhijeet/miniconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 545, in __call__
output = self.call(inputs, **kwargs)
File "/home/abhijeet/miniconda2/lib/python2.7/site-packages/keras/layers/pooling.py", line 154, in call
data_format=self.data_format)
File "/home/abhijeet/miniconda2/lib/python2.7/site-packages/keras/layers/pooling.py", line 217, in _pooling_function
pool_mode='max')
File "/home/abhijeet/miniconda2/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 1833, in pool2d
mode='max')
TypeError: pool_2d() got an unexpected keyword argument 'ws'

Most helpful comment

Updating to the latest version of Theano via

pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

worked for me.

All 11 comments

In theano 0.8, I believe the argument is ds. It seems that the code is intended for theano 0.9.

okay...i will check and close the issue if that is the case.

Any progress?

Updating to the latest version of Theano via

pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

worked for me.

Sorry for not updating.
Installed latest version of Theano and it worked for me. Though i had some different issue with 'sudo'.

Thanks @AvantiShri @vadimnazarov for help.
Closing the issue.

Unfortunately, I have the same problem as mentioned above.
Trying to run the tutorial example taken from
https://elitedatascience.com/keras-tutorial-deep-learning-in-python
I obtained the following error:

Using Theano backend.
WARNING (theano.gof.cmodule): WARNING: your Theano flags gcc.cxxflags specify an -march=X flags.
It is better to let Theano/g++ find it automatically, but we don't do it now
Traceback (most recent call last):
File "keras-proba.py", line 37, in
model.add(MaxPooling2D(pool_size=(2,2)))
File "/home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/keras/models.py", line 455, in add
output_tensor = layer(self.outputs[0])
File "/home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/keras/engine/topology.py", line 554, in __call__
output = self.call(inputs, **kwargs)
File "/home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/keras/layers/pooling.py", line 154, in call
data_format=self.data_format)
File "/home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/keras/layers/pooling.py", line 217, in _pooling_function
pool_mode='max')
File "/home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/keras/backend/theano_backend.py", line 1856, in pool2d
mode='max')
TypeError: pool_2d() got an unexpected keyword argument 'ws'

Theano version:
Name: Theano
Version: 0.9.0.dev2
Summary: Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.
Home-page: http://deeplearning.net/software/theano/
Author: LISA laboratory, University of Montreal
Author-email: [email protected]
License: BSD
Location: /home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/Theano-0.9.0.dev2-py2.7.egg
Requires: numpy, scipy, six

Keras version:
Name: Theano
Version: 0.9.0.dev2
Summary: Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.
Home-page: http://deeplearning.net/software/theano/
Author: LISA laboratory, University of Montreal
Author-email: [email protected]
License: BSD
Location: /home/michael/anaconda2/envs/pcs_theano_2/lib/python2.7/site-packages/Theano-0.9.0.dev2-py2.7.egg
Requires: numpy, scipy, six

Updating to the latest version of Theano via

pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
worked for me.
馃憤 5

it works for me too. thx

@vadimnazarov @OOMMYY i upgrade the theano,but it show me

ValueError: You are tring to use the old GPU back-end. It was removed from Theano. Use device=cuda* now. See https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29 for more information.

How do solve it? Thanks.

I use anaconda, how can I update it? pip is nouse

conda install -c conda-forge theano=0.9.0
I use this command and solve the problem.
My environment is win10 + pychrom + keras (theano backend )

conda install -c conda-forge theano=0.9.0
I use this command on my Mac OS X, still not solved the problem:
TypeError: pool_2d() got an unexpected keyword argument 'ws'

Mac OS X EI Capitan
Keras 2.0.6, backend is theano 0.9
Python 2.7.13
Anaconda 4.3.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EderSantana picture EderSantana  路  219Comments

ayalalazaro picture ayalalazaro  路  90Comments

patyork picture patyork  路  73Comments

parag2489 picture parag2489  路  64Comments

xieximeng2008 picture xieximeng2008  路  74Comments