Search code examples
pythonconvolutiontheano

How can I get a 1D convolution in theano


The only function I can find is for 2D convolutions described here...

Is there any optimised 1D function ?


Solution

  • While I believe there's no conv1d in theano, Lasagne (a neural network library on top of theano) has several implementations of Conv1D layer. Some are based on conv2d function of theano with one of the dimensions equal to 1, some use single or multiple dot products. I would try all of them, may be a dot-product based ones will perform better than conv2d with width=1.

    https://github.com/Lasagne/Lasagne/blob/master/lasagne/theano_extensions/conv.py