Caffe常数乘法层
问题描述:
如何在Caffe中定义乘常数层(如Torch中的MulConstant).我需要将其预定义的const添加到现有网络中. Caffe无法解析我将所有内容缩放0.85的尝试:
How can I define multiply constant layer in Caffe (like MulConstant in Torch). I need to add it predefined const to existing network. Caffe fails to parse my attempt to scale everything by 0.85:
layers {
name: "caffe.ConstantMul_0"
type: "Eltwise"
bottom: "caffe.SpatialConvolution_0"
top: "caffe.ConstantMul_0"
eltwise_param {
op: MUL
coeff: 0.85
}
}
答
可以使用功率层,只需将功率设置为1即可缩放到所需的任何值:
It is possible to do with Power Layer, just set up power to 1 and scale to whatever you need:
layer {
name: "caffe.ConstantMul_1"
bottom: "caffe.SpatialConvolution_3"
top: "caffe.ConstantMul_1"
type: "Power"
power_param {
power: 1
scale: 0.85
shift: 0
}
}