tensorflow/core/grappler/utils/pattern_utils_test.cc
// Pattern should not be matched if any of candidate remove nodes has external
// dependent.
Pattern should not be matched if any of candidate remove nodes has external
dependent.
Pattern should not be matched if any of candidate remove nodes has external dependent .
TEST_F(PatternMatcherTest, MatMulBiasAddGeluExternalDependent) {
  ::tensorflow::Status status;
  GraphDef graph;
  GetMatMulBiasAddGeluGraph(&graph, true);
  OpTypePattern pattern = GetMatMulBiasAddGeluPattern();
  MutableGraphView graph_view(&graph, &status);
  TF_ASSERT_OK(status);
  TF_EXPECT_OK(graph_view.SortTopologically(false, {}));
  auto root_node_view = graph_view.GetNode("gelu");
  SubGraphMatcher<MatchingDirection::kFollowInputs> graph_matcher(&graph_view);
  std::map<string, int> matched_nodes_map;  
  std::set<int> remove_node_indices;
  bool found_match = graph_matcher.GetMatchedNodes(
      pattern, {}, root_node_view, &matched_nodes_map, &remove_node_indices);
  EXPECT_FALSE(found_match);
  EXPECT_TRUE(matched_nodes_map.empty());
  EXPECT_TRUE(remove_node_indices.empty());
}
TEST_F ( PatternMatcherTest , MatMulBiasAddGeluExternalDependent ) { :: tensorflow :: Status status ; GraphDef graph ; GetMatMulBiasAddGeluGraph ( & graph , true ) ; OpTypePattern pattern = GetMatMulBiasAddGeluPattern ( ) ; MutableGraphView graph_view ( & graph , & status ) ; TF_ASSERT_OK ( status ) ; TF_EXPECT_OK ( graph_view . SortTopologically ( false , { } ) ) ; auto root_node_view = graph_view . GetNode ( " " ) ; SubGraphMatcher < MatchingDirection :: kFollowInputs > graph_matcher ( & graph_view ) ; std :: map < string , int > matched_nodes_map ; std :: set < int > remove_node_indices ; bool found_match = graph_matcher . GetMatchedNodes ( pattern , { } , root_node_view , & matched_nodes_map , & remove_node_indices ) ; EXPECT_FALSE ( found_match ) ; EXPECT_TRUE ( matched_nodes_map . empty ( ) ) ; EXPECT_TRUE ( remove_node_indices . empty ( ) ) ; }
Pattern should not be matched if any of candidate remove nodes has external
dependent.
Pattern should not be matched if any of candidate remove nodes has external dependent .
/*add_external_dependent=*/ /*ignore_cycles=*/ // label to node index map