| 34 | using FDH = FunctionDefHelper; |
| 35 | |
| 36 | void CompareNodeFanins(const MutableGraphView& graph, NodeDef* node, |
| 37 | absl::Span<const string> fanins) { |
| 38 | ASSERT_EQ(node->input_size(), fanins.size()); |
| 39 | for (int i = 0; i < node->input_size(); ++i) { |
| 40 | TensorId tensor_id = ParseTensorName(fanins[i]); |
| 41 | EXPECT_EQ(ParseTensorName(node->input(i)), tensor_id); |
| 42 | int port; |
| 43 | if (tensor_id.index() == Graph::kControlSlot) { |
| 44 | port = Graph::kControlSlot; |
| 45 | } else { |
| 46 | port = i; |
| 47 | } |
| 48 | MutableGraphView::InputPort input_port(node, port); |
| 49 | MutableGraphView::OutputPort output_port = |
| 50 | graph.GetOutputPort(tensor_id.node(), tensor_id.index()); |
| 51 | EXPECT_TRUE(graph.GetFanin(input_port).contains(output_port)); |
| 52 | EXPECT_TRUE(graph.GetFanout(output_port).contains(input_port)); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void CompareNodeFanouts(const MutableGraphView& graph, NodeDef* node, |
| 57 | absl::Span<const string> fanouts) { |
no test coverage detected