| 23 | |
| 24 | template<typename T, typename TParseElementFunc> |
| 25 | std::vector<T> ParseArrayImpl(std::istream& stream, TParseElementFunc parseElementFunc, const char * chars = "\t ,:") |
| 26 | { |
| 27 | std::vector<T> result; |
| 28 | // Processes line-by-line. |
| 29 | std::string line; |
| 30 | while (std::getline(stream, line)) |
| 31 | { |
| 32 | std::vector<std::string> tokens = armnn::stringUtils::StringTokenizer(line, chars); |
| 33 | for (const std::string& token : tokens) |
| 34 | { |
| 35 | if (!token.empty()) // See https://stackoverflow.com/questions/10437406/ |
| 36 | { |
| 37 | try |
| 38 | { |
| 39 | result.push_back(parseElementFunc(token)); |
| 40 | } |
| 41 | catch (const std::exception&) |
| 42 | { |
| 43 | ARMNN_LOG(error) << "'" << token << "' is not a valid number. It has been ignored."; |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | return result; |
| 50 | } |
| 51 | |
| 52 | template<armnn::DataType NonQuantizedType> |
| 53 | auto ParseDataArray(std::istream & stream); |
nothing calls this directly
no test coverage detected