Skip to content

Commit 797342a

Browse files
committed
Use the new pool interface
1 parent 2776035 commit 797342a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

code/convolutional_mlp.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
import theano
3434
import theano.tensor as T
35-
from theano.tensor.signal import downsample
35+
from theano.tensor.signal import pool
3636
from theano.tensor.nnet import conv2d
3737

3838
from logistic_sgd import LogisticRegression, load_data
@@ -97,8 +97,8 @@ def __init__(self, rng, input, filter_shape, image_shape, poolsize=(2, 2)):
9797
input_shape=image_shape
9898
)
9999

100-
# downsample each feature map individually, using maxpooling
101-
pooled_out = downsample.max_pool_2d(
100+
# pool each feature map individually, using maxpooling
101+
pooled_out = pool.pool_2d(
102102
input=conv_out,
103103
ds=poolsize,
104104
ignore_border=True

doc/lenet.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Convolutional Neural Networks (LeNet)
77
This section assumes the reader has already read through :doc:`logreg` and
88
:doc:`mlp`. Additionally, it uses the following new Theano functions and concepts:
99
`T.tanh`_, `shared variables`_, `basic arithmetic ops`_, `T.grad`_,
10-
`floatX`_, `downsample`_ , `conv2d`_, `dimshuffle`_. If you intend to run the
10+
`floatX`_, `pool`_ , `conv2d`_, `dimshuffle`_. If you intend to run the
1111
code on GPU also read `GPU`_.
1212

1313
To run this example on a GPU, you need a good GPU. It needs
@@ -35,7 +35,7 @@ Convolutional Neural Networks (LeNet)
3535

3636
.. _GPU: http://deeplearning.net/software/theano/tutorial/using_gpu.html
3737

38-
.. _downsample: http://deeplearning.net/software/theano/library/tensor/signal/downsample.html
38+
.. _pool: http://deeplearning.net/software/theano/library/tensor/signal/pool.html
3939

4040
.. _conv2d: http://deeplearning.net/software/theano/library/tensor/signal/conv.html#module-conv
4141

@@ -320,27 +320,27 @@ Max-pooling is useful in vision for two reasons:
320320
"smart" way of reducing the dimensionality of intermediate representations.
321321

322322
Max-pooling is done in Theano by way of
323-
``theano.tensor.signal.downsample.max_pool_2d``. This function takes as input
323+
``theano.tensor.signal.pool.pool_2d``. This function takes as input
324324
an N dimensional tensor (where N >= 2) and a downscaling factor and performs
325325
max-pooling over the 2 trailing dimensions of the tensor.
326326

327327
An example is worth a thousand words:
328328

329329
.. code-block:: python
330330

331-
from theano.tensor.signal import downsample
331+
from theano.tensor.signal import pool
332332

333333
input = T.dtensor4('input')
334334
maxpool_shape = (2, 2)
335-
pool_out = downsample.max_pool_2d(input, maxpool_shape, ignore_border=True)
335+
pool_out = pool.pool_2d(input, maxpool_shape, ignore_border=True)
336336
f = theano.function([input],pool_out)
337337

338338
invals = numpy.random.RandomState(1).rand(3, 2, 5, 5)
339339
print 'With ignore_border set to True:'
340340
print 'invals[0, 0, :, :] =\n', invals[0, 0, :, :]
341341
print 'output[0, 0, :, :] =\n', f(invals)[0, 0, :, :]
342342

343-
pool_out = downsample.max_pool_2d(input, maxpool_shape, ignore_border=False)
343+
pool_out = pool.pool_2d(input, maxpool_shape, ignore_border=False)
344344
f = theano.function([input],pool_out)
345345
print 'With ignore_border set to False:'
346346
print 'invals[1, 0, :, :] =\n ', invals[1, 0, :, :]

0 commit comments

Comments
 (0)