diff --git a/examples/imdb_cnn.py b/examples/imdb_cnn.py index 0c0f0c82ce4..54096ab5601 100644 --- a/examples/imdb_cnn.py +++ b/examples/imdb_cnn.py @@ -47,7 +47,7 @@ # we start off with an efficient embedding layer which maps # our vocab indices into embedding_dims dimensions -model.add(Embedding(max_features, embedding_dims, max_length=maxlen)) +model.add(Embedding(max_features, embedding_dims, input_length=maxlen)) model.add(Dropout(0.25)) # we add a Convolution1D, which will learn nb_filter diff --git a/keras/layers/convolutional.py b/keras/layers/convolutional.py index d544392f24f..20154c3d0a6 100644 --- a/keras/layers/convolutional.py +++ b/keras/layers/convolutional.py @@ -136,9 +136,13 @@ def get_output(self, train=False): assert(self.subsample_length == 1) border_mode = 'full' + input_shape = self.input_shape + image_shape = (input_shape[0], input_shape[2], input_shape[1], 1) conv_out = T.nnet.conv.conv2d(X, self.W, border_mode=border_mode, - subsample=self.subsample) + subsample=self.subsample, + image_shape=image_shape, + filter_shape=self.W_shape) if self.border_mode == 'same': shift_x = (self.filter_length - 1) // 2 conv_out = conv_out[:, :, shift_x:X.shape[2] + shift_x, :] @@ -245,7 +249,9 @@ def get_output(self, train=False): conv_out = dnn.dnn_conv(img=X, kerns=self.W, border_mode=border_mode, - subsample=self.subsample) + subsample=self.subsample, + image_shape=self.input_shape, + filter_shape=self.W_shape) else: if border_mode == 'same': border_mode = 'full'