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

Function TEST

tensorflow/core/ops/control_flow_ops_test.cc:25–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace tensorflow {
24
25TEST(ControlFlowOpsTest, Merge_ShapeFn) {
26 ShapeInferenceTestOp op("Merge");
27
28 int n = 3;
29 std::vector<NodeDefBuilder::NodeOut> src_list;
30 src_list.reserve(n);
31 for (int i = 0; i < n; ++i) src_list.emplace_back("a", 0, DT_FLOAT);
32 TF_ASSERT_OK(NodeDefBuilder("test", "Merge")
33 .Input(src_list)
34 .Attr("N", n)
35 .Finalize(&op.node_def));
36
37 // The second output should always be scalar.
38 // The first output should be unknown if any of the inputs are unknown, or
39 // if two inputs disagree about rank.
40 INFER_OK(op, "?;?;?", "?;[]");
41 INFER_OK(op, "[2,1];?;[2,1]", "?;[]");
42 INFER_OK(op, "[2,1];[2,1];?", "?;[]");
43 INFER_OK(op, "[2,1];[2,1];[3,1,2]", "?;[]");
44 // If inputs on rank, but disagree on specific dimensions, those dimensions
45 // should be unknown.
46 INFER_OK(op, "[2,1];[2,1];[3,1]", "[?,d0_1];[]");
47 INFER_OK(op, "[2,1];[2,2];[3,1]", "[?,?];[]");
48 // Otherwise, all inputs agree and we return the first input.
49 INFER_OK(op, "[2,1];[2,1];[2,1]", "in0;[]");
50}
51
52TEST(ControlFlowOpsTest, SwitchN_ShapeFn) {
53 ShapeInferenceTestOp op("_SwitchN");

Callers

nothing calls this directly

Calls 6

NodeDefBuilderClass · 0.85
reserveMethod · 0.45
emplace_backMethod · 0.45
FinalizeMethod · 0.45
AttrMethod · 0.45
InputMethod · 0.45

Tested by

no test coverage detected