版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaoxu2050/article/details/82872621
构造函数
//头文件 include/caffe/layer.hpp
//实现文件 src/caffe/layer.cpp
// src/caffe/layer.cu
/*
* 构造函数
* 子类中修改构造函数,自定义设置在SetUp()中设置
*/
explicit Layer(const LayerParameter ¶m)
protect 变量
/** The protobuf that stores the layer parameters */
//存储layer参数的protobuf对象
LayerParameter layer_param_;
/** The phase: TRAIN or TEST */
//哪个阶段, TRAIN还是TEST
Phase phase_;
/** The vector that stores the learnable parameters as a set of blobs. */
//blobs,保存需要学习的的参数
vector<shared_ptr<Blob<Dtype> > > blobs_;
/** Vector indicating whether to compute the diff of each param blob. */
//数组,表征需要学习的参数blob是否需要计算梯度
vector<bool> param_propagate_down_;
/** The vector that indicates whether each top blob has a non-zero weight in
* the objective function. */
//数组,表征每个top blob是否在目标函数中具有非零权重
vector<Dtype> loss_;
常见操作:
//ReshapLike(),输入与输出层形状保持一致
top[0]->ReshapeLike(*bottom[0]);