How to create a new layer with parameter needed to update?

84 views
Skip to first unread message

Qian Yang

unread,
Sep 29, 2017, 7:29:19 AM9/29/17
to Caffe Users
Hello, I have known how to add a new layer in caffe, which is easy for layers that do not have parameters to be updated during the training process, just like customized loss layer.

However, I want to create a layer which is similar to the convolution layer in caffe. Different from the official implementation of convolution layer, this new layer applies convolution on every feature map equally. Besides necessary forward and backward function in cpp file and some hyperparameters defined in caffe.proto, this layer has its own weights learned by training. For example, given blobs A and B as bottom data, it output the result of A*P*B, where P is the learnable parameter.

I have implemented the forward and backward functions, but do not know how to add the weights of filter to the list in which the parameters can be updated by back propagation.

Hope someone who is familiar to this problem can give some advice.

Thanks.

不爱吃猫的鱼

unread,
Oct 7, 2017, 10:21:10 AM10/7/17
to Caffe Users
You just need to add the layer parameter in caffe.proto and code the backward function to update the gradient,  caffe can auto update your paramters. refer to convLayer.

在 2017年9月29日星期五 UTC+8下午7:29:19,Qian Yang写道:
Reply all
Reply to author
Forward
0 new messages