def toposort(nodes: Union[Tensor, List[Tensor]]) -> List[Tensor]:
    """Generate sorted nodes by topological order. This is the foundation of all graph passes.

    Parameters
    ----------
    nodes : Union[Tensor, List[Tensor]]
        The output of the model

    Returns
    -------
    List[Tensor]
        Sorted graph
    """
    return _priSort(nodes, SizePriTensorHelper())
Generate sorted nodes by topological order. This is the foundation of all graph passes.

Parameters
----------
nodes : Union[Tensor, List[Tensor]]
The output of the model

Returns
-------
List[Tensor]
Sorted graph
python/aitemplate/compiler/transform/toposort.py