
    Vh6                        d dl mZ d dlZd dlmZm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mZ d dlmZ er
d d	lmZ d dlZ G d
 dej.                        Zy)    )annotationsN)CallableTYPE_CHECKING)python)fake_tensor)proxy_tensor)_passdiagnostics)_utils)Mappingc                  >     e Zd Z	 d	 	 	 	 	 	 	 	 	 d fdZ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         U/home/dcms/DCMS/lib/python3.12/site-packages/torch/onnx/_internal/fx/passes/decomp.pyr   zDecompose.__init__   s-     	+V4#6 #6 #6     c                t   |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t        | 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   unset_fake_temporarilypython_dispatchenable_python_dispatcherr   make_fxr   boolr   #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$ 8<~~	1$11)CdC  "L #..0I)-)A)A:vL $$$..0	 446	  	 
! 4 4$($<$<)'+%)$*B*B%C! ! 	  	  	  	223DdkkR  #	  	  	  	  	  	 s<   	D.D"!;DD"$D.DD""D+	'D..D7)F)
r   zdiagnostics.DiagnosticContextr   torch.fx.GraphModuler   z(Mapping[torch._ops.OpOverload, Callable]r   r+   r   zbool | None)returnr2   )__name__
__module____qualname__r   r1   __classcell__)r   s   @r   r   r      sC     ,1797 %7 F	7
 "7 )74!r   r   )
__future__r   r%   typingr   r   torch
torch._opstorch._dispatchr   r(   torch._subclassesr   torch.fx.experimentalr   torch.onnx._internal.fxr	   r
   torch.onnx._internal.fx.passesr   collections.abcr   torch.fx	Transformr    r   r   <module>rE      s@    "  *   5 ) . 6 1 'B! B!r   