【caffe】Layer解读之:Flatten

  • Layer type: Flatten
  • 头文件位置:./include/caffe/layers/flatten_layer.hpp
  • CPU 执行源文件位置: ./src/caffe/layers/flatten_layer.cpp
  • Flatten层的功能:Flatten层是把一个输入的大小为n * c * h * w变成一个简单的向量,其大小为 n * (c*h*w)。可以用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];
}

猜你喜欢

转载自blog.csdn.net/qiu931110/article/details/81589165