TensorRT 8.4.3
NvUffParser.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 1993-2022 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
80 FieldMap(char const* name, void const* data, const FieldType type, int32_t length = 1);
81};
82
84{
85 int32_t nbFields;
87};
88
97{
98public:
106 virtual bool registerInput(char const* inputName, nvinfer1::Dims inputDims, UffInputOrder inputOrder) noexcept = 0;
107
113 virtual bool registerOutput(char const* outputName) noexcept = 0;
114
122 virtual bool parse(char const* file, nvinfer1::INetworkDefinition& network,
123 nvinfer1::DataType weightsType = nvinfer1::DataType::kFLOAT) noexcept = 0;
124
133 virtual bool parseBuffer(char const* buffer, std::size_t size, nvinfer1::INetworkDefinition& network,
134 nvinfer1::DataType weightsType = nvinfer1::DataType::kFLOAT) noexcept = 0;
135
139 TRT_DEPRECATED virtual void destroy() noexcept = 0;
140
144 virtual int32_t getUffRequiredVersionMajor() noexcept = 0;
145
149 virtual int32_t getUffRequiredVersionMinor() noexcept = 0;
150
154 virtual int32_t getUffRequiredVersionPatch() noexcept = 0;
155
159 virtual void setPluginNamespace(char const* libNamespace) noexcept = 0;
160
161 virtual ~IUffParser() noexcept = default;
162
163public:
175 //
178 virtual void setErrorRecorder(nvinfer1::IErrorRecorder* recorder) noexcept = 0;
179
190 virtual nvinfer1::IErrorRecorder* getErrorRecorder() const noexcept = 0;
191};
192
204
211
212} // namespace nvuffparser
213
218extern "C" TENSORRTAPI void* createNvUffParser_INTERNAL() noexcept;
219
220#endif /* !NV_UFF_PARSER_H */
#define TENSORRTAPI
Definition: NvInferRuntimeCommon.h:54
#define TRT_DEPRECATED
Definition: NvInferRuntimeCommon.h:40
Definition: NvInferRuntimeCommon.h:153
A network definition for input to the builder.
Definition: NvInfer.h:6158
An array of field params used as a layer parameter for plugin layers.
Definition: NvUffParser.h:73
void const * data
Definition: NvUffParser.h:76
char const * name
Definition: NvUffParser.h:75
FieldMap(char const *name, void const *data, const FieldType type, int32_t length=1)
Class used for parsing models described using the UFF format.
Definition: NvUffParser.h:97
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: NvInferRuntimeCommon.h:114
@ 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:84
FieldMap const * fields
Definition: NvUffParser.h:86
int32_t nbFields
Definition: NvUffParser.h:85

  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