def create_input_list(
    data_dir: str,
    input_names: list[str],
    input_dirs: list[str | None] = None,
    input_list_file: str = None,
    add_input_names: bool = False,
    add_output_names: bool = False,
    output_names: list[str] = None,
    append_0: bool = False,
    num_samples: int = None,
) -> str:
    """Create an input list file for a data directory.

    data_dir: The data directory to create the input list file for.
    input_names: The names of the inputs.
    input_dirs: The sub-directories of data_dir containing the input data.
        If not specified, the input directories are assumed to be the same as the input names.
        List values can be None if the input directory is the same as the input name.
        We assume all input directories have the same members.
    input_list_file: The path to the input list file to create. If not specified, the input list file is created in
        the data directory with the name 'input_list.txt'.
    add_input_names: If True, the input names are added to the input list file. Only used if there is one input, for
        multiple inputs, the input names are always added.
    add_output_names: If True, the output names are added to the input list file.
    output_names: The names of the outputs. Required if add_output_names is True.
    append_0: If True, a ":0" is appended to the input names. For some reason, SNPE attaches a ":0" to the input and
        output names when converting TensorFlow models to SNPE DLC.
        TODO[jiapli]: To be verify for QNN SDK.
    num_samples: The number of samples to add to the input list file. If not specified, all samples are added.
    """
    data_dir_path = Path(data_dir).resolve()
    if not data_dir_path.is_dir():
        raise FileNotFoundError(f"Data directory '{data_dir}' ({str(data_dir_path)}) does not exist")

    # path to data directory to each input relative to data_dir
    input_dirs = input_dirs or input_names
    # resolve None values in input_dirs to corresponding input_names
    input_dirs = [input_dir or input_name for input_dir, input_name in zip(input_dirs, input_names)]
    for input_dir in input_dirs:
        if not (data_dir_path / input_dir).is_dir():
            raise FileNotFoundError(
                f"Input directory '{input_dir}' does not exist in data directory '{data_dir}' ({data_dir_path})"
            )

    # add input names to input_list
    # always add input names if there is more than one input
    add_input_names = add_input_names or len(input_names) > 1

    input_dir_members = get_dir_members(data_dir_path / input_dirs[0])
    # check all input dirs have the same member file names
    if len(input_names) > 1:
        for input_dir in input_dirs:
            members = get_dir_members(data_dir_path / input_dir)
            if members != input_dir_members:
                raise ValueError(f"Input directories {input_dirs[0]}' and '{input_dir}' do not have the same members")

    input_list_content = ""
    zero_str = ":0" if append_0 else ""
    if add_output_names:
        if not output_names:
            raise ValueError("Output names must be specified if add_output_names is True")
        input_list_content += "%" + " ".join([f"{output_name}{zero_str}" for output_name in output_names]) + "\n"
    if num_samples is not None:
        input_dir_members = input_dir_members[:num_samples]
    for member in input_dir_members:
        if not add_input_names:
            input_list_content += f"{input_dirs[0]}/{member.as_posix()}" + "\n"
        else:
            input_list_content += (
                " ".join(
                    [
                        f"{input_name}{zero_str}:={input_dir}/{member.as_posix()}"
                        for input_name, input_dir in zip(input_names, input_dirs)
                    ]
                )
                + "\n"
            )

    input_list_file = input_list_file or str(data_dir_path / "input_list.txt")
    with Path(input_list_file).open("wb") as f:
        f.write(input_list_content.encode("utf-8"))

    return input_list_file
Create an input list file for a data directory.

    data_dir: The data directory to create the input list file for.
    input_names: The names of the inputs.
    input_dirs: The sub-directories of data_dir containing the input data.
        If not specified, the input directories are assumed to be the same as the input names.
        List values can be None if the input directory is the same as the input name.
        We assume all input directories have the same members.
    input_list_file: The path to the input list file to create. If not specified, the input list file is created in
        the data directory with the name 'input_list.txt'.
    add_input_names: If True, the input names are added to the input list file. Only used if there is one input, for
        multiple inputs, the input names are always added.
    add_output_names: If True, the output names are added to the input list file.
    output_names: The names of the outputs. Required if add_output_names is True.
    append_0: If True, a ":0" is appended to the input names. For some reason, SNPE attaches a ":0" to the input and
        output names when converting TensorFlow models to SNPE DLC.
        TODO[jiapli]: To be verify for QNN SDK.
    num_samples: The number of samples to add to the input list file. If not specified, all samples are added.
    
olive/platform_sdk/qualcomm/utils/input_list.py