def _get_unique_dependencies(
    op: proto.MIL_pb2.Operation,
    output_name_to_op_map: Dict[str, proto.MIL_pb2.Operation],
) -> Dict[int, proto.MIL_pb2.Operation]:
    """
    Computes the unique dependencies of an operation.
    """
    queue = deque()
    queue.append(op)
    unique_ops = {}
    while len(queue) > 0:
        curr_op = queue.popleft()
        if id(curr_op) in unique_ops:
            continue

        unique_ops[id(curr_op)] = curr_op
        for dep in _retrieve_direct_dependencies(
            op=curr_op,
            output_name_to_op_map=output_name_to_op_map,
        ):
            queue.append(dep)

    return unique_ops

    Computes the unique dependencies of an operation.
    
coremltools/models/ml_program/experimental/debugging_utils.py