U
    Kci
                     @   sZ   d dl Z ddlmZmZmZmZ ddlmZmZm	Z	m
Z
 edddZdd	 Zdd	gZdS )
    N   )BackendConfigBackendPatternConfigDTypeConfigObservationType)_get_binary_op_configs_get_linear_configs_get_conv_configs_get_share_qparams_op_configs)returnc                  C   s   t tjtjtjtjd} t tjtjd}ttjtj	| 
dddd}ttjtj	|}| g}| g}| g}|g}tdt|||t|t|t|S )z
    Return the `BackendConfig` for the TensorRT backend.
    NOTE: Current api will change in the future, it's just to unblock experimentation for
    new backends, please don't use it right now.
    TODO: add a README when it's more stable
    )input_dtypeoutput_dtypeZweight_dtypeZ
bias_dtype)r   r   r   r      )ZbiasinputZweightZtensorrt)r   torchZqint8floatr   ZaddmmZset_observation_typer   Z&OUTPUT_USE_DIFFERENT_OBSERVER_AS_INPUTZadd_dtype_configZ_set_input_type_to_indexcatZ OUTPUT_SHARE_OBSERVER_WITH_INPUTr   Zset_backend_pattern_configsr	   Zset_backend_pattern_configr   r   r
   )Zweighted_op_qint8_dtype_configZ"non_weighted_op_qint8_dtype_configZaddmm_configZ
cat_configZconv_dtype_configsZlinear_dtype_configsZbinary_op_dtype_configsZshare_qparams_op_dtype_configs r   Q/tmp/pip-unpacked-wheel-gikjz4vx/torch/ao/quantization/backend_config/tensorrt.pyget_tensorrt_backend_config   s\    

r   c                   C   s
   t   S )zQ
    Return the `BackendConfig` for the TensorRT backend in dictionary form.
    )r   Zto_dictr   r   r   r    get_tensorrt_backend_config_dictC   s    r   )r   Zbackend_configr   r   r   r   Z_common_operator_config_utilsr   r   r	   r
   r   r   __all__r   r   r   r   <module>   s   4