TensorRT 8.6.0
NvInferLegacyDims.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NV_INFER_LEGACY_DIMS_H
14#define NV_INFER_LEGACY_DIMS_H
15
17
24
30namespace nvinfer1
31{
36class Dims2 : public Dims
37{
38public:
43 : Dims2(0, 0)
44 {
45 }
46
53 Dims2(int32_t d0, int32_t d1)
54 {
55 nbDims = 2;
56 d[0] = d0;
57 d[1] = d1;
58 for (int32_t i{nbDims}; i < Dims::MAX_DIMS; ++i)
59 {
60 d[i] = 0;
61 }
62 }
63};
64
69class DimsHW : public Dims2
70{
71public:
76 : Dims2()
77 {
78 }
79
86 DimsHW(int32_t height, int32_t width)
87 : Dims2(height, width)
88 {
89 }
90
96 int32_t& h()
97 {
98 return d[0];
99 }
100
106 int32_t h() const
107 {
108 return d[0];
109 }
110
116 int32_t& w()
117 {
118 return d[1];
119 }
120
126 int32_t w() const
127 {
128 return d[1];
129 }
130};
131
136class Dims3 : public Dims2
137{
138public:
143 : Dims3(0, 0, 0)
144 {
145 }
146
154 Dims3(int32_t d0, int32_t d1, int32_t d2)
155 : Dims2(d0, d1)
156 {
157 nbDims = 3;
158 d[2] = d2;
159 }
160};
161
166class Dims4 : public Dims3
167{
168public:
173 : Dims4(0, 0, 0, 0)
174 {
175 }
176
185 Dims4(int32_t d0, int32_t d1, int32_t d2, int32_t d3)
186 : Dims3(d0, d1, d2)
187 {
188 nbDims = 4;
189 d[3] = d3;
190 }
191};
192
193} // namespace nvinfer1
194
195#endif // NV_INFER_LEGCY_DIMS_H
Descriptor for two-dimensional data.
Definition: NvInferLegacyDims.h:37
Dims2(int32_t d0, int32_t d1)
Construct a Dims2 from 2 elements.
Definition: NvInferLegacyDims.h:53
Dims2()
Construct an empty Dims2 object.
Definition: NvInferLegacyDims.h:42
Definition: NvInferRuntimeBase.h:179
int32_t nbDims
The rank (number of dimensions).
Definition: NvInferRuntimeBase.h:184
static constexpr int32_t MAX_DIMS
The maximum rank (number of dimensions) supported for a tensor.
Definition: NvInferRuntimeBase.h:182
int32_t d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeBase.h:186
Descriptor for three-dimensional data.
Definition: NvInferLegacyDims.h:137
Dims3()
Construct an empty Dims3 object.
Definition: NvInferLegacyDims.h:142
Dims3(int32_t d0, int32_t d1, int32_t d2)
Construct a Dims3 from 3 elements.
Definition: NvInferLegacyDims.h:154
Descriptor for four-dimensional data.
Definition: NvInferLegacyDims.h:167
Dims4()
Construct an empty Dims4 object.
Definition: NvInferLegacyDims.h:172
Dims4(int32_t d0, int32_t d1, int32_t d2, int32_t d3)
Construct a Dims4 from 4 elements.
Definition: NvInferLegacyDims.h:185
Descriptor for two-dimensional spatial data.
Definition: NvInferLegacyDims.h:70
int32_t w() const
Get the width.
Definition: NvInferLegacyDims.h:126
int32_t h() const
Get the height.
Definition: NvInferLegacyDims.h:106
DimsHW()
Construct an empty DimsHW object.
Definition: NvInferLegacyDims.h:75
int32_t & w()
Get the width.
Definition: NvInferLegacyDims.h:116
DimsHW(int32_t height, int32_t width)
Construct a DimsHW given height and width.
Definition: NvInferLegacyDims.h:86
int32_t & h()
Get the height.
Definition: NvInferLegacyDims.h:96
The TensorRT API version 1 namespace.