Apollo  v5.5.0
Open source self driving car software
rt_common.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #pragma once
18 
19 #include <cudnn.h>
20 #include <map>
21 #include <string>
22 #include <vector>
23 
24 #include "NvCaffeParser.h"
25 #include "NvInfer.h"
26 
27 #include "cyber/common/log.h"
29 #include "modules/perception/proto/rt.pb.h"
30 
31 namespace apollo {
32 namespace perception {
33 namespace inference {
34 
35 typedef std::map<std::string, std::vector<nvinfer1::Weights>> WeightMap;
36 typedef std::map<std::string, nvinfer1::ITensor *> TensorMap;
37 typedef std::map<std::string, nvinfer1::DimsCHW> TensorDimsMap;
38 
39 nvinfer1::DimsCHW ReshapeDims(const nvinfer1::DimsCHW &dims,
40  const nvinfer1::DimsCHW &inputDims);
41 void ParseNetParam(const NetParameter &net_param,
42  TensorDimsMap *tensor_dims_map,
43  std::map<std::string, std::string> *tensor_modify_map,
44  std::vector<LayerParameter> *order);
45 
46 bool modify_pool_param(PoolingParameter *pool_param);
47 
48 struct ConvParam {
49  int kernel_h;
50  int kernel_w;
51  int padding_h;
52  int padding_w;
53  int stride_h;
54  int stride_w;
55  int group;
56  int dilation;
57 };
58 
59 bool ParserConvParam(const ConvolutionParameter &conv, ConvParam *param);
60 
61 } // namespace inference
62 } // namespace perception
63 } // namespace apollo
nvinfer1::DimsCHW ReshapeDims(const nvinfer1::DimsCHW &dims, const nvinfer1::DimsCHW &inputDims)
int padding_w
Definition: rt_common.h:52
std::map< std::string, nvinfer1::DimsCHW > TensorDimsMap
Definition: rt_common.h:37
Definition: blob.h:72
std::map< std::string, std::vector< nvinfer1::Weights > > WeightMap
Definition: rt_common.h:35
std::map< std::string, nvinfer1::ITensor * > TensorMap
Definition: rt_common.h:36
int group
Definition: rt_common.h:55
int kernel_w
Definition: rt_common.h:50
int dilation
Definition: rt_common.h:56
bool modify_pool_param(PoolingParameter *pool_param)
void ParseNetParam(const NetParameter &net_param, TensorDimsMap *tensor_dims_map, std::map< std::string, std::string > *tensor_modify_map, std::vector< LayerParameter > *order)
int stride_h
Definition: rt_common.h:53
int kernel_h
Definition: rt_common.h:49
int stride_w
Definition: rt_common.h:54
bool ParserConvParam(const ConvolutionParameter &conv, ConvParam *param)
int padding_h
Definition: rt_common.h:51