MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TupleShapeFromString

Function TupleShapeFromString

tensorflow/compiler/xla/tools/driver.cc:164–180  ·  view source on GitHub ↗

E.g. (f32[10,20], u32[])

Source from the content-addressed store, hash-verified

162
163// E.g. (f32[10,20], u32[])
164TupleShape 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
182std::string TupleShapeToString(TupleShape shape) {
183 std::ostringstream out;

Callers 1

ParseBufferAssignmentFunction · 0.85

Calls 4

ArrayShapeFromStringFunction · 0.85
LogFunction · 0.70
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected