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

Function validateTensorNames

samples/common/sampleInference.cpp:53–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52template <class MapType, class EngineType>
53bool validateTensorNames(
54 MapType const& map, EngineType const* engine, int32_t const endBindingIndex)
55{
56 // Check if the provided input tensor names match the input tensors of the engine.
57 // Throw an error if the provided input tensor names cannot be found because it implies a potential typo.
58 for (auto const& item : map)
59 {
60 bool tensorNameFound{false};
61 for (int32_t b = 0; b < endBindingIndex; ++b)
62 {
63 if (engine->bindingIsInput(b) && engine->getBindingName(b) == item.first)
64 {
65 tensorNameFound = true;
66 break;
67 }
68 }
69 if (!tensorNameFound)
70 {
71 sample::gLogError << "Cannot find input tensor with name \"" << item.first << "\" in the engine bindings! "
72 << "Please make sure the input tensor names are correct." << std::endl;
73 return false;
74 }
75 }
76 return true;
77}
78
79template <class EngineType, class ContextType>
80class FillBindingClosure

Callers 2

fillAllBindingsMethod · 0.85
setUpInferenceFunction · 0.85

Calls 2

bindingIsInputMethod · 0.80
getBindingNameMethod · 0.80

Tested by

no test coverage detected