Skip to content

Commit

Permalink
Avoid ImportError: cannot import name 'downsample'
Browse files Browse the repository at this point in the history
Since a change in theano 0.9 downsample.max_pool_2d has to be replaced with pool.pool_2d.
  • Loading branch information
pa-m committed Apr 4, 2017
1 parent f48defe commit 2a26d29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions network3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2a26d29

Please sign in to comment.