caffe:带有单个过滤器的转换层的总和

caffe: sum of conv layer with a single filter

我有一个尺寸为 nXmx16x1 的转换层和另一个尺寸为 nxmx1x1 的过滤器 "F"。如何将 F 与 conv 层的每个过滤器相加(结果维度:nxmx16x1)。

据我所知,eltwise 需要两个底部的大小完全相同(包括通道数)

您似乎在寻找 "Tile" layer (works like 's repmat)。沿axis: 2平铺"F"16次将使"F"与输入的形状相同,然后你可以使用"Eltwise"层:

layer {
  name: "tile_f"  
  type: "Tile"
  bottom: "F"    # input shape  n-c-h-w
  top: "tile_f"  # output shape n-c-16*h-w
  tile_param { axis: 2 tiles: 16 }  # tile along h-axis 16 times
}
# now you can eltwise!
layer {
  name: "sum_f"
  type: "Eltwise"
  bottom: "x"
  bottom: "tile_f"  # same shape as x!!
  top: "sum_f"
  eltwise_param { operation: SUM }
}