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

RnnModel is a derived class from NetModel, it has a specific layers structure. 更多...

#include <rnn_model.h>

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

Public 成员函数

void Run (const std::vector< Eigen::MatrixXf > &inputs, Eigen::MatrixXf *output) const override
 Compute the model output from inputs according to a defined layers' flow
 
void SetState (const std::vector< Eigen::MatrixXf > &states) override
 Set the internal state of a network model
 
void State (std::vector< Eigen::MatrixXf > *states) const override
 Access to the internal state of a network model
 
void ResetState () const override
 Set the internal state of a model
 
- Public 成员函数 继承自 apollo::prediction::network::NetModel
 NetModel ()=default
 Constructor
 
virtual ~NetModel ()=default
 Destructor
 
bool LoadModel (const NetParameter &net_parameter)
 Load network parameters from a protobuf message
 
std::string PerformanceString () const
 Shows the performance information of a network
 
const std::string & Name () const
 Name of a network model
 
int Id () const
 Id of a network model
 
bool IsOk () const
 Indicate the state of a network model
 

额外继承的成员函数

- Protected 属性 继承自 apollo::prediction::network::NetModel
std::vector< std::unique_ptr< Layer > > layers_
 
NetParameter net_parameter_
 
bool ok_ = false
 

详细描述

RnnModel is a derived class from NetModel, it has a specific layers structure.

在文件 rnn_model.h37 行定义.

成员函数说明

◆ ResetState()

void apollo::prediction::network::RnnModel::ResetState ( ) const
overridevirtual

Set the internal state of a model

参数
Aspecified internal state in a vector of Eigen::MatrixXf

重载 apollo::prediction::network::NetModel .

在文件 rnn_model.cc74 行定义.

74 {
75 layers_[4]->ResetState();
76 layers_[5]->ResetState();
77}
std::vector< std::unique_ptr< Layer > > layers_
Definition net_model.h:110

◆ Run()

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

Compute the model output from inputs according to a defined layers' flow

参数
Inputsto the network
Outputof the network will be returned

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

在文件 rnn_model.cc25 行定义.

26 {
27 Eigen::MatrixXf inp1;
28 Eigen::MatrixXf inp2;
29 layers_[0]->Run({inputs[0]}, &inp1);
30 layers_[1]->Run({inputs[1]}, &inp2);
31
32 Eigen::MatrixXf bn1;
33 Eigen::MatrixXf bn2;
34 layers_[2]->Run({inp1}, &bn1);
35 layers_[3]->Run({inp2}, &bn2);
36
37 Eigen::MatrixXf lstm1;
38 Eigen::MatrixXf lstm2;
39 layers_[4]->Run({bn1}, &lstm1);
40 layers_[5]->Run({bn2}, &lstm2);
41
42 Eigen::MatrixXf merge;
43 Eigen::MatrixXf dense1;
44 Eigen::MatrixXf act1;
45 layers_[6]->Run({lstm1, lstm2}, &merge);
46 layers_[7]->Run({merge}, &dense1);
47 layers_[8]->Run({dense1}, &bn1);
48 layers_[9]->Run({bn1}, &act1);
49
50 Eigen::MatrixXf dense2;
51 Eigen::MatrixXf prob;
52 layers_[10]->Run({act1}, &dense2);
53 layers_[12]->Run({dense2}, &bn1);
54 layers_[14]->Run({bn1}, &prob);
55
56 Eigen::MatrixXf acc;
57 layers_[11]->Run({act1}, &dense2);
58 layers_[13]->Run({dense2}, &bn1);
59 layers_[15]->Run({bn1}, &acc);
60
61 output->resize(1, 2);
62 *output << prob, acc;
63}

◆ SetState()

void apollo::prediction::network::RnnModel::SetState ( const std::vector< Eigen::MatrixXf > &  states)
overridevirtual

Set the internal state of a network model

参数
Aspecified internal state in a vector of Eigen::MatrixXf

重载 apollo::prediction::network::NetModel .

在文件 rnn_model.cc65 行定义.

65 {
66 layers_[4]->SetState(states);
67 layers_[5]->ResetState();
68}

◆ State()

void apollo::prediction::network::RnnModel::State ( std::vector< Eigen::MatrixXf > *  states) const
overridevirtual

Access to the internal state of a network model

返回
Internal state in a vector of Eigen::MatrixXf of the model

重载 apollo::prediction::network::NetModel .

在文件 rnn_model.cc70 行定义.

70 {
71 layers_[4]->State(states);
72}

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