【发布时间】:2018-09-30 22:08:41
【问题描述】:
Caffe 中 Tiling 层的作用是什么?它似乎是一种重塑输入的形式,但我想知道它究竟是如何工作的以及它可以应用在哪里?
这是源代码:
template <typename Dtype>
void TilingLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
TilingParameter tiling_param = this->layer_param_.tiling_param();
tile_dim_ = tiling_param.tile_dim();
tile_dim_sq_ = tile_dim_ * tile_dim_;
CHECK(tile_dim_) << "tile_dim must be specified.";
CHECK_GT(tile_dim_, 0) << "tile_dim must be positive.";
}
template <typename Dtype> void TilingLayer<Dtype>::Reshape(const
vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
CHECK_EQ(top.size(), 1);
input_channels_ = bottom[0]->channels();
input_height_ = bottom[0]->height();
input_width_ = bottom[0]->width();
output_channels_ = bottom[0]->channels() / tile_dim_sq_;
output_width_ = input_width_ * tile_dim_;
output_height_ = input_height_ * tile_dim_;
count_per_output_map_ = output_width_ * output_height_;
count_per_input_map_ = input_width_ * input_height_;
CHECK_EQ(0, input_channels_ % tile_dim_sq_)
<< "The number of input channels for tiling layer must be multiples "
<< "of the tile_dim."; top[0]->Reshape(bottom[0]->num(),
input_channels_ / tile_dim_sq_,
input_height_ * tile_dim_, input_width_ * tile_dim_); }
【问题讨论】:
标签: machine-learning neural-network computer-vision deep-learning caffe