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

Dense is the forward fully connected network layer. 更多...

#include <net_layer.h>

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

Public 成员函数

bool Load (const apollo::prediction::LayerParameter &layer_pb) override
 Load the dense layer parameter from a pb message
 
bool Load (const apollo::prediction::DenseParameter &layer_pb)
 Load the dense 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
 

详细描述

Dense is the forward fully connected network layer.

Dense layer output is y = f(x*w + b), where x is the input, w the weight, b the bias and f the activation

Parameter w and b can be loaded from pb message. if bias is not used, b = 0. f is linear function at default.

在文件 net_layer.h108 行定义.

成员函数说明

◆ Load() [1/2]

bool apollo::prediction::network::Dense::Load ( const apollo::prediction::DenseParameter &  layer_pb)

Load the dense layer parameter from a pb message

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

◆ Load() [2/2]

bool apollo::prediction::network::Dense::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::Dense::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.cc82 行定义.

83 {
84 CHECK_EQ(inputs.size(), 1U);
85 Eigen::MatrixXf prod = static_cast<Eigen::MatrixXf>(inputs[0] * weights_);
86 if (use_bias_) {
87 Eigen::MatrixXf sum = prod.rowwise() + bias_.transpose();
88 prod = sum;
89 }
90 *output = prod.unaryExpr(kactivation_);
91 CHECK_EQ(output->cols(), units_);
92}

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