
    Phe                        d dl mZ d dlZd dlmZmZmZ d dlZd dlZd dl	Zd dl
mZ d dlmZ d dlmZ d dlmZ d dlmZmZ d d	lmZ  G d
 dej0                        Zy)    )annotationsN)CallableMappingOptional)python)fake_tensor)proxy_tensor)	_beartype)_passdiagnostics)_utilsc                  \     e Zd Z	 d	 	 	 	 	 	 	 	 	 d fdZej
                  dd       Z xZS )	Decomposec                P    t         |   ||       || _        || _        || _        y )N)super__init__decomposition_tableenable_dynamic_axesallow_fake_constant)selfdiagnostic_contextmoduler   r   r   	__class__s         pC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/onnx/_internal/fx/passes/decomp.pyr   zDecompose.__init__   s-     	+V4#6 #6 #6     c                b   |rJ d       t        j                  | j                        }| j                  } | j                  |g| }|d}n$t        j                         }| j                  rdnd}|J t        j                         5  t        j                         5  |5   t        j                  || j                  |d| j                        | }d d d        d d d        d d d        t        j                  | j                         |S # 1 sw Y   ;xY w# 1 sw Y   ?xY w# 1 sw Y   CxY w)Nz%kwargs is not supported in Decompose.realsymbolicfakeT)r   tracing_mode_allow_non_fake_inputs_allow_fake_constant)r   ,wrap_graph_module_for_node_meta_preservationr   	fake_mode_maybe_fakefy_args
contextlibnullcontextr   r	   maybe_disable_fake_tensor_modepython_dispatchenable_python_dispatchermake_fxr   r   #replace_placeholder_name_and_target)r   argskwargsr   r$   maybe_fake_argsr    decomposed_modules           r   _runzDecompose._run    s   BBBz DDT[[Q$ ;?..	1$11)CdC  "L #..0I)-)A)A:vL $$$88:O<d<d<f! 4 4$($<$<)'+%)%=%=! !   =g: 	223DdkkR   I =g<f::s<   	D%D!2DDD%DDD"	D%%D.)F)
r   zdiagnostics.DiagnosticContextr   torch.fx.GraphModuler   z(Mapping[torch._ops.OpOverload, Callable]r   boolr   zOptional[bool])returnr2   )__name__
__module____qualname__r   r
   beartyper1   __classcell__)r   s   @r   r   r      sX     /4797 %7 F	7
 "7 ,7 2! 2!r   r   )
__future__r   r&   typingr   r   r   torch
torch._opstorch.fxtorch._dispatchr   r)   torch._subclassesr   torch.fx.experimentalr	   torch.onnx._internalr
   torch.onnx._internal.fxr   r   torch.onnx._internal.fx.passesr   	Transformr    r   r   <module>rG      s>    "  . .    5 ) . * 6 1A! A!r   