Apollo 11.0
自动驾驶开放平台
rt_legacy.h
浏览该文件的文档.
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 <NvInferLegacyDims.h>
20
21namespace nvinfer1 {
22class DimsNCHW : public Dims4 {
23 public:
24 DimsNCHW() : Dims4() {}
26 int32_t batch_size, int32_t channels,
27 int32_t height, int32_t width)
28 : Dims4(batch_size, channels, height, width) {}
29
30 int32_t& n() {
31 return d[0];
32 }
33
34 int32_t n() const {
35 return d[0];
36 }
37
38 int32_t& c() {
39 return d[1];
40 }
41
42 int32_t c() const {
43 return d[1];
44 }
45
46 int32_t& h() {
47 return d[2];
48 }
49
50 int32_t h() const {
51 return d[2];
52 }
53
54 int32_t& w() {
55 return d[3];
56 }
57
58 int32_t w() const {
59 return d[3];
60 }
61};
62
63class DimsCHW : public Dims3 {
64 public:
65 DimsCHW() : Dims3() {}
66 DimsCHW(int32_t channels, int32_t height, int32_t width)
67 : Dims3(channels, height, width) {}
68
69 int32_t& c() {
70 return d[0];
71 }
72
73 int32_t c() const {
74 return d[0];
75 }
76
77 int32_t& h() {
78 return d[1];
79 }
80
81 int32_t h() const {
82 return d[1];
83 }
84
85 int32_t& w() {
86 return d[2];
87 }
88
89 int32_t w() const {
90 return d[2];
91 }
92};
93} // namespace nvinfer1
94
Definition plugin.h:31
int32_t d[MAX_DIMS]
Definition plugin.h:28
int32_t h() const
Definition rt_legacy.h:81
int32_t c() const
Definition rt_legacy.h:73
DimsCHW(int32_t channels, int32_t height, int32_t width)
Definition rt_legacy.h:66
int32_t w() const
Definition rt_legacy.h:89
int32_t & h()
Definition rt_legacy.h:77
int32_t & w()
Definition rt_legacy.h:85
int32_t & c()
Definition rt_legacy.h:69
int32_t n() const
Definition rt_legacy.h:34
int32_t & h()
Definition rt_legacy.h:46
int32_t & n()
Definition rt_legacy.h:30
DimsNCHW(int32_t batch_size, int32_t channels, int32_t height, int32_t width)
Definition rt_legacy.h:25
int32_t c() const
Definition rt_legacy.h:42
int32_t & c()
Definition rt_legacy.h:38
int32_t h() const
Definition rt_legacy.h:50
int32_t & w()
Definition rt_legacy.h:54
int32_t w() const
Definition rt_legacy.h:58