E.g. (f32[10,20], u32[])
| 162 | |
| 163 | // E.g. (f32[10,20], u32[]) |
| 164 | TupleShape TupleShapeFromString(std::string s) { |
| 165 | Log("Tuple shape from string: " + s); |
| 166 | if (s[0] != '(') { |
| 167 | return {{ArrayShapeFromString(s)}}; |
| 168 | } |
| 169 | s = s.substr(1, s.size() - 2); |
| 170 | std::istringstream sstream(s); |
| 171 | std::string subshape; |
| 172 | std::vector<ArrayShape> out; |
| 173 | while (std::getline(sstream, subshape, ' ')) { |
| 174 | if (subshape[subshape.size() - 1] == ',') { |
| 175 | subshape = subshape.substr(0, subshape.size() - 1); |
| 176 | } |
| 177 | out.push_back(ArrayShapeFromString(subshape)); |
| 178 | } |
| 179 | return {out}; |
| 180 | } |
| 181 | |
| 182 | std::string TupleShapeToString(TupleShape shape) { |
| 183 | std::ostringstream out; |
no test coverage detected