template
void SoftmaxWithLossLayer::LayerSetUp(
const vector>& bottom, const vector>& top) {
LossLayer::LayerSetUp(bottom, top); //创建时动态修改本层的laterparemeter参数适应softmaxlayer,当前的参数添加非0权重
LayerParameter softmax_param(this->layer_param_);//获取本层的参数
softmax_param.set_type("Softmax"); //取名
softmax_layer_ = LayerRegistry::CreateLayer(softmax_param); //注册(以softmax名字索引该层,并且以其参数来初始化该layer,且返回该类型的layer)
softmax_bottom_vec_.clear();
softmax_bottom_vec_.push_back(bottom[0]); //设置该层的输入blob
softmax_top_vec_.clear();
softmax_top_vec_.push_back(&prob_); //设置该layer的输出blob (1*1)
softmax_layer_->SetUp(softmax_bottom_vec_, softmax_top_vec_); //本方法实现了吗?
在layer.hpp有中
void SetUp(const vector>& bottom,
const vector>& top) {
InitMutex();
CheckBlobCounts(bottom, top);
LayerSetUp(bottom, top);
Reshape(bottom, top);
SetLossWeights(top);
}
softmax继承了layer类但是他们两个都没有实现layer.hpp中的LayerSetUp方法,怎么能在softmax_layer_调用呢?
SetUp方法呢?