| 127 | REGISTER_OP("Output").Output("o: float"); |
| 128 | |
| 129 | TEST_F(OptimizerFusionTest, test_input_is_control_dependency_edge) { |
| 130 | GraphDef test_graph; |
| 131 | AttrValue type; |
| 132 | type.set_type(DT_FLOAT); |
| 133 | AddNode("begin1", "Const", {}, {{"dtype", type}}, &test_graph); |
| 134 | AddNode("s1", "Identity", |
| 135 | {AsControlDependency("begin1")}, |
| 136 | {{"T", type}}, &test_graph); |
| 137 | AddNode("s2", "Identity", {"s1"}, {{"T", type}}, &test_graph); |
| 138 | |
| 139 | GraphConstructorOptions opts; |
| 140 | TF_CHECK_OK(ConvertGraphDefToGraph(opts, test_graph, &graph_)); |
| 141 | |
| 142 | class TemplateControlDeps : public TemplateBase { |
| 143 | public: |
| 144 | TemplateControlDeps() { |
| 145 | const TempNode n0 = { |
| 146 | .key = "begin1", |
| 147 | .op = "Const", |
| 148 | .inputs = {}, |
| 149 | .outputs = {{}}, |
| 150 | .deps_inputs = {}, |
| 151 | .deps_outputs = {"s1"} |
| 152 | }; |
| 153 | temp_nodes_.emplace_back(n0); |
| 154 | const TempNode n2 = { |
| 155 | .key = "s1", |
| 156 | .op = "Identity", |
| 157 | .inputs = {}, |
| 158 | .outputs = {{"0"}}, |
| 159 | .deps_inputs = {"begin1", "end1"} |
| 160 | }; |
| 161 | temp_nodes_.emplace_back(n2); |
| 162 | |
| 163 | first_key_ = "begin1"; |
| 164 | num_inputs_ = 0; |
| 165 | num_outputs_ = 1; |
| 166 | } |
| 167 | |
| 168 | bool add_subgraph(std::map<std::string, MatchedNode>& nodes, |
| 169 | std::string name_prefix, Graph* g, |
| 170 | std::vector<const Edge*>& inputs, |
| 171 | std::vector<std::vector<const Edge*>>& outputs) override { |
| 172 | NodeDef fused_def; |
| 173 | fused_def.set_op("Output"); |
| 174 | fused_def.set_name("fused_op"); |
| 175 | Status status; |
| 176 | Node* fused_node = g->AddNode(fused_def, &status); |
| 177 | add_oedges(g, fused_node, 0, outputs[0]); |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | bool CheckDynamicInputs( |
| 182 | const Node* node, const TempNode* temp_node, int dy_mode, |
| 183 | std::vector<const Edge*>& fused_op_inputs, |
| 184 | std::map<const std::string, TempNode>& temp_node_map, |
| 185 | std::map<std::string, MatchedNode>& matched_node_map) override { |
| 186 | return false; |
nothing calls this directly
no test coverage detected