Skip to content

Commit 2a26d29

Browse files
committed
Avoid ImportError: cannot import name 'downsample'
Since a change in theano 0.9 downsample.max_pool_2d has to be replaced with pool.pool_2d.
1 parent f48defe commit 2a26d29

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

network3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from theano.tensor.nnet import conv
4040
from theano.tensor.nnet import softmax
4141
from theano.tensor import shared_randomstreams
42-
from theano.tensor.signal import downsample
42+
from theano.tensor.signal.pool import pool_2d
4343

4444
# Activation functions for neurons
4545
def linear(z): return z
@@ -227,8 +227,8 @@ def set_inpt(self, inpt, inpt_dropout, mini_batch_size):
227227
conv_out = conv.conv2d(
228228
input=self.inpt, filters=self.w, filter_shape=self.filter_shape,
229229
image_shape=self.image_shape)
230-
pooled_out = downsample.max_pool_2d(
231-
input=conv_out, ds=self.poolsize, ignore_border=True)
230+
pooled_out = pool_2d(
231+
input=conv_out, ws=self.poolsize, ignore_border=True)
232232
self.output = self.activation_fn(
233233
pooled_out + self.b.dimshuffle('x', 0, 'x', 'x'))
234234
self.output_dropout = self.output # no dropout in the convolutional layers

0 commit comments

Comments
 (0)