| 33 | namespace { |
| 34 | |
| 35 | class ShapeTest : public ::testing::Test { |
| 36 | protected: |
| 37 | const Shape opaque_ = ShapeUtil::MakeOpaqueShape(); |
| 38 | const Shape token_ = ShapeUtil::MakeTokenShape(); |
| 39 | const Shape scalar_ = ShapeUtil::MakeShape(F32, {}); |
| 40 | const Shape scalar_with_tile_ = |
| 41 | ShapeUtil::MakeShapeWithLayout(F32, {}, {}, {Tile({256})}); |
| 42 | const Shape matrix_ = ShapeUtil::MakeShape(U32, {1, 2}); |
| 43 | const Shape matrix2_ = ShapeUtil::MakeShapeWithLayout(S32, {3, 4}, {0, 1}); |
| 44 | const Shape tuple_ = |
| 45 | ShapeUtil::MakeTupleShape({opaque_, scalar_, matrix_, matrix2_}); |
| 46 | const Shape nested_tuple_ = |
| 47 | ShapeUtil::MakeTupleShape({tuple_, matrix_, token_}); |
| 48 | const Shape dynamic_matrix_ = |
| 49 | ShapeUtil::MakeShape(S32, {5, 2}, {true, false}); |
| 50 | }; |
| 51 | |
| 52 | TEST_F(ShapeTest, ShapeToFromProto) { |
| 53 | for (const Shape& shape : {opaque_, token_, scalar_, matrix_, matrix2_, |