TensorRT 10.0.0
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
22
29
35namespace nvinfer1
36{
42class Dims2 : public Dims
43{
44public:
49 : Dims2(0, 0)
50 {
51 }
52
59 Dims2(int64_t d0, int64_t d1)
60 {
61 nbDims = 2;
62 d[0] = d0;
63 d[1] = d1;
64 for (int64_t i{nbDims}; i < Dims::MAX_DIMS; ++i)
65 {
66 d[i] = 0;
67 }
68 }
69};
70
76class DimsHW : public Dims2
77{
78public:
83 : Dims2()
84 {
85 }
86
93 DimsHW(int64_t height, int64_t width)
94 : Dims2(height, width)
95 {
96 }
97
103 int64_t& h()
104 {
105 return d[0];
106 }
107
113 int64_t h() const
114 {
115 return d[0];
116 }
117
123 int64_t& w()
124 {
125 return d[1];
126 }
127
133 int64_t w() const
134 {
135 return d[1];
136 }
137};
138
144class Dims3 : public Dims2
145{
146public:
151 : Dims3(0, 0, 0)
152 {
153 }
154
162 Dims3(int64_t d0, int64_t d1, int64_t d2)
163 : Dims2(d0, d1)
164 {
165 nbDims = 3;
166 d[2] = d2;
167 }
168};
169
175class Dims4 : public Dims3
176{
177public:
182 : Dims4(0, 0, 0, 0)
183 {
184 }
185
194 Dims4(int64_t d0, int64_t d1, int64_t d2, int64_t d3)
195 : Dims3(d0, d1, d2)
196 {
197 nbDims = 4;
198 d[3] = d3;
199 }
200};
201
202} // namespace nvinfer1
203
204#endif // NV_INFER_LEGCY_DIMS_H
Descriptor for two-dimensional data.
Definition: NvInferLegacyDims.h:43
Dims2()
Construct an empty Dims2 object.
Definition: NvInferLegacyDims.h:48
Dims2(int64_t d0, int64_t d1)
Construct a Dims2 from 2 elements.
Definition: NvInferLegacyDims.h:59
Descriptor for three-dimensional data.
Definition: NvInferLegacyDims.h:145
Dims3()
Construct an empty Dims3 object.
Definition: NvInferLegacyDims.h:150
Dims3(int64_t d0, int64_t d1, int64_t d2)
Construct a Dims3 from 3 elements.
Definition: NvInferLegacyDims.h:162
Descriptor for four-dimensional data.
Definition: NvInferLegacyDims.h:176
Dims4(int64_t d0, int64_t d1, int64_t d2, int64_t d3)
Construct a Dims4 from 4 elements.
Definition: NvInferLegacyDims.h:194
Dims4()
Construct an empty Dims4 object.
Definition: NvInferLegacyDims.h:181
Definition: NvInferRuntimeBase.h:195
static constexpr int32_t MAX_DIMS
The maximum rank (number of dimensions) supported for a tensor.
Definition: NvInferRuntimeBase.h:198
int64_t d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeBase.h:204
int32_t nbDims
The rank (number of dimensions).
Definition: NvInferRuntimeBase.h:201
Descriptor for two-dimensional spatial data.
Definition: NvInferLegacyDims.h:77
int64_t & h()
Get the height.
Definition: NvInferLegacyDims.h:103
DimsHW()
Construct an empty DimsHW object.
Definition: NvInferLegacyDims.h:82
int64_t h() const
Get the height.
Definition: NvInferLegacyDims.h:113
DimsHW(int64_t height, int64_t width)
Construct a DimsHW given height and width.
Definition: NvInferLegacyDims.h:93
int64_t w() const
Get the width.
Definition: NvInferLegacyDims.h:133
int64_t & w()
Get the width.
Definition: NvInferLegacyDims.h:123
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