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

Method HumanString

tensorflow/compiler/xla/shape_util.cc:470–492  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

468}
469
470/* static */ string ShapeUtil::HumanString(const Shape& shape) {
471 if (shape.IsTuple()) {
472 string text = "(";
473 const char* prefix = "";
474 for (const Shape& elem_shape : shape.tuple_shapes()) {
475 StrAppend(&text, prefix, HumanString(elem_shape));
476 prefix = ", ";
477 }
478 text += ")";
479 return text;
480 }
481 std::vector<string> dim_elements;
482 for (int i = 0; i < shape.dimensions_size(); ++i) {
483 if (shape.is_dynamic_dimension(i)) {
484 dim_elements.push_back(StrCat("<=", shape.dimensions(i)));
485 } else {
486 dim_elements.push_back(StrCat(shape.dimensions(i)));
487 }
488 }
489 return StrCat(
490 primitive_util::LowercasePrimitiveTypeName(shape.element_type()), "[",
491 absl::StrJoin(dim_elements, ","), "]");
492}
493
494/* static */ string ShapeUtil::HumanStringWithLayout(const Shape& shape) {
495 if (shape.IsTuple()) {

Callers

nothing calls this directly

Calls 13

dimensions_sizeMethod · 0.80
is_dynamic_dimensionMethod · 0.80
parameter_names_sizeMethod · 0.80
StrAppendFunction · 0.50
StrCatFunction · 0.50
IsTupleMethod · 0.45
tuple_shapesMethod · 0.45
push_backMethod · 0.45
dimensionsMethod · 0.45
element_typeMethod · 0.45
parametersMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected