From 2a26d2937c2412c5ece5d26587a7351dcb226b67 Mon Sep 17 00:00:00 2001 From: pa-m Date: Tue, 4 Apr 2017 19:39:27 +0200 Subject: [PATCH] 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. --- network3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/network3.py b/network3.py index 2ae74e0..ff8afa8 100644 --- a/network3.py +++ b/network3.py @@ -39,7 +39,7 @@ from theano.tensor.nnet import conv from theano.tensor.nnet import softmax from theano.tensor import shared_randomstreams -from theano.tensor.signal import downsample +from theano.tensor.signal.pool import pool_2d # Activation functions for neurons def linear(z): return z @@ -227,8 +227,8 @@ def set_inpt(self, inpt, inpt_dropout, mini_batch_size): conv_out = conv.conv2d( input=self.inpt, filters=self.w, filter_shape=self.filter_shape, image_shape=self.image_shape) - pooled_out = downsample.max_pool_2d( - input=conv_out, ds=self.poolsize, ignore_border=True) + pooled_out = pool_2d( + input=conv_out, ws=self.poolsize, ignore_border=True) self.output = self.activation_fn( pooled_out + self.b.dimshuffle('x', 0, 'x', 'x')) self.output_dropout = self.output # no dropout in the convolutional layers