[关闭]
@nrailgun 2016-04-09T20:46:19.000000Z 字数 555 阅读 1654

Add you own Layer to Caffe

程序设计


This article is based on Caffe .99.

Add class declaration to suitable head. For example, I put my GMaskLayer in neuron_layers.hpp. Put corresponding implementations in src/caffe/gmask_layer.cpp and src/caffe/gmask_layer.cu.

In CPU version, add

  1. INSTANTIATE_CLASS(GMaskLayer);
  2. REGISTER_LAYER_CLASS(GMask);

INSTANTIATE_CLASS and REGISTER_LAYER_CLASS are defined in layer_factory.hpp, which construct a global object, and add (name, layer) pair to layer_factory.

In GPU version, add

  1. INSTANTIATE_LAYER_GPU_FUNCS(GMaskLayer);

which instantiate template Forward_gpu and Backward_gpu for float and double.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注