Apollo 11.0
自动驾驶开放平台
apollo::prediction::network::AvgPool1d类 参考

AvgPool1d is the average Pool 1d network layer. 更多...

#include <net_layer.h>

类 apollo::prediction::network::AvgPool1d 继承关系图:
apollo::prediction::network::AvgPool1d 的协作图:

Public 成员函数

bool Load (const apollo::prediction::LayerParameter &layer_pb) override
 Load the dense layer parameter from a pb message
 
bool Load (const apollo::prediction::AvgPool1dParameter &avgpool1d_pb)
 Load the avg pool 1d layer parameter from a pb message
 
void Run (const std::vector< Eigen::MatrixXf > &inputs, Eigen::MatrixXf *output) override
 Compute the layer output from inputs
 
- Public 成员函数 继承自 apollo::prediction::network::Layer
 Layer ()=default
 Constructor
 
virtual ~Layer ()=default
 Destructor
 
virtual void ResetState ()
 Reset the internal state of a layer such as LSTM, GRU
 
virtual void SetState (const std::vector< Eigen::MatrixXf > &states)
 Set the internal state of a layer
 
virtual void State (std::vector< Eigen::MatrixXf > *states) const
 Access to the internal state of a layer
 
std::string Name () const
 Name of a layer
 
int OrderNumber () const
 Order number of a layer in a network
 

详细描述

AvgPool1d is the average Pool 1d network layer.

在文件 net_layer.h218 行定义.

成员函数说明

◆ Load() [1/2]

bool apollo::prediction::network::AvgPool1d::Load ( const apollo::prediction::AvgPool1dParameter &  avgpool1d_pb)

Load the avg pool 1d layer parameter from a pb message

参数
Apb message contains the parameters
返回
True is loaded successively, otherwise False

◆ Load() [2/2]

bool apollo::prediction::network::AvgPool1d::Load ( const apollo::prediction::LayerParameter &  layer_pb)
overridevirtual

Load the dense layer parameter from a pb message

参数
Apb message contains the parameters
返回
True is loaded successively, otherwise False

重载 apollo::prediction::network::Layer .

◆ Run()

void apollo::prediction::network::AvgPool1d::Run ( const std::vector< Eigen::MatrixXf > &  inputs,
Eigen::MatrixXf *  output 
)
overridevirtual

Compute the layer output from inputs

参数
Inputsto a network layer
Outputof a network layer will be returned

实现了 apollo::prediction::network::Layer.

在文件 net_layer.cc219 行定义.

220 {
221 CHECK_EQ(inputs.size(), 1U);
222 int output_num_col =
223 static_cast<int>((inputs[0].cols() - kernel_size_) / stride_) + 1;
224 int output_num_row = static_cast<int>(inputs[0].rows());
225 output->resize(output_num_row, output_num_col);
226 int input_index = 0;
227 for (int j = 0; j < output_num_col; ++j) {
228 CHECK_LE(input_index + kernel_size_, inputs[0].cols());
229 for (int i = 0; i < output_num_row; ++i) {
230 float output_i_j_sum = 0.0f;
231 for (int k = input_index; k < input_index + kernel_size_; ++k) {
232 output_i_j_sum += inputs[0](i, k);
233 }
234 (*output)(i, j) = output_i_j_sum / static_cast<float>(kernel_size_);
235 }
236 input_index += stride_;
237 }
238}

该类的文档由以下文件生成: