TensorRT 8.4.0
NvCaffeParser.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_CAFFE_PARSER_H
14#define NV_CAFFE_PARSER_H
15
16#include "NvInfer.h"
17
23
29namespace nvcaffeparser1
30{
31
44{
45public:
52 virtual nvinfer1::ITensor* find(const char* name) const noexcept = 0;
53
54protected:
55 virtual ~IBlobNameToTensor() {}
56};
57
68{
69public:
70 virtual const void* getData() noexcept = 0;
71 virtual nvinfer1::Dims4 getDimensions() noexcept = 0;
72 virtual nvinfer1::DataType getDataType() noexcept = 0;
78 TRT_DEPRECATED virtual void destroy() noexcept = 0;
79 virtual ~IBinaryProtoBlob() noexcept = default;
80};
81
88{
89public:
95 virtual bool isPluginV2(const char* layerName) noexcept = 0;
96
105 virtual nvinfer1::IPluginV2* createPlugin(const char* layerName, const nvinfer1::Weights* weights,
106 int32_t nbWeights, const char* libNamespace = "") noexcept
107 = 0;
108
109 virtual ~IPluginFactoryV2() noexcept = default;
110};
121{
122public:
136 virtual const IBlobNameToTensor* parse(const char* deploy, const char* model, nvinfer1::INetworkDefinition& network,
137 nvinfer1::DataType weightType) noexcept
138 = 0;
139
155 virtual const IBlobNameToTensor* parseBuffers(const uint8_t* deployBuffer, std::size_t deployLength,
156 const uint8_t* modelBuffer, std::size_t modelLength, nvinfer1::INetworkDefinition& network,
157 nvinfer1::DataType weightType) noexcept
158 = 0;
159
172 virtual IBinaryProtoBlob* parseBinaryProto(const char* fileName) noexcept = 0;
173
181 virtual void setProtobufBufferSize(size_t size) noexcept = 0;
182
190 TRT_DEPRECATED virtual void destroy() noexcept = 0;
191
197 virtual void setPluginFactoryV2(IPluginFactoryV2* factory) noexcept = 0;
198
202 virtual void setPluginNamespace(const char* libNamespace) noexcept = 0;
203
204 virtual ~ICaffeParser() noexcept = default;
205
206public:
221 virtual void setErrorRecorder(nvinfer1::IErrorRecorder* recorder) noexcept = 0;
222
233 virtual nvinfer1::IErrorRecorder* getErrorRecorder() const noexcept = 0;
234};
235
247
254} // namespace nvcaffeparser1
255
260extern "C" TENSORRTAPI void* createNvCaffeParser_INTERNAL() noexcept;
261#endif
#define TENSORRTAPI
Definition: NvInferRuntimeCommon.h:54
#define TRT_DEPRECATED
Definition: NvInferRuntimeCommon.h:40
Object used to store and query data extracted from a binaryproto file using the ICaffeParser.
Definition: NvCaffeParser.h:68
virtual TRT_DEPRECATED void destroy() noexcept=0
virtual const void * getData() noexcept=0
virtual nvinfer1::DataType getDataType() noexcept=0
virtual nvinfer1::Dims4 getDimensions() noexcept=0
Object used to store and query Tensors after they have been extracted from a Caffe model using the IC...
Definition: NvCaffeParser.h:44
virtual nvinfer1::ITensor * find(const char *name) const noexcept=0
Given a blob name, returns a pointer to a ITensor object.
virtual ~IBlobNameToTensor()
Definition: NvCaffeParser.h:55
Class used for parsing Caffe models.
Definition: NvCaffeParser.h:121
virtual const IBlobNameToTensor * parseBuffers(const uint8_t *deployBuffer, std::size_t deployLength, const uint8_t *modelBuffer, std::size_t modelLength, nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightType) noexcept=0
Parse a deploy prototxt and a binaryproto Caffe model from memory buffers to extract network definiti...
virtual void setProtobufBufferSize(size_t size) noexcept=0
Set buffer size for the parsing and storage of the learned model.
virtual IBinaryProtoBlob * parseBinaryProto(const char *fileName) noexcept=0
Parse and extract data stored in binaryproto file.
virtual TRT_DEPRECATED void destroy() noexcept=0
Destroy this ICaffeParser object.
virtual const IBlobNameToTensor * parse(const char *deploy, const char *model, nvinfer1::INetworkDefinition &network, nvinfer1::DataType weightType) noexcept=0
Parse a prototxt file and a binaryproto Caffe model to extract network definition and weights associa...
Plugin factory used to configure plugins.
Definition: NvCaffeParser.h:88
virtual nvinfer1::IPluginV2 * createPlugin(const char *layerName, const nvinfer1::Weights *weights, int32_t nbWeights, const char *libNamespace="") noexcept=0
Creates a plugin.
virtual bool isPluginV2(const char *layerName) noexcept=0
A user implemented function that determines if a layer configuration is provided by an IPluginV2.
A network definition for input to the builder.
Definition: NvInfer.h:6148
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:373
A tensor in a network definition.
Definition: NvInfer.h:167
An array of weights used as a layer parameter.
Definition: NvInferRuntime.h:126
The TensorRT Caffe parser API namespace.
void shutdownProtobufLibrary() noexcept
Shuts down protocol buffers library.
ICaffeParser * createCaffeParser() noexcept
Creates a ICaffeParser object.
The TensorRT API version 1 namespace.
DataType
The type of weights and tensors.
Definition: NvInferRuntimeCommon.h:114