| 51 | |
| 52 | template <class MapType, class EngineType> |
| 53 | bool 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 | |
| 79 | template <class EngineType, class ContextType> |
| 80 | class FillBindingClosure |
no test coverage detected