@@ -2162,15 +2162,15 @@ def sort(self) -> None:
2162
2162
2163
2163
This sort is stable. It preserves the original order as much as possible.
2164
2164
2165
- Referece : https://github.com/madelson/MedallionTopologicalSort#stable-sort
2165
+ Reference : https://github.com/madelson/MedallionTopologicalSort#stable-sort
2166
2166
2167
2167
Raises:
2168
2168
ValueError: If the graph contains a cycle, making topological sorting impossible.
2169
2169
"""
2170
2170
# Obtain all nodes from the graph and its subgraphs for sorting
2171
2171
nodes = list (onnxscript .ir .traversal .RecursiveGraphIterator (self ))
2172
2172
# Store the sorted nodes of each subgraph
2173
- sorted_nodes_by_graph : dict [Graph , list [Node ]] = {
2173
+ sorted_nodes_by_graph : dict [Graph | Function , list [Node ]] = {
2174
2174
graph : [] for graph in {node .graph for node in nodes if node .graph is not None }
2175
2175
}
2176
2176
# TODO: Explain why we need to store direct predecessors and children and why
@@ -2193,7 +2193,7 @@ def add_predecessor(child: Node, predecessor: Node | None) -> None:
2193
2193
node_depth [predecessor ] += 1
2194
2194
2195
2195
# 1. Build the direct predecessors of each node and the depth of each node
2196
- # for sorting topolocally using Kahn's algorithm.
2196
+ # for sorting topologically using Kahn's algorithm.
2197
2197
# Note that when a node contains graph attributes (aka. has subgraphs),
2198
2198
# we consider all nodes in the subgraphs *predecessors* of this node. This
2199
2199
# way we ensure the implicit dependencies of the subgraphs are captured
0 commit comments