def get_exclude_nodes(model_path, input_nodes, output_nodes):
    """
    Return the nodes to be excluded based on the given input and output nodes.
    """
    model = onnx.load(model_path)

    name_list = []
    exclude_nodes = []

    for node in model.graph.node:
        name_list.append(node.name)

    if input_nodes:
        for name in input_nodes:
            input_node_name = name
            index = name_list.index(input_node_name)
            exclude_nodes_i = name_list[:index]
            exclude_nodes = list(set(exclude_nodes) | set(exclude_nodes_i))
            exclude_nodes = list(set(exclude_nodes) - set(input_nodes))

    if output_nodes:
        for name in output_nodes:
            output_node_name = name
            index = name_list.index(output_node_name) + 1
            exclude_nodes_o = name_list[index:]
            exclude_nodes = list(set(exclude_nodes) | set(exclude_nodes_o))
            exclude_nodes = list(set(exclude_nodes) - set(output_nodes))

    return exclude_nodes

    Return the nodes to be excluded based on the given input and output nodes.
    
olive/passes/onnx/vitis_ai/quant_utils.py