MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / constructNetwork

Method constructNetwork

samples/sampleOnnxMNIST/sampleOnnxMNIST.cpp:189–213  ·  view source on GitHub ↗

\brief Uses a ONNX parser to create the Onnx MNIST Network and marks the output layers \param network Pointer to the network that will be populated with the Onnx MNIST network \param builder Pointer to the engine builder

Source from the content-addressed store, hash-verified

187//! \param builder Pointer to the engine builder
188//!
189bool SampleOnnxMNIST::constructNetwork(SampleUniquePtr<nvinfer1::IBuilder>& builder,
190 SampleUniquePtr<nvinfer1::INetworkDefinition>& network, SampleUniquePtr<nvinfer1::IBuilderConfig>& config,
191 SampleUniquePtr<nvonnxparser::IParser>& parser)
192{
193 auto parsed = parser->parseFromFile(locateFile(mParams.onnxFileName, mParams.dataDirs).c_str(),
194 static_cast<int>(sample::gLogger.getReportableSeverity()));
195 if (!parsed)
196 {
197 return false;
198 }
199
200 if (mParams.fp16)
201 {
202 config->setFlag(BuilderFlag::kFP16);
203 }
204 if (mParams.int8)
205 {
206 config->setFlag(BuilderFlag::kINT8);
207 samplesCommon::setAllDynamicRanges(network.get(), 127.0F, 127.0F);
208 }
209
210 samplesCommon::enableDLA(builder.get(), config.get(), mParams.dlaCore);
211
212 return true;
213}
214
215//!
216//! \brief Runs the TensorRT inference engine for this sample

Callers

nothing calls this directly

Calls 7

locateFileFunction · 0.85
setAllDynamicRangesFunction · 0.85
enableDLAFunction · 0.85
c_strMethod · 0.80
setFlagMethod · 0.80
getReportableSeverityMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected