def _filter_by_op_type(
    visited: OrderedDict[Tensor, Set[Operator]], op_type: str
) -> OrderedDict[Operator, Set[Operator]]:
    """Go through `visited` and ony save the entries with parent op == op_type in
       the final dependency graph

    Args:
        visited (OrderedDict[Tensor, Set[Operator]]): {tensor: descendants of tensor} pairs
            for all tensors in the graph
        op_type (str): The op type to be grouped

    Returns:
        OrderedDict[Operator, Set[Operator]]: The final dependency graph
    """
    final = collections.OrderedDict()
    for parent, descendants in visited.items():
        if parent.src_ops():
            src_op = list(parent.src_ops())[0]
            parent_op_type = src_op._attrs["op"]
            if parent_op_type == op_type:
                final[src_op] = descendants
    return final
Go through `visited` and ony save the entries with parent op == op_type in
the final dependency graph

Args:
visited (OrderedDict[Tensor, Set[Operator]]): {tensor: descendants of tensor} pairs
for all tensors in the graph
op_type (str): The op type to be grouped

Returns:
OrderedDict[Operator, Set[Operator]]: The final dependency graph
python/aitemplate/compiler/transform/fuse_group_ops.py