def to_dlc(model_file: str, model_framework: str, config: dict, output_file: str):
    """Convert a model into a SNPE DLC.

    model_file: path to the model file.
    model_framework: "onnx" or "tensorflow".
    config: a config dict with the following keys:
        input_names: List[str] = list of input names.
        input_shapes: List[str] = list of input shapes.
        input_types: Union[None, List[Union[str, None]]] = list of input types.
            None means we don't specify the input type.
        input_layouts: Union[None, List[Union[str, None]]] = list of input layouts.
            None means we don't specify the input layout.
        output_names: List[str] = list of output names.
    output_file: path to the output DLC file.
    """
    if model_framework.lower() == "onnx":
        snpe_dlc_converter_tool_name = "snpe-onnx-to-dlc"
    elif model_framework.lower() == "tensorflow":
        snpe_dlc_converter_tool_name = "snpe-tensorflow-to-dlc"
    else:
        raise NotImplementedError("Only ONNX and TensorFlow models are supported")

    d_str = _get_conversion_arg_str("-d", config["input_names"], config["input_shapes"])
    t_str = _get_conversion_arg_str("-t", config["input_names"], config["input_types"])
    l_str = _get_conversion_arg_str("-l", config["input_names"], config["input_layouts"])
    out_node_str = " ".join(["--out_node " + x for x in config["output_names"]])

    cmd = f"{snpe_dlc_converter_tool_name} -i {model_file} -o {output_file} {d_str} {out_node_str} {t_str} {l_str}"
    if config["extra_args"] is not None:
        cmd += " " + config["extra_args"]

    _, stderr = SNPERunner(use_dev_tools=True).run(cmd)

    # check if conversion succeeded
    if "Conversion completed successfully" not in stderr:
        raise RuntimeError(stderr)
Convert a model into a SNPE DLC.

    model_file: path to the model file.
    model_framework: "onnx" or "tensorflow".
    config: a config dict with the following keys:
        input_names: List[str] = list of input names.
        input_shapes: List[str] = list of input shapes.
        input_types: Union[None, List[Union[str, None]]] = list of input types.
            None means we don't specify the input type.
        input_layouts: Union[None, List[Union[str, None]]] = list of input layouts.
            None means we don't specify the input layout.
        output_names: List[str] = list of output names.
    output_file: path to the output DLC file.
    
olive/platform_sdk/qualcomm/snpe/tools/dev.py