TensorRT 8.6.0
NvUffParser.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_UFF_PARSER_H
14#define NV_UFF_PARSER_H
15
16#include "NvInfer.h"
17
23
24// Current supported Universal Framework Format (UFF) version for the parser.
25#define UFF_REQUIRED_VERSION_MAJOR 0
26#define UFF_REQUIRED_VERSION_MINOR 6
27#define UFF_REQUIRED_VERSION_PATCH 9
28
34namespace nvuffparser
35{
36
41enum class UffInputOrder : int32_t
42{
43 kNCHW = 0,
44 kNHWC = 1,
45 kNC = 2
46};
47
52
53enum class FieldType : int32_t
54{
55 kFLOAT = 0,
56 kINT32 = 1,
57 kCHAR = 2,
58 kDIMS = 4,
59 kDATATYPE = 5,
60 kUNKNOWN = 6
61};
62
73{
74public:
75 char const* name{};
76 void const* data{};
78 int32_t length{1};
79
82 TRT_DEPRECATED FieldMap(char const* name, void const* data, FieldType const type, int32_t length = 1);
83
85 FieldMap() = default;
86};
87
89{
90 int32_t nbFields;
92};
93
102{
103public:
111 virtual bool registerInput(char const* inputName, nvinfer1::Dims inputDims, UffInputOrder inputOrder) noexcept = 0;
112
118 virtual bool registerOutput(char const* outputName) noexcept = 0;
119
127 virtual bool parse(char const* file, nvinfer1::INetworkDefinition& network,
128 nvinfer1::DataType weightsType = nvinfer1::DataType::kFLOAT) noexcept = 0;
129
138 virtual bool parseBuffer(char const* buffer, std::size_t size, nvinfer1::INetworkDefinition& network,
139 nvinfer1::DataType weightsType = nvinfer1::DataType::kFLOAT) noexcept = 0;
140
144 TRT_DEPRECATED virtual void destroy() noexcept = 0;
145
149 virtual int32_t getUffRequiredVersionMajor() noexcept = 0;
150
154 virtual int32_t getUffRequiredVersionMinor() noexcept = 0;
155
159 virtual int32_t getUffRequiredVersionPatch() noexcept = 0;
160
164 virtual void setPluginNamespace(char const* libNamespace) noexcept = 0;
165
166 virtual ~IUffParser() noexcept = default;
167
168public:
180 //
183 virtual void setErrorRecorder(nvinfer1::IErrorRecorder* recorder) noexcept = 0;
184
195 virtual nvinfer1::IErrorRecorder* getErrorRecorder() const noexcept = 0;
196};
197
209
216
217} // namespace nvuffparser
218
223extern "C" TENSORRTAPI void* createNvUffParser_INTERNAL() noexcept;
224
225#endif /* !NV_UFF_PARSER_H */
#define TENSORRTAPI
Definition: NvInferRuntimeBase.h:54
#define TRT_DEPRECATED
Definition: NvInferRuntimeBase.h:40
Definition: NvInferRuntimeBase.h:179
A network definition for input to the builder.
Definition: NvInfer.h:6863
An array of field params used as a layer parameter for plugin layers.
Definition: NvUffParser.h:73
TRT_DEPRECATED FieldMap(char const *name, void const *data, FieldType const type, int32_t length=1)
FieldMap()=default
Default constructor.
Class used for parsing models described using the UFF format.
Definition: NvUffParser.h:102
virtual void setErrorRecorder(nvinfer1::IErrorRecorder *recorder) noexcept=0
Set the ErrorRecorder for this interface.
virtual bool registerOutput(char const *outputName) noexcept=0
Register an output name of a UFF network.
virtual void setPluginNamespace(char const *libNamespace) noexcept=0
Set the namespace used to lookup and create plugins in the network.
virtual int32_t getUffRequiredVersionPatch() noexcept=0
Return Patch Version of the UFF.
virtual TRT_DEPRECATED void destroy() noexcept=0
virtual bool parseBuffer(char const *buffer, std::size_t size, nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightsType=nvinfer1::DataType::kFLOAT) noexcept=0
Parse a UFF buffer, useful if the file already live in memory.
virtual nvinfer1::IErrorRecorder * getErrorRecorder() const noexcept=0
get the ErrorRecorder assigned to this interface.
virtual bool parse(char const *file, nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightsType=nvinfer1::DataType::kFLOAT) noexcept=0
Parse a UFF file.
virtual int32_t getUffRequiredVersionMajor() noexcept=0
Return Version Major of the UFF.
virtual int32_t getUffRequiredVersionMinor() noexcept=0
Return Version Minor of the UFF.
virtual bool registerInput(char const *inputName, nvinfer1::Dims inputDims, UffInputOrder inputOrder) noexcept=0
Register an input name of a UFF network with the associated Dimensions.
The TensorRT API version 1 namespace.
DataType
The type of weights and tensors.
Definition: NvInferRuntimeBase.h:120
@ kFLOAT
32-bit floating point format.
The TensorRT UFF parser API namespace.
IUffParser * createUffParser() noexcept
Creates a IUffParser object.
FieldType
The possible field types for custom layer.
Definition: NvUffParser.h:54
@ kFLOAT
FP32 field type.
@ kCHAR
char field type. String for length>1.
@ kDIMS
nvinfer1::Dims field type.
@ kINT32
INT32 field type.
@ kDATATYPE
nvinfer1::DataType field type.
void shutdownProtobufLibrary(void) noexcept
Shuts down protocol buffers library.
UffInputOrder
The different possible supported input order.
Definition: NvUffParser.h:42
Definition: NvUffParser.h:89
FieldMap const * fields
Definition: NvUffParser.h:91
int32_t nbFields
Definition: NvUffParser.h:90