static */
| 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); |
nothing calls this directly
no test coverage detected