@nrailgun
2016-04-09T20:46:19.000000Z
字数 555
阅读 1654
程序设计
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
INSTANTIATE_CLASS(GMaskLayer);
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
INSTANTIATE_LAYER_GPU_FUNCS(GMaskLayer);
which instantiate template Forward_gpu
and Backward_gpu
for float
and double
.