| 101 | } |
| 102 | |
| 103 | std::vector<std::string> DynamicBackendUtils::GetBackendPathsImpl(const std::string& backendPaths) |
| 104 | { |
| 105 | // Check if there's any path to process at all |
| 106 | if (backendPaths.empty()) |
| 107 | { |
| 108 | // Silently return without issuing a warning as no paths have been passed, so |
| 109 | // the whole dynamic backend loading feature can be considered as disabled |
| 110 | return {}; |
| 111 | } |
| 112 | |
| 113 | std::unordered_set<std::string> uniqueBackendPaths; |
| 114 | std::vector<std::string> validBackendPaths; |
| 115 | |
| 116 | // Split the given list of paths |
| 117 | std::vector<std::string> tempBackendPaths = armnn::stringUtils::StringTokenizer(backendPaths, ":"); |
| 118 | |
| 119 | for (const std::string& path : tempBackendPaths) |
| 120 | { |
| 121 | // Check whether the path is valid |
| 122 | if (!IsPathValid(path)) |
| 123 | { |
| 124 | continue; |
| 125 | } |
| 126 | |
| 127 | // Check whether the path is a duplicate |
| 128 | auto it = uniqueBackendPaths.find(path); |
| 129 | if (it != uniqueBackendPaths.end()) |
| 130 | { |
| 131 | // The path is a duplicate |
| 132 | continue; |
| 133 | } |
| 134 | |
| 135 | // Add the path to the set of unique paths |
| 136 | uniqueBackendPaths.insert(path); |
| 137 | |
| 138 | // Add the path to the list of valid paths |
| 139 | validBackendPaths.push_back(path); |
| 140 | } |
| 141 | |
| 142 | return validBackendPaths; |
| 143 | } |
| 144 | |
| 145 | bool DynamicBackendUtils::IsPathValid(const std::string& path) |
| 146 | { |
nothing calls this directly
no test coverage detected