TensorRT 10.0.1
NvInferLegacyDims.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 1993-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef NV_INFER_LEGACY_DIMS_H
19#define NV_INFER_LEGACY_DIMS_H
20
21#define NV_INFER_INTERNAL_INCLUDE_RUNTIME_BASE 1
22#include "NvInferRuntimeBase.h"
23#undef NV_INFER_INTERNAL_INCLUDE_RUNTIME_BASE
24
31
37namespace nvinfer1
38{
44class Dims2 : public Dims
45{
46public:
51 : Dims2(0, 0)
52 {
53 }
54
61 Dims2(int64_t d0, int64_t d1)
62 {
63 nbDims = 2;
64 d[0] = d0;
65 d[1] = d1;
66 for (int64_t i{nbDims}; i < Dims::MAX_DIMS; ++i)
67 {
68 d[i] = 0;
69 }
70 }
71};
72
78class DimsHW : public Dims2
79{
80public:
85 : Dims2()
86 {
87 }
88
95 DimsHW(int64_t height, int64_t width)
96 : Dims2(height, width)
97 {
98 }
99
105 int64_t& h()
106 {
107 return d[0];
108 }
109
115 int64_t h() const
116 {
117 return d[0];
118 }
119
125 int64_t& w()
126 {
127 return d[1];
128 }
129
135 int64_t w() const
136 {
137 return d[1];
138 }
139};
140
146class Dims3 : public Dims2
147{
148public:
153 : Dims3(0, 0, 0)
154 {
155 }
156
164 Dims3(int64_t d0, int64_t d1, int64_t d2)
165 : Dims2(d0, d1)
166 {
167 nbDims = 3;
168 d[2] = d2;
169 }
170};
171
177class Dims4 : public Dims3
178{
179public:
184 : Dims4(0, 0, 0, 0)
185 {
186 }
187
196 Dims4(int64_t d0, int64_t d1, int64_t d2, int64_t d3)
197 : Dims3(d0, d1, d2)
198 {
199 nbDims = 4;
200 d[3] = d3;
201 }
202};
203
204} // namespace nvinfer1
205
206#endif // NV_INFER_LEGCY_DIMS_H
Descriptor for two-dimensional data.
Definition: NvInferLegacyDims.h:45
Dims2()
Construct an empty Dims2 object.
Definition: NvInferLegacyDims.h:50
Dims2(int64_t d0, int64_t d1)
Construct a Dims2 from 2 elements.
Definition: NvInferLegacyDims.h:61
Descriptor for three-dimensional data.
Definition: NvInferLegacyDims.h:147
Dims3()
Construct an empty Dims3 object.
Definition: NvInferLegacyDims.h:152
Dims3(int64_t d0, int64_t d1, int64_t d2)
Construct a Dims3 from 3 elements.
Definition: NvInferLegacyDims.h:164
Descriptor for four-dimensional data.
Definition: NvInferLegacyDims.h:178
Dims4(int64_t d0, int64_t d1, int64_t d2, int64_t d3)
Construct a Dims4 from 4 elements.
Definition: NvInferLegacyDims.h:196
Dims4()
Construct an empty Dims4 object.
Definition: NvInferLegacyDims.h:183
Definition: NvInferRuntimeBase.h:201
static constexpr int32_t MAX_DIMS
The maximum rank (number of dimensions) supported for a tensor.
Definition: NvInferRuntimeBase.h:204
int64_t d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeBase.h:210
int32_t nbDims
The rank (number of dimensions).
Definition: NvInferRuntimeBase.h:207
Descriptor for two-dimensional spatial data.
Definition: NvInferLegacyDims.h:79
int64_t & h()
Get the height.
Definition: NvInferLegacyDims.h:105
DimsHW()
Construct an empty DimsHW object.
Definition: NvInferLegacyDims.h:84
int64_t h() const
Get the height.
Definition: NvInferLegacyDims.h:115
DimsHW(int64_t height, int64_t width)
Construct a DimsHW given height and width.
Definition: NvInferLegacyDims.h:95
int64_t w() const
Get the width.
Definition: NvInferLegacyDims.h:135
int64_t & w()
Get the width.
Definition: NvInferLegacyDims.h:125
The TensorRT API version 1 namespace.

  Copyright © 2024 NVIDIA Corporation
  Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact