codekingpro/portable-devtools
114k
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_OnnxConfig_H
19#define NV_OnnxConfig_H
20
21#include "NvInfer.h"
22
23namespace nvonnxparser
24{
25
26//!
27//! \mainpage
28//!
29//! This is the API documentation for the Configuration Manager for Open Neural Network Exchange (ONNX) Parser for Nvidia TensorRT Inference Engine.
30//! It provides information on individual functions, classes
31//! and methods. Use the index on the left to navigate the documentation.
32//!
33//! Please see the accompanying user guide and samples for higher-level information and general advice on using ONNX Parser and TensorRT.
34//!
35
36//!
37//! \file NvOnnxConfig.h
38//!
39//! This is the API file for the Configuration Manager for ONNX Parser for Nvidia TensorRT.
40//!
41
42//!
43//! \class IOnnxConfig
44//! \brief Configuration Manager Class.
45//!
46class IOnnxConfig
47{
48public:
49 virtual ~IOnnxConfig() noexcept = default;
50 //!
51 //! \typedef Verbosity
52 //!
53 //! \brief Defines Verbosity level.
54 //!
55 typedef int32_t Verbosity;
56
57 //!
58 //! \brief Set the Model Data Type.
59 //!
60 //! Sets the Model DataType, one of the following: float -d 32 (default), half precision -d 16, and int8 -d 8 data
61 //! types.
62 //!
63 //! \see getModelDtype()
64 //!
65 virtual void setModelDtype(const nvinfer1::DataType) noexcept = 0;
66
67 //!
68 //! \brief Get the Model Data Type.
69 //!
70 //! \return the data type of the model.
71 //!
72 //! \see setModelDtype() and DataType
73 //!
74 virtual nvinfer1::DataType getModelDtype() const noexcept = 0;
75
76 //!
77 //! \brief Get the Model FileName.
78 //!
79 //! \return Return the Model Filename, as a null-terminated C-style string.
80 //!
81 //! \see setModelFileName()
82 //!
83 virtual char const* getModelFileName() const noexcept = 0;
84
85 //!
86 //! \brief Set the Model File Name.
87 //!
88 //! The Model File name contains the Network Description in ONNX pb format.
89 //!
90 //! This method copies the name string.
91 //!
92 //! \param onnxFilename The name.
93 //!
94 //! \see getModelFileName()
95 //!
96 virtual void setModelFileName(char const* onnxFilename) noexcept = 0;
97
98 //!
99 //! \brief Get the Verbosity Level.
100 //!
101 //! \return The Verbosity Level.
102 //!
103 //! \see addVerbosity(), reduceVerbosity()
104 //!
105 virtual Verbosity getVerbosityLevel() const noexcept = 0;
106
107 //!
108 //! \brief Increase the Verbosity Level.
109 //!
110 //! \return The Verbosity Level.
111 //!
112 //! \see reduceVerbosity(), setVerbosity(Verbosity)
113 //!
114 virtual void addVerbosity() noexcept = 0;
115
116 //!
117 //! \brief Reduce the Verbosity Level.
118 //!
119 //! \see addVerbosity(), setVerbosity(Verbosity)
120 //!
121 virtual void reduceVerbosity() noexcept = 0;
122
123 //!
124 //! \brief Set to specific verbosity Level.
125 //!
126 //! \see addVerbosity(), reduceVerbosity()
127 //!
128 virtual void setVerbosityLevel(Verbosity) noexcept = 0;
129
130 //!
131 //! \brief Returns the File Name of the Network Description as a Text File.
132 //!
133 //! \return Return the name of the file containing the network description converted to a plain text, used for
134 //! debugging purposes.
135 //!
136 //! \see setTextFilename()
137 //!
138 virtual char const* getTextFileName() const noexcept = 0;
139
140 //!
141 //! \brief Set the File Name of the Network Description as a Text File.
142 //!
143 //! This API allows setting a file name for the network description in plain text, equivalent of the ONNX protobuf.
144 //!
145 //! This method copies the name string.
146 //!
147 //! \param textFileName Name of the file.
148 //!
149 //! \see getTextFilename()
150 //!
151 virtual void setTextFileName(char const* textFileName) noexcept = 0;
152
153 //!
154 //! \brief Get the File Name of the Network Description as a Text File, including the weights.
155 //!
156 //! \return Return the name of the file containing the network description converted to a plain text, used for
157 //! debugging purposes.
158 //!
159 //! \see setFullTextFilename()
160 //!
161 virtual char const* getFullTextFileName() const noexcept = 0;
162
163 //!
164 //! \brief Set the File Name of the Network Description as a Text File, including the weights.
165 //!
166 //! This API allows setting a file name for the network description in plain text, equivalent of the ONNX protobuf.
167 //!
168 //! This method copies the name string.
169 //!
170 //! \param fullTextFileName Name of the file.
171 //!
172 //! \see getFullTextFilename()
173 //!
174 virtual void setFullTextFileName(char const* fullTextFileName) noexcept = 0;
175
176 //!
177 //! \brief Get whether the layer information will be printed.
178 //!
179 //! \return Returns whether the layer information will be printed.
180 //!
181 //! \see setPrintLayerInfo()
182 //!
183 virtual bool getPrintLayerInfo() const noexcept = 0;
184
185 //!
186 //! \brief Set whether the layer information will be printed.
187 //!
188 //! \see getPrintLayerInfo()
189 //!
190 virtual void setPrintLayerInfo(bool) noexcept = 0;
191
192}; // class IOnnxConfig
193
194TENSORRTAPI IOnnxConfig* createONNXConfig();
195
196} // namespace nvonnxparser
197
198#endif
199 