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

Function TEST

tensorflow/core/framework/node_def_util_test.cc:77–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77TEST(NodeDefUtilTest, In) {
78 const OpDef op = ToOpDef(OpDefBuilder("In").Input("i: T").Attr("T: type"));
79 const NodeDef node_def = ToNodeDef(R"proto(
80 name:'n' op:'In' input:'a' attr { key:'T' value { type:DT_FLOAT } }
81 )proto");
82 ExpectSuccess(node_def, op);
83
84 EXPECT_EQ("{{node n}} = In[T=DT_FLOAT](a)", SummarizeNodeDef(node_def));
85
86 // Mismatching Op names.
87 NodeDef bad = node_def;
88 bad.set_op("Wrong");
89 ExpectFailure(bad, op, "NodeDef op 'Wrong' does not match Op<name=In;");
90
91 // Missing attr
92 bad = node_def;
93 bad.clear_attr();
94 ExpectFailure(bad, op, "NodeDef missing attr 'T' from Op<name=In;");
95
96 // Extra attr
97 bad = node_def;
98 AddNodeAttr("EXTRA", 17, &bad);
99 ExpectFailure(bad, op, "NodeDef mentions attr 'EXTRA' not in Op<name=In;");
100
101 // Attr has wrong type
102 bad = node_def;
103 bad.clear_attr();
104 AddNodeAttr("T", 17, &bad);
105 ExpectFailure(
106 bad, op,
107 "AttrValue had value with type 'int' when 'type' expected\n\t for attr "
108 "'T'\n\t; NodeDef: ");
109
110 // Wrong number of inputs
111 bad = node_def;
112 bad.add_input("b");
113 ExpectFailure(
114 bad, op,
115 "NodeDef expected inputs 'float' do not match 2 inputs specified;");
116
117 bad = node_def;
118 bad.clear_input();
119 ExpectFailure(
120 bad, op,
121 "NodeDef expected inputs 'float' do not match 0 inputs specified;");
122
123 // Control inputs must appear after data inputs
124 NodeDef good = node_def;
125 good.add_input("^b");
126 ExpectSuccess(node_def, op);
127
128 bad = node_def;
129 bad.clear_input();
130 bad.add_input("^b");
131 bad.add_input("a");
132 ExpectFailure(bad, op,
133 "Invalid argument: Non-control input 'a' after control input "
134 "in NodeDef:");

Callers

nothing calls this directly

Calls 15

ToOpDefFunction · 0.85
OpDefBuilderClass · 0.85
ExpectSuccessFunction · 0.85
SummarizeNodeDefFunction · 0.85
ExpectFailureFunction · 0.85
NodeDefBuilderClass · 0.85
ExpectValidSyntaxFunction · 0.85
ExpectInvalidSyntaxFunction · 0.85
InputTypesForNodeFunction · 0.85
OutputTypesForNodeFunction · 0.85
OutputTypeForNodeFunction · 0.85
AttrSliceClass · 0.85

Tested by

no test coverage detected