def _snpe_net_run_adb(
    cmd: str,
    android_target: str,
    data_dir: str,
    runs: int = 1,
    sleep: int = 0,
    persist_ws: bool = False,
    initialized: bool = False,
):
    """Run snpe-net-run on the target Android device.

    cmd: snpe-net-run command with local paths to DLC, input list and output directory
    android_target: The target Android device.
    data_dir: The path to the data directory.
    persist_ws: Whether to persist the workspace on the target Android device.
    runs: The number of times to run snpe-net-run.
    sleep: The number of seconds to sleep between runs.
    initialized: Whether the snpe inference session has been initialized using init_snpe_net_adb.
    """
    # parse main command to get paths to DLC, input list and output directory
    dlc_path = cmd.split("--container")[1].split()[0]
    input_list = cmd.split("--input_list")[1].split()[0]
    output_dir = cmd.split("--output_dir")[1].split()[0]

    # target workspace and directories
    target_ws = "/data/local/tmp/olive-snpe/ws"
    target_output_dir = f"{target_ws}/output"
    target_data_dir = f"{target_ws}/data"

    try:
        adb_utils.run_adb_command("root", android_target)

        # create clean target workspace
        if not initialized:
            adb_utils.run_adb_command(f"rm -rf {target_ws}", android_target, True)
        else:
            adb_utils.run_adb_command(f"rm -rf {target_data_dir} {target_output_dir}", android_target, True)
        adb_utils.run_adb_command(f"mkdir -p {target_ws} {target_data_dir} {target_output_dir}", android_target, True)

        # create new input list with target paths
        target_input_list = resolve_input_list(target_data_dir, input_list, str(Path(output_dir).parent), data_dir)

        # push dlc, input list and data to target
        push_pairs = [(target_input_list, target_ws), (data_dir, target_data_dir)]
        if not initialized:
            push_pairs.append((dlc_path, target_ws))
        for src, dst in push_pairs:
            adb_utils.adb_push(src, dst, android_target)

        # create new command with target paths
        cmd = cmd.replace(dlc_path, f"{target_ws}/{Path(dlc_path).name}")
        cmd = cmd.replace(input_list, f"{target_ws}/{Path(target_input_list).name}")
        cmd = cmd.replace(output_dir, target_output_dir)

        # run snpe-net-run on target
        push_snpe = not initialized
        adb_utils.run_snpe_adb_command(cmd, android_target, push_snpe, runs=runs, sleep=sleep)

        # replace ":" in output filenames with "_" if on windows before pulling
        if platform.system() == OS.WINDOWS:
            rename_cmd = (
                f"cd {target_output_dir} &&"
                " find -name '*:*' -exec sh -c 'for x; do mv $x $(echo $x | sed \"s/:/_/g\"); done' _ {} +"
            )
            adb_utils.run_adb_command(rename_cmd, android_target, True)

        # pull output from target
        adb_utils.run_adb_command(f"pull {target_output_dir}/. {Path(output_dir).as_posix()}", android_target)
    finally:
        if not persist_ws:
            # clean target workspace
            adb_utils.run_adb_command(f"rm -rf {target_ws}", android_target, True)
Run snpe-net-run on the target Android device.

    cmd: snpe-net-run command with local paths to DLC, input list and output directory
    android_target: The target Android device.
    data_dir: The path to the data directory.
    persist_ws: Whether to persist the workspace on the target Android device.
    runs: The number of times to run snpe-net-run.
    sleep: The number of seconds to sleep between runs.
    initialized: Whether the snpe inference session has been initialized using init_snpe_net_adb.
    
olive/platform_sdk/qualcomm/snpe/tools/inference.py