This repository was archived by the owner on Jul 3, 2025. It is now read-only.
This repository was archived by the owner on Jul 3, 2025. It is now read-only.
Open
Description
在我的应用里,发现带BN+scale结构推理速度更快;但是,我发现scale.cpp不支持bias的参数预加载,即在网络初始化时,无法提前规划权重。我觉得可以采用caffe源码中的实现,将57-59行
bias_param_id_ = this->blobs_.size();
this->blobs_.resize(bias_param_id_ + 1);
this->blobs_[bias_param_id_] = bias_layer_->blobs()[0];
替换为:
if (this->blobs_.size() + bottom.size() < 3) {
// case: blobs.size == 1 && bottom.size == 1
// or blobs.size == 0 && bottom.size == 2
bias_param_id_ = this->blobs_.size();
this->blobs_.resize(bias_param_id_ + 1);
this->blobs_[bias_param_id_] = bias_layer_->blobs()[0];
}
else {
// bias param already initialized
bias_param_id_ = this->blobs_.size() - 1;
bias_layer_->blobs()[0] = this->blobs_[bias_param_id_];
}
Metadata
Metadata
Assignees
Labels
No labels