def _detect_cycle(group: Set[Operator]) -> bool:
    """
    Given a group of ops, to detect if they would form cycles, i.e.
      --> group_ops
     /      /
    A <-----
    we need to find all parents of all ops in that group
    and see if any parent's ancester (execluding the ones already in the group) exists in the group.
    """
    parents = [o for op1 in group for i in op1._attrs["inputs"] for o in i.src_ops()]
    for op1 in group:
        for op2 in set(parents) - group:
            if transform_utils.is_ancestor(op1, op2):
                return True
    return False
Given a group of ops, to detect if they would form cycles, i.e.
--> group_ops
/      /
A <-----
we need to find all parents of all ops in that group
and see if any parent's ancester (execluding the ones already in the group) exists in the group.
python/aitemplate/compiler/transform/fuse_ops.py