This series of articles produced by the @yhl_leo, reproduced please indicate the source.
Article Link: http://blog.csdn.net/yhl_leo/article/details/52185521
(The last two days this blog accidentally deleted by their own changes, and now to fill up.) )
Caffe version has been constantly updated, the new version will often contain some new layer, if only want to transplant the layer to their own project version, how to do it. See the online tutorials on adding new layer: Add a class declaration for your layer to the appropriate one of COMMON_LAYERS.HPP, DATA_LAYERS.HPP, L OSS_LAYERS.HPP, NEURON_LAYERS.HPP, or VISION_LAYERS.HPP. Include an inline implementation of type and the *blobs () methods to specify BLOB number requirements. Omit the *_GPU declarations if you'll be implementing CPU code. Implement your layer in Layers/your_layer.cpp. SetUp for initialization:reading parameters, allocating buffers, etc. Forward_cpu for the function your layer computes BACKWARD_CPU to its gradient (Optional) implement the GPU versions Forwa Rd_gpu and Backward_gpu in Layers/your_layer.cu. Add your layer to Proto/caffe.proto, updating the next available ID. Also declare parameters, if needed, in this file. Make your layer createable by adding it to layer_factory.cpp. Write tests in Test/test_your_layer.cpp. Use TEST/TEST_GRADIENT_CHECK_UTIL.HPP to check that your Forward and BackwarD implementations are in numerical agreement.
However, this method is not necessarily useful to the transplant, take Croplayer as an example, according to the above method is certainly not feasible, the compilation process will repeatedly appear on the function Diagonalaffinemap error. To view version update records: Crop layer for automatically aligning computations, you can find that the original is not just add two files so simple things, according to the difference of version update, file changes can be used.
Therefore, for porting, direct search for version update records is a more direct and efficient approach.