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

Method SetToDefaultLayout

tensorflow/compiler/xla/layout_util.cc:138–154  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

136}
137
138/* static */ void LayoutUtil::SetToDefaultLayout(Shape* shape) {
139 if (shape->IsTuple()) {
140 // Tuple shape.
141 for (auto& element_shape : *shape->mutable_tuple_shapes()) {
142 SetToDefaultLayout(&element_shape);
143 }
144 shape->clear_layout();
145 } else if (shape->IsArray()) {
146 shape->mutable_layout()->set_format(DENSE);
147 auto* minor_to_major = shape->mutable_layout()->mutable_minor_to_major();
148 minor_to_major->resize(shape->dimensions_size(), 0);
149 SetDefaultLayoutToContainer(minor_to_major);
150 } else {
151 // Opaque, token types etc. have no layout.
152 shape->clear_layout();
153 }
154}
155
156/* static */ Shape LayoutUtil::GetWithDefaultLayout(const Shape& shape) {
157 Shape copy(shape);

Callers

nothing calls this directly

Calls 11

mutable_tuple_shapesMethod · 0.80
clear_layoutMethod · 0.80
mutable_layoutMethod · 0.80
dimensions_sizeMethod · 0.80
mutable_parametersMethod · 0.80
mutable_resultMethod · 0.80
IsTupleMethod · 0.45
IsArrayMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected