MCPcopy Create free account
hub / github.com/alibaba/MNN / stringToDims

Function stringToDims

tools/cpp/ConfigFile.hpp:207–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205 return;
206}
207std::vector<int> stringToDims(const std::string& str, const std::string& pattern) {
208 std::vector<int> res;
209 if (str == "") {
210 return res;
211 }
212 std::string strs = str + pattern;
213 size_t pos = strs.find(pattern);
214
215 while (pos != strs.npos) {
216 std::string temp = strs.substr(0, pos);
217 std::istringstream tempIs(temp);
218 int p;
219 tempIs >> p;
220 res.push_back(p);
221 strs = strs.substr(pos + 1, strs.size());
222 pos = strs.find(pattern);
223 }
224
225 return res;
226}
227
228std::vector<std::string> splitNames(const int size, const std::string names) {
229 std::vector<std::string> split(size);

Callers 1

splitDimsFunction · 0.85

Calls 4

substrMethod · 0.80
findMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected