Steps to add a new layer in caffe
1. Add caffe/include/caffe/layers/.hpp file
2. Add caffe/src/caffe/layers/.cpp file, if you want to use GPU, also write .cu file
3. Modify src/caffe/proto/caffe.proto file: Change two places, as follows
3.1 One is to add a unique ID number to the message LayerParameter {}, be careful not to repeat it;
3.2 The other is to define the parameters of the added layer at any position later, such as message InnerProductParameter {}
4. Steps to recompile caffe:
make clean;
make all -j4 ;
make test ;
make runtest ;
make pycaffe