Caffe 入门:Eltwise层

Eltwise层的操作有三个:product(点乘),sum(相加减) max(取大值),其中sum是默认操作。

  假设输入(bottom)为AB,如果要实现element_wiseA+B,即AB的对应元素相加,prototxt文件如下:

layer 
{
  name: "eltwise_layer"
  type: "Eltwise"
  bottom: "A"
  bottom: "B"
  top: "diff"
  eltwise_param {
    operation: SUM
    coeff: 1 # 可删除
    coeff: 1 # 可删除
  }
}

如果实现A-B,则prototxt为:

layer 
{
  name: "eltwise_layer"
  type: "Eltwise"
  bottom: "A"
  bottom: "B"
  top: "diff"
  eltwise_param {
    operation: SUM
    coeff: 1
    coeff: -1
  }
}

其中AB的系数(coefficient)都要给出!

发布了185 篇原创文章 · 获赞 873 · 访问量 127万+

猜你喜欢

转载自blog.csdn.net/duan19920101/article/details/102615563