U
    yhy                     @   sl   d dl Z d dlmZ d dlmZ d dlmZ d dlmZm	Z	 dgZ
G dd de jjjZG d	d deZdS )
    N)Tracer)Scope)_FusedModule)ListCallableQuantizationTracerc                       s*   e Zd Zeejjed fddZ  Z	S )ScopeContextManager)scopecurrent_modulecurrent_module_pathc                    s   t  |t|t| d S )N)super__init__r   type)selfr	   r
   r   	__class__ Q/var/www/html/venv/lib/python3.8/site-packages/torch/ao/quantization/fx/tracer.pyr      s    zScopeContextManager.__init__)
__name__
__module____qualname__r   torchnnModulestrr   __classcell__r   r   r   r   r      s   r   c                       sB   e Zd Zee ee d fddZejj	ee
dddZ  ZS )r   )skipped_module_namesskipped_module_classesc                    s,   t    || _|| _tdd | _d| _d S )N T)r   r   r   r   r   r	   Zrecord_stack_traces)r   r   r   r   r   r   r      s
    
zQuantizationTracer.__init__)mmodule_qualified_namereturnc                 C   sJ   |j ds|j dr(t|tjj pH|| jkpHt|| jkpHt|t	S )Nztorch.nnztorch.ao.nn)
r   
startswith
isinstancer   r   Z
Sequentialr   r   r   r   )r   r   r    r   r   r   is_leaf_module$   s    z!QuantizationTracer.is_leaf_module)r   r   r   r   r   r   r   r   r   r   boolr$   r   r   r   r   r   r      s    )r   Ztorch.fx._symbolic_tracer   Ztorch.fx.proxyr   Ztorch.ao.nn.intrinsicr   typingr   r   __all__Zfxproxyr   r   r   r   r   r   <module>   s   
