parameters: (graph: Graph, match: dict)
docstring: Create condition node and delete all useless nodes (like Switch/Merge/Identity) from condition pattern
docstring_summary: Create condition node and delete all useless nodes (like Switch/Merge/Identity) from condition pattern
docstring_tokens: Create condition node and delete all useless nodes ( like Switch / Merge / Identity ) from condition pattern
function: def replace_pattern(graph: Graph, match: dict):
          """
          Create condition node and delete all useless nodes (like Switch/Merge/Identity) from condition pattern
          """
          log.debug('================== DynamicDecoderConditionFind  ==================')
          # Create and connect condition node for dynamic decoder in TF
          loop_condiiton = match['loop_cond_data']
          iterator_data = match['identity_data']
  
          condition_attrs = dict(name=match['loop_cond'].name + '/TensorIteratorCondition_')
          condition = TensorIteratorCondition(graph, attrs=condition_attrs)
          condition.create_node_with_data(inputs=[match['Less_enter'].in_node()],
                                          data_nodes=[loop_condiiton, iterator_data])
  
          # Delete useless nodes
          safe_nodes = ['loop_cond_data', 'identity_data', 'TensorIteratorOutput', 'TensorIteratorOutput_1']
          nodes_for_remove = []
          for node in match.keys():
              if node not in safe_nodes:
                  nodes_for_remove.append(match[node].id)
          graph.remove_nodes_from(nodes_for_remove)
function_tokens: def replace_pattern ( graph : Graph , match : dict ) : log . debug ( '================== DynamicDecoderConditionFind  ==================' ) # Create and connect condition node for dynamic decoder in TF loop_condiiton = match [ 'loop_cond_data' ] iterator_data = match [ 'identity_data' ] condition_attrs = dict ( name = match [ 'loop_cond' ] . name + '/TensorIteratorCondition_' ) condition = TensorIteratorCondition ( graph , attrs = condition_attrs ) condition . create_node_with_data ( inputs = [ match [ 'Less_enter' ] . in_node ( ) ] , data_nodes = [ loop_condiiton , iterator_data ] ) # Delete useless nodes safe_nodes = [ 'loop_cond_data' , 'identity_data' , 'TensorIteratorOutput' , 'TensorIteratorOutput_1' ] nodes_for_remove = [ ] for node in match . keys ( ) : if node not in safe_nodes : nodes_for_remove . append ( match [ node ] . id ) graph . remove_nodes_from ( nodes_for_remove )