def _match_linear_pattern(root, pattern):
    """
    Use Depth First Search to match the pattern

    :param root: operation
    :param pattern: List[Node]
    :return: Return List[operation] if pattern matches entirely else []
    """
    op = root
    if not pattern or len(op.outputs) != 1:
        return []

    node = pattern[0]
    if op.op_type != node.op_type:
        return []

    if not node.match_criterion(op):
        return []

    for child in op.outputs[0].child_ops:
        op_list = [op] + _match_linear_pattern(child, pattern[1:])
        if len(op_list) == len(pattern):
            return op_list

    return []