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

Conv1d is the convolution 1d network layer. 更多...

#include <net_layer.h>

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

Public 成员函数

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

详细描述

Conv1d is the convolution 1d network layer.

Conv1d layer output is y = Conv(x, w), where x is the input, w the weight

Parameter w and b can be loaded from pb message. if bias is not used, b = 0.

在文件 net_layer.h149 行定义.

成员函数说明

◆ Load() [1/2]

bool apollo::prediction::network::Conv1d::Load ( const apollo::prediction::Conv1dParameter &  conv1d_pb)

Load the conv1d layer parameter from a pb message

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

◆ Load() [2/2]

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

Load the 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::Conv1d::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.cc129 行定义.

130 {
131 CHECK_EQ(inputs.size(), 1U);
132 CHECK_GT(kernel_.size(), 0U);
133 CHECK_EQ(kernel_[0].rows(), inputs[0].rows());
134 int kernel_size = static_cast<int>(kernel_[0].cols());
135 int output_num_col =
136 static_cast<int>((inputs[0].cols() - kernel_size) / stride_) + 1;
137 int output_num_row = static_cast<int>(kernel_.size());
138 output->resize(output_num_row, output_num_col);
139 for (int i = 0; i < output_num_row; ++i) {
140 for (int j = 0; j < output_num_col; ++j) {
141 float output_i_j_unbiased = 0.0f;
142 for (int p = 0; p < inputs[0].rows(); ++p) {
143 for (int q = j * stride_; q < j * stride_ + kernel_size; ++q) {
144 output_i_j_unbiased +=
145 inputs[0](p, q) * kernel_[i](p, q - j * stride_);
146 }
147 }
148
149 (*output)(i, j) = output_i_j_unbiased + bias_(i);
150 }
151 }
152}

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