nncf/common/pruning/utils.py
def find_next_nodes_not_of_types(graph: NNCFGraph, nncf_node: NNCFNode, types: List[str]) -> List[NNCFNode]:
    """
    Traverse nodes in the graph from nncf node to find first nodes that aren't of type from types list.
    First nodes with some condition mean nodes:
        - for which this condition is true
        - reachable from `nncf_node` such that on the path from `nncf_node` to
          this nodes there are no other nodes with fulfilled condition

    :param graph: Graph to work with.
    :param nncf_node: NNCFNode to start search.
    :param types: List of types.
    :return: List of next nodes for nncf_node of type not from types list.
    """
    visited = {node_id: False for node_id in graph.get_all_node_ids()}
    partial_traverse_function = partial(traverse_function, type_check_fn=lambda x: x not in types,
                                        visited=visited)
    nncf_nodes = [nncf_node]
    if nncf_node.node_type not in types:
        nncf_nodes = graph.get_next_nodes(nncf_node)

    next_nodes = []
    for node in nncf_nodes:
        next_nodes.extend(graph.traverse_graph(node, partial_traverse_function))
    return next_nodes

    Traverse nodes in the graph from nncf node to find first nodes that aren't of type from types list.
    First nodes with some condition mean nodes:
        - for which this condition is true
        - reachable from `nncf_node` such that on the path from `nncf_node` to
          this nodes there are no other nodes with fulfilled condition

    :param graph: Graph to work with.
    :param nncf_node: NNCFNode to start search.
    :param types: List of types.
    :return: List of next nodes for nncf_node of type not from types list.
    
Traverse nodes in the graph from nncf node to find first nodes that aren't of type from types list.
First nodes with some condition mean nodes:
for which this condition is true
reachable from `nncf_node` such that on the path from `nncf_node` to
this nodes there are no other nodes with fulfilled condition
Traverse nodes in the graph from nncf node to find first nodes that aren ' t of type from types list . First nodes with some condition mean nodes : for which this condition is true reachable from ` nncf_node ` such that on the path from ` nncf_node ` to this nodes there are no other nodes with fulfilled condition
def find_next_nodes_not_of_types(graph: NNCFGraph, nncf_node: NNCFNode, types: List[str]) -> List[NNCFNode]:
    visited = {node_id: False for node_id in graph.get_all_node_ids()}
    partial_traverse_function = partial(traverse_function, type_check_fn=lambda x: x not in types,
                                        visited=visited)
    nncf_nodes = [nncf_node]
    if nncf_node.node_type not in types:
        nncf_nodes = graph.get_next_nodes(nncf_node)
    next_nodes = []
    for node in nncf_nodes:
        next_nodes.extend(graph.traverse_graph(node, partial_traverse_function))
    return next_nodes
def find_next_nodes_not_of_types ( graph : NNCFGraph , nncf_node : NNCFNode , types : List [ str ] ) -> List [ NNCFNode ] : visited = { node_id : False for node_id in graph . get_all_node_ids ( ) } partial_traverse_function = partial ( traverse_function , type_check_fn = lambda x : x not in types , visited = visited ) nncf_nodes = [ nncf_node ] if nncf_node . node_type not in types : nncf_nodes = graph . get_next_nodes ( nncf_node ) next_nodes = [ ] for node in nncf_nodes : next_nodes . extend ( graph . traverse_graph ( node , partial_traverse_function ) ) return next_nodes
Traverse nodes in the graph from nncf node to find first nodes that aren't of type from types list.
Traverse nodes in the graph from nncf node to find first nodes that aren ' t of type from types list .
"""
    Traverse nodes in the graph from nncf node to find first nodes that aren't of type from types list.
    First nodes with some condition mean nodes:
        - for which this condition is true
        - reachable from `nncf_node` such that on the path from `nncf_node` to
          this nodes there are no other nodes with fulfilled condition

    :param graph: Graph to work with.
    :param nncf_node: NNCFNode to start search.
    :param types: List of types.
    :return: List of next nodes for nncf_node of type not from types list.
    """
List of next nodes for nncf_node of type not from types list.
List of next nodes for nncf_node of type not from types list .
graph
NNCFGraph
Graph to work with.
Graph to work with .
nncf_node
NNCFNode
NNCFNode to start search.
NNCFNode to start search .
types
List[str]
List of types.
List of types .