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

Function ShapeToPython

tensorflow/python/framework/python_op_gen_internal.cc:364–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364string ShapeToPython(const TensorShapeProto& shape) {
365 if (shape.unknown_rank()) {
366 return "None";
367 }
368 string python = "[";
369 for (const auto& dim : shape.dim()) {
370 if (python.size() > 1) strings::StrAppend(&python, ", ");
371 if (!dim.name().empty()) {
372 strings::StrAppend(&python, "(", StringToPython(dim.name()), ", ",
373 dim.size(), ")");
374 } else {
375 strings::StrAppend(&python, dim.size());
376 }
377 }
378 strings::StrAppend(&python, "]");
379 return python;
380}
381
382string TensorToPython(const TensorProto& proto) {
383 return ProtoShortDebugString(proto);

Callers 2

AttrListToPythonFunction · 0.85
AttrValueToPythonFunction · 0.85

Calls 7

StringToPythonFunction · 0.85
unknown_rankMethod · 0.80
nameMethod · 0.65
StrAppendFunction · 0.50
dimMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected