我怎样才能在theano中获得一维卷积

时间:2015-05-14 20:47:34

标签: python convolution theano

我能找到的唯一功能是2D卷积described here ......

是否有任何优化的1D功能?

3 个答案:

答案 0 :(得分:4)

看起来好像是in development。 我已经意识到我可以通过将宽度或高度指定为1 ...

来使用conv2d()函数

对于函数conv2d(),参数image_shape采用长度为4的列表:

([number_images,] height, width)

通过设置height=1width=1,它会强制它进行1D卷积。

答案 1 :(得分:3)

虽然我相信theano中没有conv1d,但Lasagne(theano顶部的神经网络库)有几个Conv1D层的实现。一些基于theano的conv2d函数,其中一个维度等于1,一些使用单个或多个点积。我会尝试所有这些,可能是基于点产品的效果优于conv2d width=1

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

答案 2 :(得分:3)

为了更具体一点,我发现这很好用:

border_mode = 'full'

[{"id" => 2,"first_name" => "Adam","city" =>"Mumbai","status" => true,"name" => "LandLord"}, {"id" => 3,"first_name" => "Charles","city" => "Delhi","status" => true,"name" => "Tenant"}, {"id" => 1,"first_name" => "Adam","city" => "Mumbai","status" => true,"name" => "ProperyBroker"} ].reduce({}) do |m, e| found = (m[e["city"]] ||= {status: e['status'], names: [], city: e['city']}) found[:names] << e['name'] m end.values 是可选的。