Ë
    f^(hœk  ã                   ó>  — d dl Z d dlZd dlZd dlZd dl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mZ d dlmZmZmZ d dlZd dlmc mZ d dlmZmZ d dlmZ dd	lmZ dd
l m!Z!m"Z"m#Z# ddl$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z- g d¢Z. ej^                  e0«      Z1 ed¬«       G d„ d«      «       Z2 ed¬«       G d„ d«      «       Z3g d¢Z4 ed¬«       G d„ d«      «       Z5 ed¬«       G d„ de5«      «       Z6 ed¬«      d„ «       Z7 ed¬«       G d„ de8«      «       Z9 ed¬«       G d„ d«      «       Z: ed¬«       G d „ d!e:«      «       Z; ed¬«       G d"„ d#e:«      «       Z< ed¬«       G d$„ d%e:«      «       Z=e"D ]  Z>d&„ Z? e?e>«       Œ d'„ Z@e#D ]
  ZA e@eA«       Œ d(„ ZBd)„ ZCg e)¢ eDd«      ‘ eDd*«      ‘ejŠ                  jŒ                  ‘ejŠ                  jŽ                  ‘D � ci c]  } | d+„ “Œ c} ZHd,„ eHe:<   d-„ eHeI<   d.„ eHeJ<   eCeHeK<   eHeJ   eHe&<   eHeK   eHe%<   yc c} w )/é    N)ÚOrderedDict)ÚIterator)ÚfieldsÚis_dataclass)ÚAnyÚCallableÚOptional)Ú_fx_map_aggregateÚ_fx_map_arg)ÚCapturedTracebacké   )Úcompatibility)ÚGraphÚmagic_methodsÚreflectable_magic_methods)Úimmutable_dictÚimmutable_list)ÚArgumentÚ
base_typesÚNodeÚTarget)Úcheck_for_mutable_operation)	Ú
TracerBaseÚGraphAppendingTracerÚ
TraceErrorÚProxyÚ	MetaProxyÚ	AttributeÚParameterProxyÚScopeÚScopeContextManagerF©Úis_backward_compatiblec                   ó,   ‡ — e Zd ZdZdedefˆ fd„Zˆ xZS )r    a7  Scope object that records the module path and the module type
    of a module. Scope is used to track the information of the module
    that contains a Node in a Graph of GraphModule. For example::

        class Sub(torch.nn.Module):
            def forward(self, x):
                # This will be a call_method Node in GraphModule,
                # scope for this would be (module_path="sub", module_type=Sub)
                return x.transpose(1, 2)


        class M(torch.nn.Module):
            def __init__(self) -> None:
                self.sub = Sub()

            def forward(self, x):
                # This will be a call_method Node as well,
                # scope for this would be (module_path="", None)
                x = x.transpose(1, 2)
                x = self.sub(x)
                return x

    Úmodule_pathÚmodule_typec                 ó>   •— t         ‰| �  «        || _        || _        y ©N)ÚsuperÚ__init__r%   r&   )Úselfr%   r&   Ú	__class__s      €úL/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/fx/proxy.pyr*   zScope.__init__F   s   ø€ Ü‰ÑÔØ&ˆÔØ&ˆÕó    )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r*   Ú__classcell__©r,   s   @r-   r    r    ,   s    ø„ ñð0' Cð '°c÷ 'ñ 'r.   r    c                   ó8   ‡ — e Zd ZdZdedefˆ fd„Zd„ Zd„ Zˆ xZS )r!   zúA context manager to track the Scope of Node during symbolic tracing.
    When entering a forward function of a Module, we'll update the scope information of
    the current module, and when we exit, we'll restore the previous scope information.
    ÚscopeÚcurrent_scopec                 ó¨   •— t         ‰| �  «        t        j                  |«      | _        |j                  |_        |j
                  |_        || _        y r(   )r)   r*   ÚcopyÚ_prev_scoper%   r&   Ú_scope)r+   r7   r8   r,   s      €r-   r*   zScopeContextManager.__init__S   sD   ø€ ô
 	‰ÑÔäŸ9™9 UÓ+ˆÔà)×5Ñ5ˆÔØ)×5Ñ5ˆÔàˆ�r.   c                 ó   — | j                   S r(   )r<   ©r+   s    r-   Ú	__enter__zScopeContextManager.__enter__a   s   € Ø�{‰{Ðr.   c                 ó˜   — | j                   j                  | j                  _        | j                   j                  | j                  _        y r(   )r;   r%   r<   r&   )r+   Úargss     r-   Ú__exit__zScopeContextManager.__exit__d   s5   € Ø"&×"2Ñ"2×">Ñ">ˆ�‰ÔØ"&×"2Ñ"2×">Ñ">ˆ�‰ÔØr.   )	r/   r0   r1   r2   r    r*   r?   rB   r4   r5   s   @r-   r!   r!   L   s)   ø„ ñð
àðð õòör.   r!   )Únn_module_stackÚtorch_fnÚsource_fn_stackÚoriginal_atenÚ	recomputeÚac_graph_idÚhas_backward_hookÚ	from_nodeÚquantization_tagÚ_numeric_debug_handleÚcustomÚpartitioner_tagÚarg_kwarg_valsTc                   óD  — e Zd ZU eed<   dZeed<   dZeed<   dZeed<   dZ	eed<   dZ
eed<   eed	<   eeeeef   f   ed
<   eeeeef   f   ed<    ed¬«      	 	 d$dededeedf   deeef   dee   dee   defd„«       Z ed¬«      deddfd„«       Z ed¬«      	 	 	 d%dededeedf   deeef   dee   dee   deegdf   fd„«       Zd„ Z ed¬«      dedefd„«       Z ed¬«      d ddefd!„«       Z ed¬«      d ddefd"„«       Z ed¬«      d ddefd#„«       Z y)&r   ÚgraphFÚrecord_stack_tracesÚcheck_mutable_operationsÚtrace_assertsÚproxy_buffer_attributesÚforwardÚtraced_func_namer7   Úmodule_stackÚnode_name_to_scopeTr"   NÚkindÚtargetrA   .ÚkwargsÚnameÚ	type_exprÚreturnc                 ó.  — |dk(  r| j                   rt        |||«       | j                  j                  ||||||«      }| j                  j
                  | j                  j                  f| j                  |j                  <   t        j                  «       r±t        j                  «       }|j                  d«      }	|	r|	|_        t        D ],  }
|
|v sŒt        j                  ||
   «      |j                   |
<   Œ. t"        j$                  j'                  «       dz
  }|j                  dd«      dkD  r|d   d   }||j                   d<   n8| j(                  r,t        j                  | j(                  «      |j                   d	<   t*        j-                  d
|«       |S )a'  
        Inserts a graph node given target, args, kwargs, and name.

        This method can be overridden to do extra checking, validation, or
        modification of values used in node creation. For example, one might
        want to disallow in-place operations from being recorded.
        Úcall_functionÚstack_tracer   Ú
in_grad_fnr   Úgrad_fn_seq_nréÿÿÿÿÚseq_nrrC   zcreate_node %s)rS   r   rQ   Úcreate_noder7   r%   r&   rY   r]   Úfx_tracebackÚhas_preserved_node_metaÚget_current_metaÚgetrb   Ú_COPY_META_FIELDSr:   ÚmetaÚtorchÚautogradÚ_get_sequence_nrrX   ÚlogÚdebug)r+   rZ   r[   rA   r\   r]   r^   ÚnodeÚcurrent_metarb   ÚfieldÚ
new_seq_nrs               r-   rg   zTracerBase.create_node”   sg  € ð$ �?Ò" t×'DÒ'DÜ'¨°°fÔ=à�z‰z×%Ñ% d¨F°D¸&À$È	ÓRˆð �J‰J×"Ñ"Ø�J‰J×"Ñ"ð.
ˆ×Ñ §	¡	Ñ*ô ×/Ñ/Ô1Ü+7×+HÑ+HÓ+JˆLà&×*Ñ*¨=Ó9ˆKÙØ#.�Ô ô +ò F�Ø˜LÒ(Ü'+§y¡y°¸eÑ1DÓ'E�D—I‘I˜eÒ$ðFô Ÿ™×8Ñ8Ó:¸QÑ>ˆJð ×Ñ ¨aÓ0°1Ò4Ø)Ð*:Ñ;¸BÑ?�
Ø",ˆD�I‰I�hÒà×ÒÜ+/¯9©9°T×5FÑ5FÓ+GˆD�I‰IÐ'Ñ(ä�	‰	Ð" DÔ)Øˆr.   rs   r   c                 ó   — t        || «      S r(   )r   )r+   rs   s     r-   ÚproxyzTracerBase.proxyÒ   s   € ä�T˜4Ó Ð r.   Úproxy_factory_fnc                 óº  — | j                  |«      }| j                  |«      }	t        |t        «      sJ ‚t        |	t        «      sJ ‚| j	                  ||||	||«      }
|s| j                  |
«      }n ||
«      }| j                  rV|j                  j                  s@dj                  t        j                  «       j                  «       «      |j                  _        |S )ao  
        Create a Node from the given arguments, then return the Node
        wrapped in a Proxy object.

        If kind = 'placeholder', then we're creating a Node that
        represents the parameter of a function. If we need to encode
        a default parameter, we use the ``args`` tuple. ``args`` is
        otherwise empty for ``placeholder`` Nodes.
        Ú )Ú
create_argÚ
isinstanceÚtupleÚdictrg   rx   rR   rs   rb   Újoinr   ÚextractÚformat)r+   rZ   r[   rA   r\   r]   r^   ry   Úargs_Úkwargs_rs   rx   s               r-   Úcreate_proxyzTracerBase.create_proxyÖ   s·   € ð, —‘ Ó%ˆØ—/‘/ &Ó)ˆÜ˜%¤Ô'Ð'Ð'Ü˜'¤4Ô(Ð(Ð(à×Ñ  f¨e°W¸dÀIÓNˆáØ—J‘J˜tÓ$‰Eá$ TÓ*ˆEà×#Ò#¨E¯J©J×,BÒ,BØ%'§W¡WÔ->×-FÑ-FÓ-H×-OÑ-OÓ-QÓ%RˆE�J‰JÔ"àˆr.   c                 óŽ   ‡— t        j                  «       Šg d¢}‰r&‰j                  Š‰rt        ˆfd„|D «       «      rn‰rŒ&‰sy‰S )zf
        Find the Python stack frame executing the user code during
        symbolic tracing.
        )
ztorch/fx/proxy.pyztorch/fx/_symbolic_trace.pyz%torch/fx/experimental/proxy_tensor.pyztorch/_ops.pyztorch/_tensor.pyztorch/utils/_python_dispatch.pyztorch/_prims_common/wrappers.pyztorch/_refs/__init__.pyz%torch/_refs/nn/functional/__init__.pyztorch/utils/_stats.pyc              3   ój   •K  — | ]*  }‰j                   j                  j                  |«       –— Œ, y ­wr(   )Úf_codeÚco_filenameÚendswith)Ú.0ÚfileÚframes     €r-   ú	<genexpr>z.TracerBase._find_user_frame.<locals>.<genexpr>  s.   øè ø€ ò Ø@D�E—L‘L×,Ñ,×5Ñ5°dÓ;Ô;ñùs   ƒ03N)ÚinspectÚcurrentframeÚf_backÚall)r+   Úpt_filesr�   s     @r-   Ú_find_user_framezTracerBase._find_user_frameý   sV   ø€ ô ×$Ñ$Ó&ˆò
ˆñ Ø—L‘LˆEÙœó ØHPôô ð ò ñ Øàˆr.   Úac           
      óò  — t         j                  t        |«      «      }|�	 || |«      S t        |t        «      r|j
                  S t        |d«      r|j                  | «      S t        |t        «      rft        |d«      r,|D �cg c]  }| j                  |«      ‘Œ }} t        |«      |Ž S  t        |«      |D �cg c]  }| j                  |«      ‘Œ c}«      S t        |t        «      r|D �cg c]  }| j                  |«      ‘Œ c}S t        |t        «      rt        | |«      S t        |t        «      rXt        | j                  |j                  «      | j                  |j                  «      | j                  |j                   «      «      S t        |t"        «      rXt#        | j                  |j                  «      | j                  |j                  «      | j                  |j                   «      «      S t        |t$        j&                  j(                  t$        j&                  j*                  f«      r|S t-        |«      rdt/        |«      D �ci c]2  }|j0                  | j                  t3        ||j0                  «      «      “Œ4 }}| j5                  d|j6                  d|«      S t        |g t8        ¢t:        j<                  ‘­«      s|�|du r|S t?        dt        |«      › �«      ‚c c}w c c}w c c}w c c}w )zÔ
        A method that lowers the objects seen as arguments during symbolic evaluation
        into Argument types that can be stored in IR.

        Can be override to support more trace-specific types.
        Ú__fx_create_arg__Ú_fieldsra   © .zargument of type: ) Ú_create_arg_bypassrk   Útyper}   r   rs   Úhasattrr—   r~   r|   Úlistr   Ú_create_arg_dictÚsliceÚstartÚstopÚstepÚrangern   Ú_opsÚ
OpOverloadÚHigherOrderOperatorr   r   r]   Úgetattrrg   r,   r   ÚenumÚEnumÚNotImplementedError)r+   r•   ÚhandlerÚelemrA   ru   r\   s          r-   r|   zTracerBase.create_arg  sl  € ô& %×(Ñ(¬¨a«Ó1ˆØÐñ ˜4 Ó#Ð#ä�aœÔØ—6‘6ˆMÜ�QÐ+Ô,Ø×&Ñ& tÓ,Ð,ä˜œ5Ô!Ü�q˜)Ô$ð ;<Ö<°$˜Ÿ™¨Õ-Ð<�Ð<Ø”t˜A“w �~Ð%Ø”4˜“7¸aÖ@°d˜DŸO™O¨DÕ1Ò@ÓAÐAÜ˜œ4Ô Ø67Ö8¨d�D—O‘O DÕ)Ò8Ð8Ü˜œ4Ô Ü# D¨!Ó,Ð,Ü˜œ5Ô!ÜØ—‘ §¡Ó(Ø—‘ §¡Ó'Ø—‘ §¡Ó'óð ô ˜œ5Ô!ÜØ—‘ §¡Ó(Ø—‘ §¡Ó'Ø—‘ §¡Ó'óð ô ˜œEŸJ™J×1Ñ1´5·:±:×3QÑ3QÐRÔSØˆHä˜!Œ_ô $ A›Yöàð —
‘
˜DŸO™O¬G°A°u·z±zÓ,BÓCÑCðˆFð ð ×#Ñ# O°Q·[±[À"ÀfÓMÐMä˜Ð3œZÐ3¬¯©Ñ3Ô4¸¸	ÀQÈ#ÁXØˆHä!Ð$6´t¸A³w°iÐ"@ÓAÐAùòE =ùâ@ùâ8ùò*s   ÂK%Â:K*Ã-K/É7K4Úobjc                 ó   — t        d«      ‚)aF  Called when a proxy object is being converted to a boolean, such as
        when used in control flow.  Normally we don't know what to do because
        we don't know the value of the proxy, but a custom tracer can attach more
        information to the graph node using create_node and can choose to return a value.
        zFsymbolically traced variables cannot be used as inputs to control flow©r   ©r+   r­   s     r-   Úto_boolzTracerBase.to_boolg  s   € ô ØTó
ð 	
r.   c                 ó   — t        d«      ‚)aA  Called when a proxy object is being iterated over, such as
        when used in control flow.  Normally we don't know what to do because
        we don't know the value of the proxy, but a custom tracer can attach more
        information to the graph node using create_node and can choose to return an iterator.
        aH  Proxy object cannot be iterated. This can be attempted when the Proxy is used in a loop or as a *args or **kwargs function argument. See the torch.fx docs on pytorch.org for a more detailed explanation of what types of control flow can be traced, and check out the Proxy docstring for help troubleshooting Proxy iteration errorsr¯   r°   s     r-   ÚiterzTracerBase.iterr  s   € ô ð%ó	
ð 		
r.   c                 ó$   —  t        |d«      «       S )zÖCalled when a proxy object is has the keys() method called.
        This is what happens when ** is called on a proxy. This should return an
        iterator it ** is suppose to work in your custom tracer.
        Úkeys©r   r°   s     r-   rµ   zTracerBase.keys„  s   € ð &Œy˜˜fÓ%Ó'Ð'r.   ©NN)NNN)!r/   r0   r1   r   Ú__annotations__rR   ÚboolrS   rT   rU   rW   r3   r    r   r~   r   r   r›   r   r   r   r	   r   rg   rx   r   r…   r”   r|   r±   r   r³   rµ   r™   r.   r-   r   r   {   sY  … àƒLØ %Ð˜Ó%ð &+Ð˜dÓ*à€M�4Óà$)Ð˜TÓ)ð &Ð�cÓ%ð ƒLð ˜c 5¨¨c¨¡?Ð2Ñ3Ó3ð ˜S %¨¨T¨	Ñ"2Ð2Ñ3Ó3á¨$Ô/ð #Ø#'ñ;àð;ð ð;ð �H˜c�MÑ"ð	;ð
 �S˜(�]Ñ#ð;ð �s‰mð;ð ˜C‘=ð;ð 
ò;ó 0ð;ñz ¨$Ô/ð!˜$ð ! 7ò !ó 0ð!ñ ¨$Ô/ð #Ø#'à6:ñ$àð$ð ð$ð �C˜�H‰oð	$ð
 �S˜#�X‘ð$ð �s‰mð$ð ˜C‘=ð$ð # D 6¨7 ?Ñ3ò$ó 0ð$òL ñD ¨$Ô/ðEB˜Cð EB Hò EBó 0ðEBñN ¨$Ô/ð
˜7ð 
 tò 
ó 0ð
ñ ¨$Ô/ð
˜ð 
 Hò 
ó 0ð
ñ" ¨$Ô/ð(˜ð ( Cò (ó 0ñ(r.   r   c                   ó$   ‡ — e Zd Zdefˆ fd„Zˆ xZS )r   rQ   c                 ó’   •— t         ‰| �  «        || _        t        dd «      | _        t        j                  «       | _        i | _        y )Nr{   )	r)   r*   rQ   r    r7   Úcollectionsr   rX   rY   )r+   rQ   r,   s     €r-   r*   zGraphAppendingTracer.__init__�  s;   ø€ Ü‰ÑÔØˆŒ
Ü˜2˜t“_ˆŒ
Ü'×3Ñ3Ó5ˆÔØ"$ˆÕr.   )r/   r0   r1   r   r*   r4   r5   s   @r-   r   r   Ž  s   ø„ ð%˜e÷ %ñ %r.   r   c                 ó   — | sJ ‚y r(   r™   ©Úxs    r-   Ú	assert_fnrÀ   ˜  s	   € á€H‰1r.   c                   ó   — e Zd Zy)r   N)r/   r0   r1   r™   r.   r-   r   r   �  s   „ àr.   r   c                   óÎ   — e Zd ZdZ ed¬«      ddeddfd„«       Zd	efd
„Zdd„Z	d	e
fd„Zd	e
fd„Zd„ Zdd„Zd	ed    fd„Zd„ Zd	efd„Z ed¬«      d„ «       Zd„ Zedd„«       Zy)r   a�  
    ``Proxy`` objects are ``Node`` wrappers that flow through the
    program during symbolic tracing and record all the operations
    (``torch`` function calls, method calls, operators) that they touch
    into the growing FX Graph.

    If you're doing graph transforms, you can wrap your own ``Proxy``
    method around a raw ``Node`` so that you can use the overloaded
    operators to add additional things to a ``Graph``.

    ``Proxy`` objects cannot be iterated. In other words, the symbolic
    tracer will throw an error if a ``Proxy`` is used in a loop or as
    an ``*args``/``**kwargs`` function argument.

    There are two main ways around this:
    1. Factor out the untraceable logic into a top-level function and
    use ``fx.wrap`` on it.
    2. If the control flow is static (i.e. the loop trip count is
    based on some hyperparameter), the code can be kept in its original
    position and refactored into something like::

        for i in range(self.some_hyperparameter):
            indexed_item = proxied_value[i]

    For a more detailed description into the Proxy internals, check out
    the "Proxy" section in `torch/fx/README.md`
    Tr"   Nrs   ÚtracerúOptional[TracerBase]c                 óN   — |€t        |j                  «      }|| _        || _        y r(   )r   rQ   rÃ   rs   )r+   rs   rÃ   s      r-   r*   zProxy.__init__À  s#   € àˆ>ä)¨$¯*©*Ó5ˆFØˆŒØˆ�	r.   r_   c                 ó6   — d| j                   j                  › d�S )NzProxy(ú)©rs   r]   r>   s    r-   Ú__repr__zProxy.__repr__È  s   € Ø˜Ÿ	™	Ÿ™Ð' qÐ)Ð)r.   c                 ó   — t        | |«      S r(   r¶   )r+   Úks     r-   Ú__getattr__zProxy.__getattr__Ë  s   € ô ˜˜qÓ!Ð!r.   c                 ó   — | j                   S r(   ©Ú__dict__r>   s    r-   Ú__getstate__zProxy.__getstate__Ð  s   € Ø�}‰}Ðr.   c                 óª  — dd l }i }| j                  j                  «       D ]  \  }}	  |j                  ||«      }|||<   Œ  d|v sJ ‚d|v sJ ‚t        |d   |d   «      }|j                  «       D ]  \  }}||j                  |<   Œ |S # t        $ r@ t
        j                  d|| j                  j                  «        |j                   |«      }Y Œ–w xY w)Nr   zVShallow copy %s of Proxy because it cannot be deepcopied. Proxy is created for node %srs   rÃ   )
r:   rÏ   ÚitemsÚdeepcopyÚ	Exceptionrq   Úwarningrs   r]   r   )r+   Úmemor:   Únew_dictrË   ÚvÚnew_objÚ	new_proxys           r-   Ú__deepcopy__zProxy.__deepcopy__Ó  só   € ó 	àˆØ—M‘M×'Ñ'Ó)ò 	"‰DˆAˆqð	'Ø'˜$Ÿ-™-¨¨4Ó0�ð "ˆH�QŠKð	"ð ˜Ñ!Ð!Ð!Ø˜8Ñ#Ð#Ð#Ü˜( 6Ñ*¨H°XÑ,>Ó?ˆ	Ø—N‘NÓ$ò 	&‰DˆAˆqØ$%ˆI×Ñ˜qÒ!ð	&àÐøô ò 'Ü—‘ð3àØ—I‘I—N‘Nô	ð $˜$Ÿ)™) A›,’ð'ús   ¨B	Â	ACÃCc                 ó   — || _         y r(   rÎ   )r+   Úds     r-   Ú__setstate__zProxy.__setstate__í  s	   € àˆ�r.   c                 óF   — | j                   j                  dd| f|z   |«      S )NÚcall_methodÚ__call__)rÃ   r…   ©r+   rA   r\   s      r-   rá   zProxy.__call__ñ  s(   € Ø�{‰{×'Ñ'Ø˜:¨ w°¡~°vó
ð 	
r.   c                 ó¼  ‡ — t        j                  «       }|€J ‚|j                  }|€J ‚t        t	        j
                  |j                  «      «      }t        j                  dk\  rddl	m
}  |||j                  d„ ¬«      }n|j                  dz  }||   }|j                  dk(  rˆ fd„t        |j                  «      D «       S ‰ j                  j!                  ‰ «      S )	N©é   é   r   ©Úbisect_leftc                 ó   — | j                   S r(   ©Úoffsetr¾   s    r-   ú<lambda>z Proxy.__iter__.<locals>.<lambda>   s
   € ÀÇÁ€ r.   ©Úkeyé   ÚUNPACK_SEQUENCEc              3   ó(   •K  — | ]	  }‰|   –— Œ y ­wr(   r™   )r‹   Úir+   s     €r-   rŽ   z!Proxy.__iter__.<locals>.<genexpr>  s   øè ø€ Ò8 �D˜•GÑ8ùs   ƒ)r�   r�   r‘   r�   ÚdisÚget_instructionsrˆ   ÚsysÚversion_infoÚbisectrè   Úf_lastiÚopnamer£   ÚargvalrÃ   r³   )r+   r�   Úcalling_frameÚ	inst_listrè   Úinst_idxÚinsts   `      r-   Ú__iter__zProxy.__iter__ö  sÈ   ø€ Ü×$Ñ$Ó&ˆØÐ Ð Ð ØŸ™ˆØÐ(Ð(Ð(Üœ×-Ñ-¨m×.BÑ.BÓCÓDˆ	Ü×Ñ˜wÒ&Ý*á"Ø˜=×0Ñ0Ñ6Hô‰Hð %×,Ñ,°Ñ1ˆHØ˜Ñ"ˆØ�;‰;Ð+Ò+Û8¤U¨4¯;©;Ó%7Ô8Ð8à�{‰{×Ñ Ó%Ð%r.   c                 ó\   — | j                   j                  dt        j                  | fi «      S ©Nra   )rÃ   r…   ÚoperatorÚabsr>   s    r-   Ú__abs__zProxy.__abs__
  s$   € Ø�{‰{×'Ñ'¨¼¿¹ÈÀwÐPRÓSÐSr.   c                 óÎ  — | j                   j                  �r4t        j                  «       }|€J ‚|j                  }|€J ‚t        t        j                  |j                  «      «      }t        j                  dk\  rddlm}  |||j                  d„ ¬«      }n|j                  dz  }||   }|j                  dk(  r‘||dz      }|j                  €J ‚||j                  dz  dz
     }|j                  d	k(  xr |j                   d
k(  xs |j                  dk(  }	|	r3|j                  dk(  r$| j                   j#                  dt$        | fi «       y| j                   j'                  | «      S )Nrä   r   rç   c                 ó   — | j                   S r(   rê   r¾   s    r-   rì   z Proxy.__bool__.<locals>.<lambda>  s
   € ÈaÏhÉh€ r.   rí   rï   ÚPOP_JUMP_IF_TRUEr   ÚLOAD_GLOBALÚAssertionErrorÚLOAD_ASSERTION_ERRORÚRAISE_VARARGSra   T)rÃ   rT   r�   r�   r‘   r�   ró   rô   rˆ   rõ   rö   r÷   rè   rø   rù   Úargrú   r…   rÀ   r±   )
r+   r�   rû   Úinstsrè   Úcurrþ   ÚfirstÚlastÚstarts_with_asserts
             r-   Ú__bool__zProxy.__bool__  sS  € Ø�;‰;×$Ó$ô ×(Ñ(Ó*ˆEØÐ$Ð$Ð$Ø!ŸL™LˆMØ Ð,Ð,Ð,Üœ×-Ñ-¨m×.BÑ.BÓCÓDˆEÜ×Ñ 7Ò*Ý.á! %¨×)>Ñ)>ÑDVÔW‘à#×+Ñ+¨qÑ0�Ø˜‘:ˆDà�{‰{Ð0Ò0Ø˜c A™g™�Ø—x‘xÐ+Ð+Ð+Ø˜TŸX™X¨™]¨QÑ.Ñ/�à—L‘L MÑ1ò 9ØŸ™Ð(8Ñ8ò>à—|‘|Ð'=Ñ=ð #ñ
 &¨$¯+©+¸Ò*HØ—K‘K×,Ñ,¨_¼iÈ$ÈÐRTÔUØà�{‰{×"Ñ" 4Ó(Ð(r.   c                 ó8   — | j                   j                  | «      S r(   )rÃ   rµ   r>   s    r-   rµ   z
Proxy.keys-  s   € à�{‰{×Ñ Ó%Ð%r.   c                 ó   — t        d«      ‚)Nz�'len' is not supported in symbolic tracing by default. If you want this call to be recorded, please call torch.fx.wrap('len') at module scope©ÚRuntimeErrorr>   s    r-   Ú__len__zProxy.__len__1  s   € Üðó
ð 	
r.   c           	      óü  ‡ ‡— |r|nd}|r|ni }i Šˆ ˆfd„}t        ||«       t        ||«       t        ‰«      dkD  r(t        dt        ‰j	                  «       «      › d|› �«      ‚t        t        ‰j	                  «       «      «      }t        |t        j                  j                  «      r.|j                  f|z   }|j                  d|j                  ||«      S t        j                  j                  |«      r|j                  d|j                   ||«      S t        |t        j"                  j$                  «      rt        d«      ‚|j                  d||||j&                  j)                  |j                   «      ¬	«      S )
Nr™   c                 ó>   •— t        | ‰«      rd ‰| j                  <   y y r(   )r}   rÃ   )r•   ÚclsÚtracerss    €€r-   Úfind_tracerz-Proxy.__torch_function__.<locals>.find_tracer?  s    ø€ Ü˜!˜SÔ!Ø$(�˜Ÿ™Ò!ð "r.   r   z!Found multiple different tracers z" while trying to trace operations rà   z1Unable to symbolically trace HigherOrderOperatorsra   ©r]   )Úmap_aggregateÚlenr  r�   rµ   Únextr³   r}   rn   Ú_CÚScriptMethodÚownerr…   r]   Ú	overridesÚis_tensor_method_or_propertyr/   r¤   r¦   rQ   Ú_target_to_str)r  Úorig_methodÚtypesrA   r\   r  rÃ   r  s   `      @r-   Ú__torch_function__zProxy.__torch_function__8  s^  ù€ á‰t ˆÙ!‘ rˆà#%ˆõ	)ô 	�d˜KÔ(Ü�f˜kÔ*äˆw‹<˜!ÒÜØ3´D¸¿¹»Ó4HÐ3Ið J.Ø.9¨]ð<óð ô ”d˜7Ÿ<™<›>Ó*Ó+ˆä�k¤5§8¡8×#8Ñ#8Ô9Ø×%Ñ%Ð'¨$Ñ.ˆDØ×&Ñ& }°k×6FÑ6FÈÈfÓUÐUÜ�?‰?×7Ñ7¸ÔDØ×&Ñ&Ø˜{×3Ñ3°T¸6óð ô ˜+¤u§z¡z×'EÑ'EÔFä"Ð#VÓWÐWØ×&Ñ&ØØØØØ—\‘\×0Ñ0°×1EÑ1EÓFð 'ó ð r.   r(   )r_   r   )r_   r   r·   )r/   r0   r1   r2   r   r   r*   r3   rÉ   rÌ   r   rÐ   rÛ   rÞ   rá   r   rÿ   r  r¹   r  rµ   r  Úclassmethodr)  r™   r.   r-   r   r   ¢  s¸   „ ññ8 ¨$Ô/ñ˜Tð Ð+Aò ó 0ðð*˜#ó *ó"ð
˜dó ð Dó ò4ó
ð
&˜( 7Ñ+ó &ò(Tð)˜$ó )ñ@ ¨$Ô/ñ&ó 0ð&ò
ð ò%ó ñ%r.   r   c                   óR   ‡ — e Zd ZdZ	 d	deddfˆ fd„Zdefd„Zed	ˆ fd„	«       Z	ˆ xZ
S )
r   zW
    A Proxy subclass that propagates metadata (meta['val']) during graph tracing.
    rs   rÃ   rÄ   c                 ó4   •— t         ‰| �  ||«       || _        y r(   )r)   r*   Ú	fake_mode)r+   rs   rÃ   r-  r,   s       €r-   r*   zMetaProxy.__init__g  s   ø€ ô 	‰Ñ˜˜vÔ&Ø"ˆ�r.   r_   c                 ó6   — d| j                   j                  › d�S )Nz
MetaProxy(rÇ   rÈ   r>   s    r-   rÉ   zMetaProxy.__repr__m  s   € Ø˜DŸI™IŸN™NÐ+¨1Ð-Ð-r.   c           
      óÚ  •— |r|nd}|r|ni }d }|D ]  }t        |t        «      sŒ|} n |€J d«       ‚t        ‰	| �  ||||«      }|j                  5   ||D �cg c]-  }t        |t
        «      r|j                  j                  d   n|‘Œ/ c}i |¤Ž|j                  j                  d<   d d d «       t        |j                  |j                  |j                  «      S c c}w # 1 sw Y   Œ9xY w)Nr™   z5No MetaProxy found in arguments, but one is expected.Úval)	r}   r   r)   r)  r-  r   rs   rm   rÃ   )
r  r'  r(  rA   r\   Ú
meta_proxyr  rx   r•   r,   s
            €r-   r)  zMetaProxy.__torch_function__p  s÷   ø€ á‰t ˆÙ!‘ rˆàˆ
Øò 	ˆCÜ˜#œyÕ)Ø �
Ùð	ð Ð"ð	CàBó	CØ"ô ‘Ñ*¨;¸¸tÀVÓLˆØ×!Ñ!ñ 	Ù%0ØMQÖRÈ¬
°1´eÔ(<�!—&‘&—+‘+˜eÒ$À!ÑCÒRð&àñ&ˆE�J‰J�O‰O˜EÑ"÷	ô
 ˜Ÿ™ U§\¡\°:×3GÑ3GÓHÐHùò S÷	ð 	ús   ÁC!Á2C
ÂC!ÃC!Ã!C*r·   )r/   r0   r1   r2   r   r*   r3   rÉ   r*  r)  r4   r5   s   @r-   r   r   a  sF   ø„ ñð
 LPñ#Øð#Ø"8õ#ð.˜#ó .ð ôIó ôIr.   r   c                   óJ   — e Zd Z ed¬«      dedefd„«       Zed„ «       Zd„ Z	y)	r   Tr"   ÚrootÚattrc                 óP   — || _         || _        |j                  | _        d | _        y r(   )r3  r4  rÃ   Ú_node)r+   r3  r4  s      r-   r*   zAttribute.__init__Š  s"   € àˆŒ	ØˆŒ	Ø—k‘kˆŒØ%)ˆ�
r.   c                 óÀ   — | j                   €G| j                  j                  dt        | j                  | j
                  fi «      j                  | _         | j                   S r  )r6  rÃ   r…   r§   r3  r4  rs   r>   s    r-   rs   zAttribute.node‘  sN   € ð �:‰:ÐØŸ™×1Ñ1Ø¤¨4¯9©9°d·i±iÐ*@À"óç‰dð ŒJð �z‰zÐr.   c                 ón   — | j                   j                  d| j                  | j                  f|z   |«      S )Nrà   )rÃ   r…   r4  r3  râ   s      r-   rá   zAttribute.__call__›  s1   € Ø�{‰{×'Ñ'Ø˜4Ÿ9™9 t§y¡y l°TÑ&9¸6ó
ð 	
r.   N)
r/   r0   r1   r   r   r3   r*   Úpropertyrs   rá   r™   r.   r-   r   r   ˆ  s@   „ á¨$Ô/ð*˜Uð *¨#ò *ó 0ð*ð ñó ðó
r.   r   c                   óp   ‡ — e Zd ZdZdedefˆ fd„Zdefd„Ze	d„ «       Z
d„ Zd	„ Ze	d
„ «       Zd„ Zd„ Zˆ xZS )r   zö
    A special proxy which lets "shape", "size", "dim", and a few other
    attribute accesses pass through to the underlying  module parameter object,
    so that conditional tests on these attributes will not throw exception during tracing
    rÃ   rs   c                 óŽ   •— t         ‰| �  ||«       t        |t        j                  j
                  «      sJ ‚|| _        || _        y r(   )r)   r*   r}   rn   ÚnnÚ	ParameterÚparamr]   )r+   rÃ   rs   r]   r>  r,   s        €r-   r*   zParameterProxy.__init__©  s:   ø€ Ü‰Ñ˜˜vÔ&Ü˜%¤§¡×!3Ñ!3Ô4Ð4Ð4ØˆŒ
Øˆ�	r.   r_   c                 ó"   — d| j                   › d�S )NzParameterProxy(rÇ   r  r>   s    r-   rÉ   zParameterProxy.__repr__¯  s   € Ø  §¡ ¨1Ð-Ð-r.   c                 ó.   — | j                   j                  S r(   )r>  Úshaper>   s    r-   rA  zParameterProxy.shape²  s   € à�z‰z×ÑÐr.   c                 ó6   — | j                   j                  «       S r(   )r>  Úsizer>   s    r-   rC  zParameterProxy.size¶  s   € Ø�z‰z�‰Ó Ð r.   c                 ó6   — | j                   j                  «       S r(   )r>  Údimr>   s    r-   rE  zParameterProxy.dim¹  s   € Ø�z‰z�~‰~ÓÐr.   c                 ó.   — | j                   j                  S r(   )r>  Úndimr>   s    r-   rG  zParameterProxy.ndim¼  s   € à�z‰z�‰Ðr.   c                 ó6   — | j                   j                  «       S r(   )r>  Únumelr>   s    r-   rI  zParameterProxy.numelÀ  s   € Ø�z‰z×ÑÓ!Ð!r.   c                 ó6   — | j                   j                  «       S r(   )r>  Únelementr>   s    r-   rK  zParameterProxy.nelementÃ  s   € Ø�z‰z×"Ñ"Ó$Ð$r.   )r/   r0   r1   r2   r   r   r*   r3   rÉ   r9  rA  rC  rE  rG  rI  rK  r4   r5   s   @r-   r   r   ¡  sc   ø„ ñð˜zð °õ ð.˜#ó .ð ñ ó ð ò!ò ð ñó ðò"ö%r.   r   c                 ój   ‡ — ˆ fd„}‰ |_         d‰ j                  d«      › d�}t        t        ||«       y )Nc                  ój   •— | d   j                   }t        t        ‰«      }|j                  d|| |«      S )Nr   ra   )rÃ   r§   r  r…   )rA   r\   rÃ   r[   Úmethods       €r-   Úimplz_scope.<locals>.implÊ  s3   ø€ Ø˜!‘W—^‘^ˆFÜœX vÓ.ˆFØ×&Ñ& ¸ÀÀfÓMÐMr.   Ú__Ú_)r/   ÚstripÚsetattrr   )rN  rO  Úas_magics   `  r-   r<   r<   É  s6   ø€ ô	Nð
 ˆŒØ˜Ÿ™ SÓ)Ð*¨"Ð-ˆÜ”�x Õ&r.   c                 óx   ‡ — d‰ j                  d«      › d�}ˆ fd„}||_        ||_        t        t        ||«       y )NÚ__rrQ  rP  c                 ód   •— t        t        ‰«      }| j                  j                  d||| fi «      S r  )r§   r  rÃ   r…   )r+   Úrhsr[   Úorig_method_names      €r-   rO  z!_define_reflectable.<locals>.implÙ  s/   ø€ ÜœÐ#3Ó4ˆØ�{‰{×'Ñ'¨¸À#ÀtÀÈbÓQÐQr.   )rR  r/   r1   rS  r   )rY  Úmethod_namerO  s   `  r-   Ú_define_reflectabler[  Ö  sA   ø€ ØÐ(×.Ñ.¨sÓ3Ð4°BÐ7€KôRð  €D„MØ#€DÔÜŒE�; Õ%r.   c                 ó   — t        d| › �«      ‚)NzJKeys for dictionaries used as an argument cannot contain a Node. Got key: r  )r  s    r-   Ú_no_nodes_errorr]  æ  s   € Ü
ð	Ø˜ð	 óð r.   c                 óÄ   — i }|j                  «       D ]J  \  }}t        |t        «      s!| j                  |«      }t	        |t
        «       | j                  |«      ||<   ŒL |S r(   )rÒ   r}   r3   r|   Úmap_argr]  )r+   r•   ÚrrË   rØ   s        r-   rž   rž   í  s]   € Ø
€AØ—‘“	ò "‰ˆˆ1Ü˜!œSÔ!ð —‘ Ó"ˆAÜ�A”Ô'Ø�‰˜qÓ!ˆˆ!Šð"ð €Hr.   .c                 ó   — |S r(   r™   ©r+   r•   s     r-   rì   rì   û  s   € �q€ r.   c                 ó   — |j                   S r(   )rs   rb  s     r-   rì   rì     s
   € ¨A¯F©F€ r.   c                 ó\   — t        |D �cg c]  }| j                  |«      ‘Œ c}«      S c c}w r(   )r~   r|   ©r+   r•   r¬   s      r-   rì   rì     s#   € ¬EÐUVÖ2WÈT°4·?±?À4Õ3HÒ2WÓ,X€ ùÒ2Ws   Š)c                 óJ   — |D �cg c]  }| j                  |«      ‘Œ c}S c c}w r(   )r|   re  s      r-   rì   rì     s   € ÈaÖ+PÀd¨D¯O©O¸DÕ,AÒ+P€ ùÒ+Ps   … )Lr¼   r:   ró   r¨   r�   Úloggingr  rõ   r   Úcollections.abcr   Údataclassesr   r   Útypingr   r   r	   rn   Útorch.fx.tracebackÚfxÚ	tracebackrh   Útorch._Cr
   r  r   r_  Útorch.utils._tracebackr   Ú_compatibilityr   rQ   r   r   r   Úimmutable_collectionsr   r   rs   r   r   r   r   Úoperator_schemasr   Ú__all__Ú	getLoggerr/   rq   r    r!   rl   r   r   rÀ   Ú
ValueErrorr   r   r   r   r   rN  r<   r[  rY  r]  rž   r›   r¤   r¥   r¦   rš   r~   r�   r   )Úts   0r-   ú<module>rw     sº  ðó Û Û 
Û Û Û Û Û 
Ý #Ý $ß ,ß *Ñ *ã ß )Ð )ß OÝ 4å )ß BÑ Bß Aß 4Ó 4Ý 9ò
€ð €g×Ñ˜Ó!€ñ  eÔ,÷'ð 'ó -ð'ñ>  eÔ,÷ð ó -ðò:Ð ñ"  dÔ+÷N(ð N(ó ,ðN(ñd  dÔ+ô%˜:ó %ó ,ð%ñ  eÔ,ñó -ðñ  dÔ+ô	�ó 	ó ,ð	ñ  dÔ+÷{ð {ó ,ð{ñ|  eÔ,ô#I�ó #Ió -ð#IñL  dÔ+ô
�ó 
ó ,ð
ñ0  eÔ,ô"%�Uó "%ó -ð"%ðJ ò €Fò'ñ ˆ6…Nðò	&ð 2ò *ÐÙÐ(Õ)ð*òò
ðØ	ðáˆT‹
ðñ 	ˆS‹	ðð 	�
‰
×Ñð	ð
 	�
‰
×&Ñ&ðö	à	ð ÑÑò	Ð ñ 3Ð �5Ñ ÙXÐ �5Ñ ÙPÐ �4Ñ Ø+Ð �4Ñ Ø%7¸Ñ%=Ð �>Ñ "Ø%7¸Ñ%=Ð �>Ò "ùò	s   Ç$H