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

Function SetDefaultLayoutOnProto

tensorflow/compiler/xla/literal_test.cc:1412–1422  ·  view source on GitHub ↗

Sets the layout of the given ShapeProto to the default.

Source from the content-addressed store, hash-verified

1410
1411// Sets the layout of the given ShapeProto to the default.
1412void SetDefaultLayoutOnProto(ShapeProto* shape_proto) {
1413 CHECK(ShapeUtil::IsArrayPrimitiveType(shape_proto->element_type()));
1414 shape_proto->mutable_layout()->set_format(DENSE);
1415 auto* minor_to_major =
1416 shape_proto->mutable_layout()->mutable_minor_to_major();
1417 minor_to_major->Resize(shape_proto->dimensions_size(), 0);
1418 const int64 size = minor_to_major->size();
1419 for (int64 i = 0; i < size; ++i) {
1420 minor_to_major->Set(i, size - 1 - i);
1421 }
1422}
1423
1424TEST_F(LiteralUtilTest, CopyFromProto_Bool) {
1425 LiteralProto p;

Callers 1

TEST_FFunction · 0.85

Calls 7

mutable_layoutMethod · 0.80
dimensions_sizeMethod · 0.80
element_typeMethod · 0.45
ResizeMethod · 0.45
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected