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

Function TEST_F

tensorflow/core/framework/shape_inference_test.cc:72–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70};
71
72TEST_F(ShapeInferenceTest, InputOutputByName) {
73 // Setup test to contain an input tensor list of size 3.
74 OpDef op_def = MakeOpDefWithLists();
75 NodeDef def;
76 auto s = NodeDefBuilder("dummy", &op_def)
77 .Attr("N", 3)
78 .Input(FakeInput(DT_FLOAT))
79 .Finalize(&def);
80 InferenceContext c(kVersion, &def, op_def, {S({1, 5}), S({2, 5}), S({1, 3})},
81 {}, {}, {});
82
83 EXPECT_EQ("5", c.DebugString(c.NumElements(c.input(0))));
84 EXPECT_EQ("10", c.DebugString(c.NumElements(c.input(1))));
85 EXPECT_EQ("3", c.DebugString(c.NumElements(c.input(2))));
86 // Test getters.
87 std::vector<ShapeHandle> shapes;
88 EXPECT_FALSE(c.input("nonexistent", &shapes).ok());
89 TF_EXPECT_OK(c.input("input", &shapes));
90 EXPECT_EQ("[1,5]", c.DebugString(shapes[0]));
91 EXPECT_EQ("[2,5]", c.DebugString(shapes[1]));
92 EXPECT_EQ("[1,3]", c.DebugString(shapes[2]));
93
94 // Test setters.
95 EXPECT_FALSE(c.set_output("nonexistent", shapes).ok());
96 TF_EXPECT_OK(c.set_output("output", shapes));
97 EXPECT_EQ("5", c.DebugString(c.NumElements(c.output(0))));
98 EXPECT_EQ("10", c.DebugString(c.NumElements(c.output(1))));
99 EXPECT_EQ("3", c.DebugString(c.NumElements(c.output(2))));
100}
101
102static OpDef MakeOpDef(int num_inputs, int num_outputs) {
103 OpRegistrationData op_reg_data;

Callers

nothing calls this directly

Calls 15

MakeOpDefWithListsFunction · 0.85
NodeDefBuilderClass · 0.85
EXPECT_DEATHFunction · 0.85
ShapeHandleClass · 0.85
createFunction · 0.85
PartialTensorShapeClass · 0.85
set_opMethod · 0.80
construction_statusMethod · 0.80
WithRankAtMostMethod · 0.80
RankKnownMethod · 0.80
ValueKnownMethod · 0.80

Tested by

no test coverage detected