【caffe】Layer解读之:Flatten

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qiu931110/article/details/81589165
  • Layer type: Flatten
  • 头文件位置:./include/caffe/layers/flatten_layer.hpp
  • CPU 执行源文件位置: ./src/caffe/layers/flatten_layer.cpp
  • Flatten层的功能:Flatten层是把一个输入的大小为n * c * h * w变成一个简单的向量,其大小为 n * (chw)。可以用reshape代替~,相当于第一维不变,后面的自动计算。
参数定义

参数(FlattenParameter flatten_param)
定义位置 ./src/caffe/proto/caffe.proto:

/// Message that stores parameters used by FlattenLayer
message FlattenParameter {
  // The first axis to flatten: all preceding axes are retained in the output.
  // May be negative to index from the end (e.g., -1 for the last axis).
  optional int32 axis = 1 [default = 1];

  // The last axis to flatten: all following axes are retained in the output.
  // May be negative to index from the end (e.g., the default -1 for the last
  // axis).
  optional int32 end_axis = 2 [default = -1];
}

message FlattenParameter {
  optional int32 axis = 1 [default = 1];//从哪个轴开始平铺(该轴前面的都保留原状)
  optional int32 end_axis = 2 [default = -1];//哪个轴结束平铺(该轴后面的都保留原状)
}

没有更多推荐了,返回首页