o
    ;ήc
                     @   sR   d dl Z d dlZd dlZejdd ddlmZmZ dd Zedkr'e  dS dS )	    Nz%(levelname)s:  %(message)s)format   )"check_model_can_use_ort_mobile_pkgusability_checkerc                  C   s  t jdt jd} | jdddtjt d | jdg dd	d
d | jddtjd |  }t	
d}|jdkr>|t	j n|jd	krJ|t	j n|jdkrV|t	j n|t	j tj|jd|d}t|j|j| |d |r||d d S |d d S )NzAnalyze an ONNX model to determine how well it will work in mobile scenarios, and whether
        it is likely to be able to use the pre-built ONNX Runtime Mobile Android or iOS package.)descriptionformatter_classz--config_pathzbPath to required operators and types configuration used to build the pre-built ORT mobile package.F)helprequiredtypedefaultz--log_level)debuginfowarningerrorr   zLogging level)choicesr   r   
model_pathzPath to ONNX model to check)r   r
   check_usabilityr   r   )skip_optimizeloggera  Run `python -m onnxruntime.tools.convert_onnx_models_to_ort ...` to convert the ONNX model to ORT format. By default, the conversion tool will create an ORT format model with saved optimizations which can potentially be applied at runtime (with a .with_runtime_opt.ort file extension) for use with NNAPI or CoreML, and a fully optimized ORT format model (with a .ort file extension) for use with the CPU EP.a
  As NNAPI or CoreML may provide benefits with this model it is recommended to compare the performance of the <model>.with_runtime_opt.ort model using the NNAPI EP on Android, and the CoreML EP on iOS, against the performance of the <model>.ort model using the CPU EP.zNFor optimal performance the <model>.ort model should be used with the CPU EP. )argparseArgumentParserArgumentDefaultsHelpFormatteradd_argumentpathlibPathr   get_default_config_path
parse_argslogging	getLogger	log_levelsetLevelDEBUGINFOWARNINGERRORr   analyze_modelr   	run_checkconfig_pathr   )parserargsr   try_eps r+   Z/tmp/pip-target-vg8gfxp4/lib/python/onnxruntime/tools/check_onnx_model_mobile_usability.pyr      sD   



r   __main__)	r   r   r   basicConfigmobile_helpersr   r   r   __name__r+   r+   r+   r,   <module>   s   4
