File size: 4,214 Bytes
f864a1e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | /*
* SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NV_INFER_LEGACY_DIMS_H
#define NV_INFER_LEGACY_DIMS_H
#define NV_INFER_INTERNAL_INCLUDE 1
#include "NvInferRuntimeBase.h" // IWYU pragma: exports
#undef NV_INFER_INTERNAL_INCLUDE
//!
//! \file NvInferLegacyDims.h
//!
//! This file contains declarations of legacy dimensions types which use channel
//! semantics in their names, and declarations on which those types rely.
//!
//!
//! \namespace nvinfer1
//!
//! \brief The TensorRT API version 1 namespace.
//!
namespace nvinfer1
{
//!
//! \class Dims2
//!
//! \brief Descriptor for two-dimensional data.
//!
class Dims2 : public Dims
{
public:
//!
//! \brief Construct an empty Dims2 object.
//!
Dims2()
: Dims2(0, 0)
{
}
//!
//! \brief Construct a Dims2 from 2 elements.
//!
//! \param d0 The first element.
//! \param d1 The second element.
//!
Dims2(int64_t d0, int64_t d1)
{
nbDims = 2;
d[0] = d0;
d[1] = d1;
for (int64_t i{nbDims}; i < Dims::MAX_DIMS; ++i)
{
d[i] = 0;
}
}
};
//!
//! \class DimsHW
//!
//! \brief Descriptor for two-dimensional spatial data.
//!
class DimsHW : public Dims2
{
public:
//!
//! \brief Construct an empty DimsHW object.
//!
DimsHW()
: Dims2()
{
}
//!
//! \brief Construct a DimsHW given height and width.
//!
//! \param height the height of the data
//! \param width the width of the data
//!
DimsHW(int64_t height, int64_t width)
: Dims2(height, width)
{
}
//!
//! \brief Get the height.
//!
//! \return The height.
//!
int64_t& h()
{
return d[0];
}
//!
//! \brief Get the height.
//!
//! \return The height.
//!
int64_t h() const
{
return d[0];
}
//!
//! \brief Get the width.
//!
//! \return The width.
//!
int64_t& w()
{
return d[1];
}
//!
//! \brief Get the width.
//!
//! \return The width.
//!
int64_t w() const
{
return d[1];
}
};
//!
//! \class Dims3
//!
//! \brief Descriptor for three-dimensional data.
//!
class Dims3 : public Dims2
{
public:
//!
//! \brief Construct an empty Dims3 object.
//!
Dims3()
: Dims3(0, 0, 0)
{
}
//!
//! \brief Construct a Dims3 from 3 elements.
//!
//! \param d0 The first element.
//! \param d1 The second element.
//! \param d2 The third element.
//!
Dims3(int64_t d0, int64_t d1, int64_t d2)
: Dims2(d0, d1)
{
nbDims = 3;
d[2] = d2;
}
};
//!
//! \class Dims4
//!
//! \brief Descriptor for four-dimensional data.
//!
class Dims4 : public Dims3
{
public:
//!
//! \brief Construct an empty Dims4 object.
//!
Dims4()
: Dims4(0, 0, 0, 0)
{
}
//!
//! \brief Construct a Dims4 from 4 elements.
//!
//! \param d0 The first element.
//! \param d1 The second element.
//! \param d2 The third element.
//! \param d3 The fourth element.
//!
Dims4(int64_t d0, int64_t d1, int64_t d2, int64_t d3)
: Dims3(d0, d1, d2)
{
nbDims = 4;
d[3] = d3;
}
};
} // namespace nvinfer1
#endif // NV_INFER_LEGCY_DIMS_H
|