I am trying to build a CNN using Lasagne and I have 119 feature variables. I am able to successfully build a MLP using Lasagne but when I try to add a Convolutional layer (using 1D convolution) using the following code, I get an error. Am I doing something wrong? Has the 1D convolution in Lasagne been tested?
def build_custom_mlp(input_var, depth, width):
network = lasagne.layers.InputLayer(shape=(None, 119), input_var=input_var)
network = lasagne.layers.Conv1DLayer(network, num_filters=20, filter_size=10,
stride=1, pad=1, nonlinearity=lasagne.nonlinearities.rectify)
network = lasagne.layers.Pool1DLayer(network, pool_size=2)
nonlin = lasagne.nonlinearities.rectify
network = lasagne.layers.DenseLayer(network, width, nonlinearity=nonlin)
# Output layer:
relu = lasagne.nonlinearities.rectify
network = lasagne.layers.DenseLayer(network, 60, nonlinearity=relu)
return network
File "/Users/adityanagarajan/anaconda/lib/python2.7/site-packages/lasagne/layers/dense.py", line 63, in __init__ super(DenseLayer, self).__init__(incoming, **kwargs) File "/Users/adityanagarajan/anaconda/lib/python2.7/site-packages/lasagne/layers/base.py", line 35, in __init__ self.input_shape = incoming.output_shape File "/Users/adityanagarajan/anaconda/lib/python2.7/site-packages/lasagne/layers/base.py", line 49, in output_shape return self.get_output_shape_for(self.input_shape) File "/Users/adityanagarajan/anaconda/lib/python2.7/site-packages/lasagne/layers/conv.py", line 237, in get_output_shape_for output_length = conv_output_length(input_shape[2], IndexError: tuple index out of range