Eltwise層的操作有三個:product(點乘), sum(相加減) 和 max(取大值),其中sum是默認操作。
假設輸入(bottom)為A和B,如果要實現element_wise的A+B,即A和B的對應元素相加,prototxt文件如下:
layer { name: "eltwise_layer" type: "Eltwise" bottom: "A" bottom: "B" top: "diff" eltwise_param { operation: SUM } }
如果實現A-B,則prototxt為:
layer { name: "eltwise_layer" type: "Eltwise" bottom: "A" bottom: "B" top: "diff" eltwise_param { operation: SUM coeff: 1 coeff: -1 } }
其中A和B的系數(coefficient)都要給出!