Caffe layer transplant methods between different versions _caffe

Source: Internet
Author: User


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.