Ë
    ùÿæi/
 ã                   ó*  — U d 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Zddl	m
Z
mZmZmZ ddlmZmZmZ ddlmZm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 dd	lmZ dd
l m!Z!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9m:Z:m;Z; ddl<m=Z=m>Z> ddl?m@Z@ ddlAmBZB  ed«      ZC e%«       aDe"ejŠ                  jŒ                  _G        e!ejŠ                  j�                  _G        ejŠ                  j�                  ZHdeH_         deH_I        deH_J         e@eHd«       d„ ZKeKeH_L        e-r ejš                  dddg«      ZNnd„ ZNdeN_         d „ ZOd!„ ZPd"„ ZQ G d#„ d$«      ZR G d%„ d&eR«      ZS G d'„ d(eT«      ZU G d)„ d*«      ZV G d+„ d,eW«      ZXd-„ ZY G d.„ d/«      ZZd0e>d1e[d2ej¸                  jn                  fd3„Z]e-�rg d4¢Z^ G d5„ d6«      Z_e^D ]  Z`d7„ Za ebe_e`ea«       Œ  G d8„ d9e7eU¬:«      Zc G d;„ d<ec«      ZdedjÊ                  jÍ                  «       D ]<  \  ZgZh eieh«      s
 ejehek«      sŒegjÙ                  d=«      s	 emeceg«      rŒ3 ebecegeh«       Œ> d>„ Znh d?£Zod@„ Zp enej¸                  jn                  «      D ]V  \  ZgZqegjÙ                  d=«      segjå                  dA«      rŒ)egedjÊ                  vsŒ8egeovsŒ= ebedeqj’                   epeg«      «       ŒX n4 G dB„ d6«      Z_ G dC„ d9ej¸                  jn                  «      Zc G dD„ d<ec«      ZddE„ ZsdF„ ZtdG„ ZudgdH„ZvdIawexeydJ<   	 	 	 	 dhdKeeze{   e|e
eze{   f   df   fdL„Z}	 	 	 	 dhdMedNddOe~dPe
e[gef   dz  dKeeze{   e|e
eze{   f   df   d2efdQ„ZdR„ Z€dS„ Z�dT„ Z‚dU„ ZƒdMeCd2eCfdV„Z„dW„ Z…ejŠ                  �j                  Z† e@e†d«       didXe[dYe~dZe~d[e[fd\„Z‡ G d]„ d^«      Zˆ G d_„ d`«      Z‰ G da„ db«      ZŠdc„ Z‹ ee‹dd«        ee�j                  de«        ee9df«        ee:df«        ee;df«       y)jzàTorchScript.

This module contains functionality to support the JIT's scripting frontend, notably:
    - torch.jit.script

This is not intended to be imported directly; please use the exposed
functionalities in `torch.jit`.
é    N)ÚCallableÚIteratorÚMappingÚSequence)ÚAnyÚTypeVarÚUnion)Ú
deprecatedÚSelf)Úclasses)Ú_get_model_idÚ_qualified_name)Úlog_torchscript_usage)Ú_register_builtin)Ú
_graph_forÚ_script_method_graph_for)ÚJitTypeTraceConfigÚJitTypeTraceStoreÚmonkeytype_trace)Ú_compile_and_register_classÚinfer_methods_to_compileÚScriptMethodStubÚwrap_cpp_module)Ú_enabledÚ_set_jit_function_cacheÚ_set_jit_overload_cacheÚ_try_get_jit_cached_functionÚ_try_get_jit_cached_overloads)Úget_default_argsÚget_jit_class_defÚget_jit_def)ÚModule)Úhas_torch_functionÚhas_torch_function_unaryÚhas_torch_function_variadic)ÚPackageExporterÚPackageImporter)Ú
set_moduleé   )Úvalidate_map_locationÚ_Tz†
Functionally equivalent to a :class:`ScriptModule`, but represents a single
function and does not have any attributes or Parameters.
ÚScriptFunctionútorch.jit.ScriptFunctionz	torch.jitc                 ó,   — t        j                  d«      ‚)Nz ScriptFunction cannot be pickled©ÚpickleÚPickleError©Úclss    úf/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/torch/jit/_script.pyÚ_reducer5   O   s   € Ü
×
Ñ
Ð?Ó
@Ð@ó    Ú	AttributeÚvalueÚtypec                 ó   — | S ©N© )r8   r9   s     r4   r7   r7   Z   s   € Øˆr6   a¨  
    This method is a pass-through function that returns `value`, mostly
    used to indicate to the TorchScript compiler that the left-hand side
    expression is a class instance attribute with type of `type`. Note that
    `torch.jit.Attribute` should only be used in `__init__` method of `jit.ScriptModule`
    subclasses.

    Though TorchScript can infer correct type for most Python expressions, there are some cases where
    type inference can be wrong, including:

    - Empty containers like `[]` and `{}`, which TorchScript assumes to be container of `Tensor`
    - Optional types like `Optional[T]` but assigned a valid value of type `T`, TorchScript would assume
      it is type `T` rather than `Optional[T]`

    In eager mode, it is simply a pass-through function that returns `value`
    without other implications.

    Example:

    .. testcode::

        import torch
        from typing import Dict

        class AttributeModule(torch.jit.ScriptModule):
            def __init__(self) -> None:
                super().__init__()
                self.foo = torch.jit.Attribute(0.1, float)

                # we should be able to use self.foo as a float here
                assert 0.0 < self.foo

                self.names_ages = torch.jit.Attribute({}, Dict[str, int])
                self.names_ages["someone"] = 20
                assert isinstance(self.names_ages["someone"], int)

        m = AttributeModule()
        # m will contain two attributes
        # 1. foo of type float
        # 2. names_ages of type Dict[str, int]

    .. testcleanup::

        del AttributeModule
        del m

    Note: it's now preferred to instead use type annotations instead of `torch.jit.Attribute`:

    .. testcode::

        import torch
        from typing import Dict

        class AttributeModule(torch.nn.Module):
            names: Dict[str, int]

            def __init__(self) -> None:
                super().__init__()
                self.names = {}

        m = AttributeModule()

    .. testcleanup::

        del AttributeModule
        del m

    Args:
        value: An initial value to be assigned to attribute.
        type: A Python type

    Returns:
        Returns `value`
c                  ó   — t         S r;   )Útype_trace_dbr<   r6   r4   Ú_get_type_trace_dbr?   ª   s   € äÐr6   c                 ó   — t        | |d «      S r;   )Úgetattr)r3   Únames     r4   Ú_get_function_from_typerC   °   s   € Ü�3˜˜dÓ#Ð#r6   c                 óR   — t        | d«      rdt        | «      v xs t        | d«      S y )NÚ	__class__Ú__dict__Ú	__slots__)ÚhasattrÚdirr2   s    r4   Ú_is_new_style_classrJ   ¶   s,   € Üˆs�KÔ ØœS ›XÐ%ÒB¬°°kÓ)BÐBð !r6   c                   óB   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zy
)ÚOrderedDictWrapperc                 ó   — || _         y r;   )Ú_c)ÚselfrN   s     r4   Ú__init__zOrderedDictWrapper.__init__Ë   s	   € Øˆ�r6   c                 óT   — | j                  «       D ��cg c]  \  }}|‘Œ	 c}}S c c}}w r;   ©Úitems©rO   ÚkÚvs      r4   ÚkeyszOrderedDictWrapper.keysÎ   ó$   € Ø"Ÿj™jœlÔ+™l‘d�a˜’˜lÒ+Ð+ùÓ+ó   ”$c                 óT   — | j                  «       D ��cg c]  \  }}|‘Œ	 c}}S c c}}w r;   rR   rT   s      r4   ÚvalueszOrderedDictWrapper.valuesÑ   rX   rY   c                 ó4   — t        | j                  «       «      S r;   )Úlenr[   ©rO   s    r4   Ú__len__zOrderedDictWrapper.__len__Ô   s   € Ü�4—;‘;“=Ó!Ð!r6   c                 ó   — t        d«      ‚)Nz6cannot delete methods or parameters of a script module©ÚRuntimeError©rO   rU   s     r4   Ú__delitem__zOrderedDictWrapper.__delitem__×   s   € ÜÐSÓTÐTr6   c                 ó6   — | j                   j                  «       S r;   )rN   rS   r^   s    r4   rS   zOrderedDictWrapper.itemsÚ   s   € Ø�w‰w�}‰}‹Ðr6   c                 ó`   — || vrt        d|› �«      ‚| j                  j                  ||«       y )NzICan't add a new parameter after ScriptModule construction. Tried to add ')rb   rN   ÚsetattrrT   s      r4   Ú__setitem__zOrderedDictWrapper.__setitem__Ý   s6   € Ø�D‰=ÜØ[Ð\]Ð[^Ð_óð ð 	�‰�‰˜˜1Õr6   c                 ó8   — | j                   j                  |«      S r;   )rN   Úcontainsrc   s     r4   Ú__contains__zOrderedDictWrapper.__contains__ä   s   € Ø�w‰w×Ñ Ó"Ð"r6   c                 óV   — || vrt        |«      ‚| j                  j                  |«      S r;   )ÚKeyErrorrN   rA   rc   s     r4   Ú__getitem__zOrderedDictWrapper.__getitem__ç   s&   € Ø�D‰=Ü˜1“+ÐØ�w‰w�‰˜qÓ!Ð!r6   N)Ú__name__Ú
__module__Ú__qualname__rP   rW   r[   r_   rd   rS   rh   rk   rn   r<   r6   r4   rL   rL   Ê   s0   „ òò,ò,ò"òUòòò#ó"r6   rL   c                   ó6   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zˆ xZS )ÚOrderedModuleDictc                 ól   •— t         ‰| �  t        j                  j	                  |«      «       || _        y r;   )ÚsuperrP   ÚtorchÚ_CÚ
ModuleDictÚ_python_modules)rO   ÚmoduleÚpython_dictrE   s      €r4   rP   zOrderedModuleDict.__init__î   s)   ø€ Ü‰ÑœŸ™×,Ñ,¨VÓ4Ô5ð  +ˆÕr6   c                 ó:   — | j                   j                  «       }|S r;   )ry   rS   ©rO   Úrs     r4   rS   zOrderedModuleDict.itemsø   s   € Ø× Ñ ×&Ñ&Ó(ˆØˆr6   c                 ó   — || j                   v S r;   ©ry   rc   s     r4   rk   zOrderedModuleDict.__contains__ü   s   € Ø�D×(Ñ(Ð(Ð(r6   c                 óœ   — t        |t        «      r,| j                  j                  ||«       || j                  |<   y t        d|› d|› �«      ‚)NzgCannot re-assign modules in a ScriptModule with non-scripted module, tried to replace existing module 'z': )Ú
isinstanceÚScriptModulerN   rg   ry   rb   rT   s      r4   rh   zOrderedModuleDict.__setitem__ÿ   sS   € ô �aœÔ&Ø�G‰G�O‰O˜A˜qÔ!Ø&'ˆD× Ñ  Ò#äð=Ø=>¸C¸sÀ1À#ðGóð r6   c                 ó    — | j                   |   S r;   r€   rc   s     r4   rn   zOrderedModuleDict.__getitem__  s   € Ø×#Ñ# AÑ&Ð&r6   )	ro   rp   rq   rP   rS   rk   rh   rn   Ú__classcell__©rE   s   @r4   rs   rs   í   s   ø„ ô+òò)òö&'r6   rs   c                   ó   ‡ — e Zd Zˆ fd„Zˆ xZS )Ú
ScriptMetac                 óÄ  •‡ ‡	— i ‰ _         t        t        ‰ dd«      «      ‰ _        t	        |«      D ]i  }t        |di «      j                  «       D ]  \  }}|‰ j                   |<   Œ t        |dt        «       «      }‰ j                  j                  |«      ‰ _        Œk t        |j                  «       «      D ]E  \  }}t        |t        «      sŒt        ‰ |«       |‰ j                   |j                  j                  <   ŒG t        ‰ dd«      rt        ‰
‰ �9  |||«       y t        ‰ dd„ «      Š	t        j                   ‰	«      ˆ ˆ	fd	„«       }|‰ _        t        ‰
‰ �9  |||«       y )
NÚ__constants__r<   Ú_methodsÚ_constants_setÚ_disable_script_metaFrP   c                  ó   — y r;   r<   r^   s    r4   Ú<lambda>z%ScriptMeta.__init__.<locals>.<lambda>6  s   € ¸dr6   c                 óê  •— t        ‰	j                  «      } ‰
| g|¢­i |¤Ž t        ‰	j                  «      |kD  }t        | «      ‰	u r¬d„ }t        j                  j
                  j                  | || ¬«      | j                  d<   | j                  j                  }|j                  «       D ]  }t        | |«       Œ |j                  «       D ]  \  }}t        | |«       Œ dD ]  }t        | |«       Œ y y )Nc                 ó¾   — t        | «      }t        |d«      r6t        |j                  j	                  «       «      D ��cg c]  \  }}|‘Œ	 c}}S t        | «      S c c}}w )Nr‹   )r9   rH   Úsortedr‹   rS   r   )rz   r3   rU   rV   s       r4   Ú
make_stubszAScriptMeta.__init__.<locals>.init_then_script.<locals>.make_stubs@  sS   € Ü˜v›,�CÜ˜s JÔ/Ü.4°S·\±\×5GÑ5GÓ5IÔ.JÔKÑ.J¡d a¨¢Ð.JÒKÐKä7¸Ó?Ð?ùó  Ls   ¾A)Úshare_typesÚ_actual_script_module)Ú_parametersÚ_buffersÚ_modules)r]   r‹   r9   rv   ÚjitÚ
_recursiveÚcreate_script_modulerF   r•   Ú_concrete_typeÚget_attributesÚdelattrÚget_modules)rO   ÚargsÚkwargsÚnum_methodsÚadded_methods_in_initr“   Úconcrete_typerB   Ú_r3   Úoriginal_inits            €€r4   Úinit_then_scriptz-ScriptMeta.__init__.<locals>.init_then_script8  sí   ø€ ä˜cŸl™lÓ+ˆKÙ˜$Ð0 Ò0¨Ò0Ü$'¨¯©Ó$5¸Ñ$CÐ!ä�D‹z˜SÑ ò@ô —I‘I×(Ñ(×=Ñ=Ø˜jÐ:OÐ6Oð >ó ð —‘Ð5Ñ6ð !%× :Ñ :× IÑ I�Ø)×8Ñ8Ö:�DÜ˜D $Õ'ð ;à,×8Ñ8Ö:‘G�D˜!Ü˜D $Õ'ð  ;ãC�DÜ˜D $Õ'ñ Dð/ !r6   )r‹   ÚsetrA   rŒ   ÚreversedrS   Úunionr’   r‚   r   rž   Úoriginal_methodro   ru   rP   Ú	functoolsÚwraps)r3   rB   ÚbasesÚattrsÚbaserU   rV   Úbase_constantsr§   r¦   rE   s   `        @€r4   rP   zScriptMeta.__init__  s7  ú€ à')ˆŒÜ ¤¨¨o¸rÓ!BÓCˆÔÜ˜U–OˆDÜ  j°"Ó5×;Ñ;Ö=‘��1Ø"#�—‘˜Q’ð >ä")¨$Ð0@Ä#Ã%Ó"HˆNØ!$×!3Ñ!3×!9Ñ!9¸.Ó!IˆCÕð	 $ô ˜5Ÿ;™;›=Ö)‰DˆAˆqÜ˜!Ô-Õ.Ü˜˜Q”Ø;<�—‘˜Q×.Ñ.×7Ñ7Ò8ð *ô
 �3Ð.°Ô6ô ‰GÑ˜T 5¨%Ô0Øä  ZÑ1BÓCˆä	�‰˜Ó	'ô	(ó 
(ð	(ð> (ˆŒÜ‰Ñ˜˜u eÕ,r6   ©ro   rp   rq   rP   r…   r†   s   @r4   rˆ   rˆ     s   ø„ ÷:-ð :-r6   rˆ   c                   ó   — e Zd Zd„ Zy)Ú_CachedForwardc                 ó$   — | j                  d«      S )NÚforward)Ú__getattr__)rO   Úobjr3   s      r4   Ú__get__z_CachedForward.__get__]  s   € Ø×Ñ 	Ó*Ð*r6   N)ro   rp   rq   r¹   r<   r6   r4   r´   r´   \  s   „ ó+r6   r´   c                   ó   — e Zd Zy)ÚScriptWarningN©ro   rp   rq   r<   r6   r4   r»   r»   a  s   „ Ør6   r»   c                 ó  — t         j                  dk\  rt        j                  dt        «       nt        j                  dt        «       t
        s| S t        j                  d¬«      }t        | | j                  d¬«      }t        ||| «      S )N©é   é   z}`torch.jit.script_method` is not supported in Python 3.14+ and may break. Please switch to `torch.compile` or `torch.export`.z\`torch.jit.script_method` is deprecated. Please switch to `torch.compile` or `torch.export`.é   ©Ú	frames_uprƒ   )Ú	self_name)ÚsysÚversion_infoÚwarningsÚwarnÚDeprecationWarningr   Ú_jit_internalÚ!createResolutionCallbackFromFramer!   ro   r   )ÚfnÚ_rcbÚasts      r4   Úscript_methodrÏ   e  sv   € Ü
×Ñ˜7Ò"Ü�‰ðBäõ	
ô 	�‰ØjÜô	
õ Øˆ	ô ×:Ñ:ÀQÔG€DÜ
�b˜"Ÿ+™+°Ô
@€CÜ˜D # rÓ*Ð*r6   c                   ó6   — e Zd Zdeeef   ddfd„Zdedefd„Zy)ÚConstMapÚconst_mappingÚreturnNc                 ó   — || _         y r;   ©rÒ   )rO   rÒ   s     r4   rP   zConstMap.__init__…  s
   € Ø*ˆÕr6   Úattrc                 ó    — | j                   |   S r;   rÕ   )rO   rÖ   s     r4   r·   zConstMap.__getattr__ˆ  s   € Ø×!Ñ! $Ñ'Ð'r6   )ro   rp   rq   r   Ústrr   rP   r·   r<   r6   r4   rÑ   rÑ   „  s1   „ ð+ g¨c°3¨hÑ&7ð +¸Dó +ð( ð (¨ô (r6   rÑ   ÚimporterÚscript_module_idrÓ   c                 óZ  — t        | j                  t        j                  j                  «      st        d«      ‚t        j                  j                  «       }t        j                  j                  || j                  | j                  t        | j                  «      |«      }t        |«      S )zº
    Call by ``torch.package.PackageImporter``'s Pickler's ``persistent_load`` function.

    Performs work of loading and returning a ScriptModule from a ``torch.package`` archive.
    z{Loading ScriptObjects from a PackageImporter created from a directory is not supported. Use a package archive file instead.)r‚   Ú
zip_readerrv   rw   ÚPyTorchFileReaderrb   ÚCompilationUnitÚ_import_ir_module_from_packageÚstorage_contextr*   Úlast_map_locationr   )rÙ   rÚ   ÚcuÚ
cpp_modules       r4   Úunpackage_script_modulerä   Œ  sŒ   € ô �h×)Ñ)¬5¯8©8×+EÑ+EÔFÜðNó
ð 	
ô 
�‰×	!Ñ	!Ó	#€BÜ—‘×8Ñ8Ø
Ø×ÑØ× Ñ Ü˜h×8Ñ8Ó9Øó€Jô ˜:Ó&Ð&r6   )Ú__iter__r_   Ú__neg__Ú__mul__rk   Ú__add__Ú__sub__Ú__pow__Ú__truediv__Ú__mod__Ú__ne__Ú__eq__Ú__lt__Ú__gt__Ú__le__Ú__ge__Ú__and__Ú__or__Ú__xor__rn   rh   Ú__call__Ú__int__Ú	__float__Ú__bool__Ú__str__Ú	__enter__Ú__exit__c                   ó|   ‡ — e Zd ZdZˆ fd„Zdedefˆ fd„Zdededdfˆ fd„Zd	ed
ededefd„Z	d„ Z
dedefd„Zˆ xZS )ÚRecursiveScriptClassaX  Wrapper for a TorchScript class instance for use in Python.

        An analogue of RecursiveScriptModule for regular objects that are not modules.
        This class is a wrapper around a torch._C.ScriptObject that represents an instance
        of a TorchScript class and allows it to be used in Python.

        Attributes:
            _c [torch._C.ScriptObject]: The C++ object to which attribute lookups and method
                calls are forwarded.
            _props [Dict[str, property]]: A dictionary of properties fetched from self._c and
                exposed on this wrppaer.
        c                 ó"  •— t         ‰| �  «        d| j                  d<   || _        | j                  j	                  «       D �ci c]-  }|j
                  t        |j                  |j                  «      “Œ/ c}| _	        d| j                  d<   y c c}w )NTÚ_initializingF)
ru   rP   rF   rN   Ú_propertiesrB   ÚpropertyÚgetterÚsetterÚ_props)rO   Ú	cpp_classÚproprE   s      €r4   rP   zRecursiveScriptClass.__init__Ò  s~   ø€ Ü‰GÑÔØ-1ˆD�M‰M˜/Ñ*ØˆDŒGð
 !ŸG™G×/Ñ/Ô1óá1�Dð —	‘	œ8 D§K¡K°·±Ó=Ñ=Ø1ñˆDŒKð
 .3ˆD�M‰M˜/Ò*ùòs   Á2BrÖ   rÓ   c                 óÚ   •— | j                   j                  d«      rt        ‰| �  |«      S || j                  v r| j                  |   j                  «       S t        | j                  |«      S ©Nr   )rF   Úgetru   r·   r  ÚfgetrA   rN   ©rO   rÖ   rE   s     €r4   r·   z RecursiveScriptClass.__getattr__ß  sZ   ø€ Ø�}‰}× Ñ  Ô1Ü‘wÑ*¨4Ó0Ð0à�t—{‘{Ñ"Ø—{‘{ 4Ñ(×-Ñ-Ó/Ð/ä˜4Ÿ7™7 DÓ)Ð)r6   r8   Nc                 óâ   •— | j                   j                  d«      rt        ‰| �  ||«      S || j                  v r| j                  |   j                  |«      S t        | j                  ||«       y r	  )rF   r
  ru   Ú__setattr__r  Úfsetrg   rN   ©rO   rÖ   r8   rE   s      €r4   r  z RecursiveScriptClass.__setattr__è  s]   ø€ Ø�}‰}× Ñ  Ô1Ü‘wÑ*¨4°Ó7Ð7à�t—{‘{Ñ"Ø—{‘{ 4Ñ(×-Ñ-¨eÓ4Ð4ä�D—G‘G˜T 5Õ)r6   Úmethod_namer    r¡   c                 óv   — | j                   j                  |«      st        ‚| j                  |«      } ||i |¤ŽS r;   )rN   Ú_has_methodÚ	TypeErrorr·   ©rO   r  r    r¡   Úself_methods        r4   Úforward_magic_methodz)RecursiveScriptClass.forward_magic_methodó  s;   € ð —7‘7×&Ñ& {Ô3Ü�à×*Ñ*¨;Ó7ˆKÙ Ð/¨Ñ/Ð/r6   c                 ó,   — t        j                  d«      ‚)NzScriptClasses cannot be pickledr/   r^   s    r4   Ú__getstate__z!RecursiveScriptClass.__getstate__ü  s   € Ü×$Ñ$Ð%FÓGÐGr6   Úotherc                 ó€   — | j                   j                  d«      r| j                  d|«      S | j                  d|«      S )NÚ__iadd__rè   )rN   r  r  )rO   r  s     r4   r  zRecursiveScriptClass.__iadd__ÿ  s:   € Ø�w‰w×"Ñ" :Ô.Ø×0Ñ0°¸UÓCÐCà×0Ñ0°¸EÓBÐBr6   )ro   rp   rq   Ú__doc__rP   rØ   r   r·   r  r  r  r   r  r…   r†   s   @r4   rþ   rþ   Ä  s{   ø„ ñ	ô	3ð	* Cð 	*¨Cõ 	*ð	* Cð 	*°ð 	*¸õ 	*ð	0Ø"ð	0Ø+.ð	0Ø:=ð	0àó	0ò	Hð	C $ð 	C¨4÷ 	Cr6   rþ   c                 ó6   —  | j                   t        g|¢­i |¤ŽS r;   )r  r  ©rO   r    r¡   s      r4   Úmethod_templater     s   € Ø,�4×,Ñ,¬[ÐJ¸4ÒJÀ6ÑJÐJr6   c                   ó”   ‡ — e Zd ZU dZg d¢Zdˆ fd„Z e«       Zede	f   e
d<   dede	fˆ fd	„Zded
e	ddfˆ fd„Zd„ Zd„ Zdefd„Zˆ xZS )rƒ   a'  Wrapper for C++ torch::jit::Module with methods, attributes, and parameters.

        A wrapper around C++ ``torch::jit::Module``. ``ScriptModule``\s
        contain methods, attributes, parameters, and
        constants. These can be accessed the same way as on a normal ``nn.Module``.
        )ÚcodeÚcode_with_constantsÚgraphÚinlined_graphÚoriginal_namerÓ   Nc                 ó"   •— t         ‰| �  «        y r;   ©ru   rP   )rO   rE   s    €r4   rP   zScriptModule.__init__$  ó   ø€ Ü‰GÑÕr6   .r¶   rÖ   c                 ój   •— d| j                   vrt        ‰| �	  |«      S t        | j                  |«      S )Nr•   )rF   ru   r·   rA   r•   r  s     €r4   r·   zScriptModule.__getattr__)  s2   ø€ Ø&¨d¯m©mÑ;Ü‘wÑ*¨4Ó0Ð0Ü˜4×5Ñ5°tÓ<Ð<r6   r8   c                 ó,  •— d| j                   vrnt        |t        «      rNd| j                  j                   vri | j                  _        |j
                  | j                  |<   |j                  }t        ‰| �!  ||«      S t        | j                  ||«       y )Nr•   Ú__annotations__)rF   r‚   r7   rE   r,  r9   r8   ru   r  rg   r•   r  s      €r4   r  zScriptModule.__setattr__.  s|   ø€ Ø&¨d¯m©mÑ;ô ˜e¤YÔ/ð
 )°·±×0GÑ0GÑGØ9;˜Ÿ™Ô6Ø16·±�D×(Ñ(¨Ñ.Ø!ŸK™K�EÜ‘wÑ*¨4°Ó7Ð7ä�D×.Ñ.°°eÕ<r6   c                 ó$  — d| j                   v r| j                  j                  |«      S t        j                  d¬«      }t
        j                  j                  |«      }t        ||d «      | j                  |j                  «       j                  <   y )Nr•   r)   rÂ   )rF   r•   ÚdefinerÊ   rË   rv   rw   Ú_parse_source_defr   r‹   rB   )rO   ÚsrcÚrcbrÎ   s       r4   r.  zScriptModule.defineC  sn   € Ø&¨$¯-©-Ñ7ð ×1Ñ1×8Ñ8¸Ó=Ð=ô  ×AÑAÈAÔNˆCÜ—(‘(×,Ñ,¨SÓ1ˆCÜ-=¸cÀ3ÈÓ-MˆD�M‰M˜#Ÿ(™(›*Ÿ/™/Ò*r6   c                 ó6   — | j                   j                  «       S r;   )r•   Ú_replicate_for_data_parallelr^   s    r4   r3  z)ScriptModule._replicate_for_data_parallelY  s   € Ø×-Ñ-×JÑJÓLÐLr6   Úexporterc                 ó’   — |j                  «       }|j                  j                  | j                  t	        |«      «       t
        |ffS )a¸  Save a ScriptModule inside of a ``torch.package`` archive.

            Called by ``torch.package.PackageExporter``'s Pickler's ``persistent_id`` when
            saving TorchScript objects. Performs act of saving a ScriptModule inside of
            a ``torch.package`` archive.

            Returns method to load the ScriptModule from a ``torch.package.PackageImporter``'s
            Pickler's ``persistent_load`` function.
            )Úget_unique_idÚscript_module_serializerÚ	serializerN   Úinträ   )rO   r4  rÚ   s      r4   Ú__reduce_package__zScriptModule.__reduce_package__\  sB   € ð  (×5Ñ5Ó7ÐØ×-Ñ-×7Ñ7¸¿¹ÄÐEUÓAVÔWÜ+Ð.>Ð-@ÐAÐAr6   ©rÓ   N)ro   rp   rq   r  Ú__jit_unused_properties__rP   r´   r¶   r   r   r,  rØ   r·   r  r.  r3  r&   r:  r…   r†   s   @r4   rƒ   rƒ     st   ø… ñ	ò%
Ð!õ	ñ '5Ó&6ˆ�˜#˜s˜(Ñ#Ó6ð	= Cð 	=¨Cõ 	=ð
	= Cð 	=°ð 	=¸õ 	=ò*	Nò,	Mð	B¨÷ 	Br6   rƒ   )Ú	metaclassc                   óè  ‡ — e Zd ZdZdZˆ fd„Zed„ «       Zed„ «       Zd„ Z	e
d„ «       Ze
d„ «       Ze
d	„ «       Ze
d
„ «       Zd„ Z ed«      d„ «       Z ed«      d„ «       Zdededefd„Zdededefd„Zdefd„Zdededefd„Ze
d„ «       Zd„ Zdedefˆ fd„Zdededdfˆ fd„Zdefd„Zdee ef   dz  defd„Z!d edededefd!„Z"de#e   fd"„Z$d#e defd$„Z%d%„ Z&d&„ Z'de(e   fˆ fd'„Z)d(„ Z*d)„ Z+ˆ xZ,S )*ÚRecursiveScriptModuleaZ  Retain the existing isinstance(ScriptModule) behavior.

        The core data structure in TorchScript is the ``ScriptModule``. It is an
        analogue of torch's ``nn.Module`` and represents an entire model as a tree of
        submodules. Like normal modules, each individual module in a ``ScriptModule`` can
        have submodules, parameters, and methods. In ``nn.Module``\s methods are implemented
        as Python functions, but in ``ScriptModule``\s methods are implemented as
        TorchScript functions, a statically-typed subset of Python that contains all
        of PyTorch's built-in Tensor operations. This difference allows your
        ``ScriptModule``\s code to run without the need for a Python interpreter.

        ``ScriptModule``\s should not be created manually, instead use
        either :func:`tracing <torch.jit.trace>` or :func:`scripting <torch.jit.script>`.
        Tracing and scripting can be applied incrementally and :ref:`composed as necessary <Types>`.

        * Tracing records the tensor operations as executed with a set of example inputs and uses these
          operations to construct a computation graph. You can use the full dynamic behavior of Python with tracing,
          but values other than Tensors and control flow aren't captured in the graph.

        * Scripting inspects the Python code of the model
          and compiles it to TorchScript. Scripting allows the use of many `types`_ of values and supports dynamic control flow.
          Many, but not all features of Python are supported by the compiler, so changes to the source code may be necessary.
        Tc                 óf   •— d| j                   d<   || _        t        ‰| �  «        t	        | d«       y )NTr   Útraining)rF   rN   ru   rP   rž   )rO   rã   rE   s     €r4   rP   zRecursiveScriptModule.__init__ˆ  s/   ø€ Ø-1ˆD�M‰M˜/Ñ*Ø ˆDŒGÜ‰GÑÔô �D˜*Õ%r6   c                 óV   — t        | «      } ||«       t         j                  |«       |S )a†  
            Construct a RecursiveScriptModule that's ready for use.

            PyTorch code should use this to construct a RecursiveScriptModule instead
            of instead of calling `__init__` directly, as it makes sure the
            object is properly finalized (and in the future, we may take
            control of how the RecursiveScriptModule instance is created).

            Args:
                cpp_module:  The C++ Module that will hold the actual state of
                             this RecursiveScriptModule instance.
                init_fn:  Lambda that initializes the RecursiveScriptModule passed to it.
            )r?  Ú_finalize_scriptmodule)rã   Úinit_fnÚscript_modules      r4   Ú
_constructz RecursiveScriptModule._construct‘  s,   € ô 2°*Ó=ˆMÙ�MÔ"ô
 "×8Ñ8¸ÔGØ Ð r6   c                 ó8  — t        t        j                  j                  | j                  «      «      | _        t        t        j                  j                  | j                  «      «      | _        t        | j                  | j                  «      | _	        d| _
        y )NF)rL   rv   rw   ÚParameterDictrN   r–   Ú
BufferDictr—   rs   r˜   r   ©rE  s    r4   rC  z,RecursiveScriptModule._finalize_scriptmodule©  sx   € ä(:Ü—‘×&Ñ& }×'7Ñ'7Ó8ó)ˆMÔ%ô &8Ü—‘×#Ñ# M×$4Ñ$4Ó5ó&ˆMÔ"ô &7Ø× Ñ  -×"8Ñ"8ó&ˆMÔ"ð +0ˆMÕ'r6   c                 ó:  — | j                  |«       t        j                  j                  j	                  | j
                  j                  «       «      | _        i }t        j                  j                  | j
                  «      j                  «       D ]  \  }}t        |«      ||<   Œ t        | j
                  |«      | _        t        t        j                  j                  | j
                  «      «      | _        t        t        j                  j!                  | j
                  «      «      | _        | j$                  j                  «       D ��ci c],  \  }}t'        |t        j                  j(                  «      s||“Œ. c}}| _        d| j$                  d<   yc c}}w )zä
            Re-construct an instance of RecursiveScriptModule using an instance of a C++ module.

            Args:
                cpp_module: The C++ module that this RecursiveScriptModule will be rebuilt around.
            Fr   N)rP   rv   rw   ÚConcreteModuleTypeÚfrom_jit_typerN   Ú_typerœ   rx   rS   r   rs   r˜   rL   rH  r–   rI  r—   rF   r‚   ÚScriptMethod)rO   rã   ÚmodulesrB   rU   rV   s         r4   Ú_reconstructz"RecursiveScriptModule._reconstruct¶  s/  € ð �M‰M˜*Ô%ô #(§(¡(×"=Ñ"=×"KÑ"KØ—‘—‘“ó#ˆDÔð
 ˆGÜ$)§H¡H×$7Ñ$7¸¿¹Ó$@×$FÑ$FÖ$HÑ ��jÜ /°
Ó ;�˜’ð %Iä-¨d¯g©g°wÓ?ˆDŒMô  2´%·(±(×2HÑ2HÈÏÉÓ2QÓRˆDÔÜ.¬u¯x©x×/BÑ/BÀ4Ç7Á7Ó/KÓLˆDŒMð
 !ŸM™M×/Ñ/Ô1ôá1‘D�A�qÜ! !¤U§X¡X×%:Ñ%:Ô;ð �1‘Ø1òˆDŒMð
 .3ˆD�M‰M˜/Ò*ùós   Å1Fc                 óL   — | j                   j                  d«      j                  S )zPReturn a string representation of the internal graph for the ``forward`` method.r¶   )rN   Ú_get_methodr$  r^   s    r4   r$  zRecursiveScriptModule.graphÖ  s   € ð —7‘7×&Ñ& yÓ1×7Ñ7Ð7r6   c                 ó.   — | j                   j                  S )zÀ
            Return a string representation of the internal graph for the ``forward`` method.

            This graph will be preprocessed to inline all function and method calls.
            )r¶   r%  r^   s    r4   r%  z#RecursiveScriptModule.inlined_graphÛ  s   € ð —<‘<×-Ñ-Ð-r6   c                 ó.   — | j                   j                  S )zŒ
            Return a pretty-printed representation (as valid Python syntax) of the internal graph for the ``forward`` method.

            )r¶   r"  r^   s    r4   r"  zRecursiveScriptModule.codeä  s   € ð —<‘<×$Ñ$Ð$r6   c                 óT   — | j                   j                  }|d   t        |d   «      fS )a|  Return a tuple.

            Returns a tuple of:

            [0] a pretty-printed representation (as valid Python syntax) of
            the internal graph for the ``forward`` method. See `code`.
            [1] a ConstMap following the CONSTANT.cN format of the output in [0].
            The indices in the [0] output are keys to the underlying constant's values.

            r   r)   )r¶   r#  rÑ   r}   s     r4   r#  z)RecursiveScriptModule.code_with_constantsì  s*   € ð —‘×0Ñ0ˆAØ�a‘Dœ( 1 Q¡4›.Ð)Ð)r6   c                 óN   —  | j                   j                  t        |«      fi |¤ŽS )am  Save with a file-like object.

            save(f, _extra_files={})

            See :func:`torch.jit.save <torch.jit.save>` which accepts a file-like object.
            This function, torch.save(), converts the object to a string, treating it as a path.
            DO NOT confuse these two functions when it comes to the 'f' parameter functionality.
            )rN   ÚsaverØ   )rO   Úfr¡   s      r4   rX  zRecursiveScriptModule.saveû  s"   € ð  �4—7‘7—<‘<¤ A£Ñ1¨&Ñ1Ð1r6   z”Lite Interpreter is deprecated. Please consider switching to ExecuTorch.             https://docs.pytorch.org/executorch/stable/getting-started.htmlc                 ór   — t        j                  dt        d¬«        | j                  j                  |i |¤ŽS )az  Add (or update) the bytecode session to the script model.

            _save_for_lite_interpreter(f)

            The updated model is used
            in lite interpreter for mobile applications.

            Args:
                f: a string containing a file name.
                _extra_files: Map from filename to contents which will be stored as part of 'f'.

            ú˜Lite Interpreter is deprecated. Please consider switching to ExecuTorch.                 https://docs.pytorch.org/executorch/stable/getting-started.htmlrÁ   ©Ú
stacklevel)rÇ   rÈ   rÉ   rN   Ú_save_for_mobiler  s      r4   Ú_save_for_lite_interpreterz0RecursiveScriptModule._save_for_lite_interpreter  s:   € ô" �M‰MðQä"Øõ	ð ,�4—7‘7×+Ñ+¨TÐ<°VÑ<Ð<r6   c                 ór   — t        j                  dt        d¬«        | j                  j                  |i |¤ŽS )Nr[  rÁ   r\  )rÇ   rÈ   rÉ   rN   Ú_save_to_buffer_for_mobiler  s      r4   Ú$_save_to_buffer_for_lite_interpreterz:RecursiveScriptModule._save_to_buffer_for_lite_interpreter  s:   € ô
 �M‰MðQä"Øõ	ð 6�4—7‘7×5Ñ5°tÐF¸vÑFÐFr6   r    r¡   rÓ   c                 ó:   —  | j                   j                  |i |¤ŽS r;   )rN   Úsave_to_bufferr  s      r4   rd  z$RecursiveScriptModule.save_to_buffer,  s   € Ø)�4—7‘7×)Ñ)¨4Ð:°6Ñ:Ð:r6   c                 ó6   — | j                   j                  «       S r;   )rN   Úget_debug_stater  s      r4   rf  z%RecursiveScriptModule.get_debug_state/  s   € Ø—7‘7×*Ñ*Ó,Ð,r6   c                 ó    — d| j                   › �S )Nzoriginal_name=)r&  r^   s    r4   Ú
extra_reprz RecursiveScriptModule.extra_repr2  s   € Ø# D×$6Ñ$6Ð#7Ð8Ð8r6   c                 óB   —  | j                   j                  | g|¢­i |¤ŽS r;   )r¶   Ú	graph_forr  s      r4   rj  zRecursiveScriptModule.graph_for5  s#   € Ø)�4—<‘<×)Ñ)¨$Ð@°Ò@¸Ñ@Ð@r6   c                 óÞ   — t        | «      t        | j                  j                  «       j	                  «       «      u ryt        | j                  j                  «       j	                  «       «      S ©NÚ )r9   rØ   rN   rN  rB   r^   s    r4   r&  z#RecursiveScriptModule.original_name8  sI   € ô �D‹zœS §¡§¡£×!5Ñ!5Ó!7Ó8Ñ8ØÜ�t—w‘w—}‘}“×+Ñ+Ó-Ó.Ð.r6   c                 ó~   — t        j                  d¬«      }| j                  j                  | j                  ||«       y )Nr)   rÂ   )rÊ   rË   rN   Ú_definerœ   )rO   r0  r1  s      r4   r.  zRecursiveScriptModule.define?  s.   € ô  ×AÑAÈAÔNˆCØ�G‰G�O‰O˜D×/Ñ/°°cÕ:r6   rÖ   c                 ó¾  •— d| j                   vrt        d«      ‚| j                  rt        ‰| �  |«      S || j
                  v r| j
                  |   S | j                  j                  |«      r| j                  j                  |«      S | j                  j                  |«      r,| j                  j                  |«      }|| j                   |<   |S t        ‰| �  |«      S )Nr   zKScriptModule has not been initialized, did you forget to call super's init?)rF   rb   r   ru   r·   r˜   rN   rH   rA   r  rS  )rO   rÖ   rÏ   rE   s      €r4   r·   z!RecursiveScriptModule.__getattr__K  sÆ   ø€ Ø d§m¡mÑ3Ü"Øaóð ð ×!Ò!Ü‘wÑ*¨4Ó0Ð0ð �t—}‘}Ñ$Ø—}‘} TÑ*Ð*Ø—‘—‘ Ô&Ø—w‘w—‘ tÓ,Ð,Ø—‘×$Ñ$ TÔ*Ø $§¡× 3Ñ 3°DÓ 9�ð '4�—‘˜dÑ#Ø$Ð$ä‘7Ñ& tÓ,Ð,r6   r8   Nc                 ó|  •— | j                   rt        ‰| �	  ||«      S || j                  v r|| j                  |<   y | j                  j                  |«      r| j                  j                  ||«       y t        | d«      r.|| j                  j                  «       v rt        d|› d|› d�«      ‚t        ‰| �	  ||«      S )Nrœ   z+Cannot mutate TorchScript constant value: 'z'. Value: 'Ú')
r   ru   r  r˜   rN   rH   rg   rœ   Úget_constantsÚAttributeErrorr  s      €r4   r  z!RecursiveScriptModule.__setattr__c  s´   ø€ Ø×!Ò!Ü‘wÑ*¨4°Ó7Ð7à�t—}‘}Ñ$Ø&+�—‘˜dÒ#Ø—‘—‘ Ô&Ø—‘—‘  eÕ,ä˜Ð.Ô/Ø˜D×/Ñ/×=Ñ=Ó?Ñ?ô %ØAÀ$ÀÀ{ÐSXÐRYÐYZÐ[óð ô ‘wÑ*¨4°Ó7Ð7r6   c                 óŽ   — t         j                  j                  j                  t	        j                  | j
                  «      «      S r;   )rv   r™   rš   r   ÚcopyrN   r^   s    r4   Ú__copy__zRecursiveScriptModule.__copy__~  s*   € Ü—9‘9×'Ñ'×7Ñ7¼¿	¹	À$Ç'Á'Ó8JÓKÐKr6   Úmemoc                 ó�   — t         j                  j                  j                  t	        j
                  | j                  |«      «      S r;   )rv   r™   rš   r   rv  ÚdeepcopyrN   )rO   rx  s     r4   Ú__deepcopy__z"RecursiveScriptModule.__deepcopy__�  s,   € Ü—9‘9×'Ñ'×7Ñ7¼¿¹ÀdÇgÁgÈtÓ8TÓUÐUr6   r  c                 ór   — t        | |«      }t        |dd «      t        t        |«      k(  rt        ‚ ||i |¤ŽS )NÚ__func__)rA   r?  ÚNotImplementedErrorr  s        r4   r  z*RecursiveScriptModule.forward_magic_methodˆ  sE   € ô " $¨Ó4ˆKÜ�{ J°Ó5¼Ü% {ó:ò ô *Ð)Ù Ð/¨Ñ/Ð/r6   c                 ó$   — | j                  d«      S )Nrå   ©r  r^   s    r4   rå   zRecursiveScriptModule.__iter__’  s   € Ø×,Ñ,¨ZÓ8Ð8r6   Úidxc                 ó&   — | j                  d|«      S )Nrn   r€  )rO   r�  s     r4   rn   z!RecursiveScriptModule.__getitem__•  s   € Ø×,Ñ,¨]¸CÓ@Ð@r6   c                 ó$   — | j                  d«      S )Nr_   r€  r^   s    r4   r_   zRecursiveScriptModule.__len__˜  s   € Ø×,Ñ,¨YÓ7Ð7r6   c                 ó&   — | j                  d|«      S )Nrk   r€  )rO   Úkeys     r4   rk   z"RecursiveScriptModule.__contains__›  s   € Ø×,Ñ,¨^¸SÓAÐAr6   c                 ó~   •— | j                   }|j                  t        t        d«      u rt        ‰| �  «       S  |«       S )NÚ__dir__)r‡  r}  rC   r?  ru   )rO   r  rE   s     €r4   r‡  zRecursiveScriptModule.__dir__   s=   ø€ ØŸ,™,ˆKà×$Ñ$Ü*Ô+@À)ÓLñMô ‘w‘Ó(Ð(Ù“=Ð r6   c                 ób   — | j                   }|j                  t        t        d«      u ry |«       S )Nrù   T)rù   r}  rC   r?  )rO   r  s     r4   rù   zRecursiveScriptModule.__bool__¬  s2   € ØŸ-™-ˆKà×$Ñ$Ü*Ô+@À*ÓMñNð Ù“=Ð r6   c                 ód   — d„ }t         j                  | j                  j                  «       |«      S )Nc                  ó   — y r;   r<   rJ  s    r4   rD  zCRecursiveScriptModule._replicate_for_data_parallel.<locals>.init_fn¸  s   € àr6   )r?  rF  rN   r3  )rO   rD  s     r4   r3  z2RecursiveScriptModule._replicate_for_data_parallelµ  s.   € òô
 )×3Ñ3Ø—‘×4Ñ4Ó6¸óð r6   )-ro   rp   rq   r  r�   rP   ÚstaticmethodrF  rC  rQ  r  r$  r%  r"  r#  rX  r
   r_  rb  r   rd  rf  rØ   rh  rj  r&  r.  r·   r  r   rw  Údictr9  r{  r  r   rå   rn   r_   rk   r   r‡  rù   r3  r…   r†   s   @r4   r?  r?  j  s  ø„ ñ	ð0  $Ðô	&ð 
ñ	!ó 
ð	!ð. 
ñ
	0ó 
ð
	0ò	3ð@ 
ñ	8ó 
ð	8ð 
ñ	.ó 
ð	.ð 
ñ	%ó 
ð	%ð 
ñ	*ó 
ð	*ò		2ñ 
ðMó

ñ	=ó	

ð	=ñ* 
ðMó

ñ	Gó	

ð	Gð	;¨ð 	;°sð 	;¸só 	;ð	-¨ð 	-¸ð 	-Àó 	-ð	9 ó 	9ð	A 3ð 	A°#ð 	A¸#ó 	Að 
ñ	/ó 
ð	/ò
	;ð	- Cð 	-¨Cõ 	-ð0	8 Cð 	8°ð 	8¸õ 	8ð6	L˜dó 	Lð	V T¨#¨s¨(¡^°dÑ%:ð 	V¸tó 	Vð	0Ø"ð	0Ø+.ð	0Ø:=ð	0àó	0ð	9˜h s™mó 	9ð	A 3ð 	A¨3ó 	Aò	8ò	Bð
	!˜X c™]õ 	!ò	!ö
	r6   r?  Ú__c                 ó:   ‡— dd l Š ‰j                  | ˆfd„¬«      S )Nr   c                 óP   •—  ‰j                   | «      xs  ‰j                  | «      S r;   )Ú
isfunctionÚismethod)ÚxÚinspects    €r4   r�   z_get_methods.<locals>.<lambda>Ö  s)   ø€ Ð%7 W×%7Ñ%7¸Ó%:Ò%QÐ>N¸g×>NÑ>NÈqÓ>QÐ%Qr6   )Ú	predicate)r“  Ú
getmembers)r3   r“  s    @r4   Ú_get_methodsr–  Ñ  s#   ø€ Ûð "ˆw×!Ñ!ØÓQô
ð 	
r6   >%   ÚtoÚcpuÚcudaÚevalÚhalfr9   ÚapplyÚfloatÚtrainÚ_applyÚdoubleÚbuffersr¶   rP  ÚchildrenÚ	_get_nameÚ	zero_gradÚ
add_modulerh  Ú
parametersÚ
state_dictÚshare_memoryÚ_slow_forwardÚ_tracing_nameÚnamed_buffersÚnamed_modulesÚ_named_membersÚnamed_childrenÚget_extra_stateÚload_state_dictÚregister_bufferÚregister_moduleÚset_extra_stateÚnamed_parametersÚregister_parameterÚ_save_to_state_dictÚ_load_from_state_dictc                 ó   ‡ — ˆ fd„}|S )Nc                 ó    •— t        ‰dz   «      ‚)Nz" is not supported on ScriptModulesra   )rO   r    r¡   rB   s      €r4   Úfailz_make_fail.<locals>.fail  s   ø€ Ü˜tÐ&JÑJÓKÐKr6   r<   )rB   rº  s   ` r4   Ú
_make_failr»    s   ø€ ô	Lð ˆr6   Ú
_call_implc                   ó   — e Zd Zy)rþ   Nr¼   r<   r6   r4   rþ   rþ     s   „ Ør6   c                   ó    ‡ — e Zd Zdˆ fd„	Zˆ xZS )rƒ   c                 ó"   •— t         ‰| �  «        y r;   r(  ©rO   ÚargrE   s     €r4   rP   zScriptModule.__init__  r)  r6   r;   r²   r†   s   @r4   rƒ   rƒ     ó   ø„ ÷	ñ 	r6   c                   ó    ‡ — e Zd Zdˆ fd„	Zˆ xZS )r?  c                 ó"   •— t         ‰| �  «        y r;   r(  rÀ  s     €r4   rP   zRecursiveScriptModule.__init__  r)  r6   r;   r²   r†   s   @r4   r?  r?    rÂ  r6   c                 óX  — t        | t        j                  j                  «      s| S t	        | «      }||v r|t	        | «         S t        | d«      r| j                  «       n| } | ||<   i }| j                  j                  «       D ]€  \  }}|dk(  r-|j                  «       D ]  \  }}t        ||«      ||<   Œ |||<   Œ8t        |t        j                  j                  «      r t        |t        «      st        ||«      ||<   Œ||||<   Œ‚ |j                  «       D ]  }|| j                  <   Œ | S )NÚ__prepare_scriptable__r˜   )r‚   rv   Únnr"   ÚidrH   rÆ  rF   rS   Ú!call_prepare_scriptable_func_implrƒ   r[   )r¸   rx  Úobj_idÚnew_obj_dictrB   Ú
sub_modulerU   rV   s           r4   rÉ  rÉ     s$  € Ü�cœ5Ÿ8™8Ÿ?™?Ô+Øˆ
ä�‹W€Fð ��~Ø”B�s“G‰}Ðô )0°Ð5MÔ(Nˆ×"Ñ"Ô$ÐTWð ð €Dˆ�Là€LàŸL™L×.Ñ.Ö0ÑˆˆjØ�:ÒØ"×(Ñ(Ö*‘��1Ü AÀ!ÀTÓ J�
˜1’ð +à!+ˆL˜ÒÜ˜
¤E§H¡H§O¡OÔ4¼ZØœô>
ô "CÀ:ÈtÓ!TˆL˜Òà!+ˆL˜Òð 1ð × Ñ Ö"ˆØˆ�‰�TÒð #ð €Jr6   c                 ó   — i }t        | |«      S r;   )rÉ  )r¸   rx  s     r4   Úcall_prepare_scriptable_funcrÎ  G  s   € Ø')€DÜ,¨S°$Ó7Ð7r6   c                 ó@   — t         j                  j                  | «      S )a²  
    Create a ``torch._C.ScriptDict`` instance with the data from ``obj``.

    Args:
        obj (dict): The Python dictionary that is used to initialize the ``ScriptDict``
                    returned by this function.

    Returns:
        An instance of ``torch._C.ScriptDict`` that has the same data as ``obj``
        and can be passed between Python and TorchScript with reference semantics and
        zero copy overhead.
    )rv   rw   Ú
ScriptDict)r¸   s    r4   Úcreate_script_dictrÑ  L  s   € ô �8‰8×Ñ˜sÓ#Ð#r6   c                 ó@   — t         j                  j                  | «      S )a«  
    Create a ``torch._C.ScriptList`` instance with the data from ``obj``.

    Args:
        obj (dict): The Python list that is used to initialize the ``ScriptList``
                    returned by this function.
    Returns:
        An instance of ``torch._C.ScriptList`` that has the same data as ``obj``
        and can be passed between Python and TorchScript with reference semantics and
        zero copy overhead.
    )rv   rw   Ú
ScriptList)r¸   Ú	type_hints     r4   Úcreate_script_listrÕ  \  s   € ô �8‰8×Ñ˜sÓ#Ð#r6   TÚ	_TOPLEVELÚexample_inputsc                 ó  — |�t        j                  dt        d¬«       t        | t        «      r| S t        | t
        «      r| S t        | t        «      r| S |r¨t        «       at        r�t        t        «      }t        |«      5  t        |t        «      r%|j                  «       D ]  \  }}|D ]  } ||Ž  Œ	 Œ n(t        |t        «      r|D ]  }	 | |	Ž  Œ	 nt        d«      ‚d d d «       nt        j                  dd¬«       t        | t        j                   j"                  «      rWt%        | «      } t        j&                  j(                  j+                  | t        j&                  j(                  j,                  «      S t/        | d«      r| j1                  «       n| } t        | t        «      rt3        | «      S t        | t        «      rt5        | «      S t7        j8                  | «      rÀt;        | «      }
t=        | t        j                   j"                  «      rt?        d| › d	�«      ‚t=        | t@        jB                  «      r| S tE        | «      st?        d
«      ‚tG        | jI                  «       «      dkD  rt?        d«      ‚|€tK        jL                  |dz   «      }tO        | ||
«       | S t7        jP                  | «      st7        jR                  | «      �r	t;        | «      }
t/        | d«      r!| jT                  } tK        jV                  | «      }t/        | d«      rt?        d| jX                  z   «      ‚t[        | «       t]        | «      }|r	| |_/        |S ta        | | jb                  «      }|€tK        jV                  | «      }t        jd                  jg                  |
||ti        | «      «      }| jj                  |_5        d|_1        d|_6        | |_/        to        | |«       |S t        j&                  j(                  jq                  | «      S # 1 sw Y   �ŒxY w)Nz^`optimize` is deprecated and has no effect. Use `with torch.jit.optimized_execution()` insteadr¿   r\  zˆError: Unable to infer types. Please format the inputs to type `List[Tuple]` or `Dict[Callable, List[Tuple]]` to be run with MonkeyType.zîWarning: monkeytype is not installed. Please install https://github.com/Instagram/MonkeyType to enable Profile-Directed Typing in TorchScript. Refer to https://github.com/Instagram/MonkeyType/blob/master/README.rst to install MonkeyType. rÁ   rÆ  zType 'zO' cannot be compiled since it inherits from nn.Module, pass an instance insteadzLTorchScript classes must be new-style classes. Please inherit from 'object'.z\TorchScript classes does not support inheritance yet. Please directly inherit from 'object'.r)   Ú__script_if_tracing_wrapperÚ__script_unsupportedzTorchScript error: r,   r-   )9rÇ   rÈ   ÚFutureWarningr‚   rþ   rƒ   r,   r   r>   r   r   rŒ  rS   ÚlistÚ
ValueErrorrv   rÇ  r"   rÎ  r™   rš   r›   r   rH   rÆ  rÑ  rÕ  r“  Úisclassr   Ú
issubclassrb   ÚenumÚEnumrJ   r]   ÚmrorÊ   rË   r   r�  r‘  Ú__original_fnÚ#createResolutionCallbackFromClosurerÚ  Ú"_check_directly_compile_overloadedr   Ú_torchdynamo_inliner!   ro   rw   Ú_jit_script_compiler   r  rq   r   Úcreate_script_class)r¸   ÚoptimizeÚ
_frames_uprÍ   r×  Úmonkeytype_configrz   Úexample_inputÚexampleÚexamplesÚqualified_nameÚmaybe_already_compiled_fnrÎ   rÌ   s                 r4   Ú_script_implrñ  n  s™  € ð ÐÜ�‰ðAäØõ		
ô �#Ô+Ô,Øˆ
Ü�#”|Ô$Øˆ
Ü�#”~Ô&Øˆ
áô
 *Ó+ˆÝä 2´=Ó AÐÜ!Ð"3Õ4Ü˜n¬dÔ3ð 2@×1EÑ1EÖ1GÑ-˜ Û'4˜GÙ" GÒ,ñ (5ñ 2Hô   ´Ô5Û$2˜Ù˜Xšñ %3ô %ðWóð ÷ 5Ð4ô& �M‰Mðið õ	ô �#”u—x‘x—‘Ô'Ü*¨3Ó/ˆÜ�y‰y×#Ñ#×8Ñ8Ø”—‘×%Ñ%×>Ñ>ó
ð 	
ô �sÐ4Ô5ð ×&Ñ&Ô(àð 	ô �#”tÔÜ! #Ó&Ð&Ü�#”tÔÜ! #Ó&Ð&ä‡��sÔÜ(¨Ó-ˆô �cœ5Ÿ8™8Ÿ?™?Ô+ÜØ˜˜ÐlÐmóð ô �cœ4Ÿ9™9Ô%ØˆJä" 3Ô'Üð0óð ô ˆs�w‰w‹y‹>˜AÒÜð9óð ð ˆ<Ü ×BÑBÀ:ÐPQÁ>ÓRˆDÜ# C¨¨~Ô>Øˆ
Ü	×	Ñ	˜CÔ	 ¤G×$4Ñ$4°SÕ$9Ü(¨Ó-ˆä�3Ð5Ô6Ø×#Ñ#ˆCÜ ×DÑDÀSÓIˆDô �3Ð.Ô/ÜÐ4°s×7OÑ7OÑOÓPÐPä*¨3Ô/Ü$@ÀÓ$EÐ!Ù$Ø<?Ð%Ô9Ø,Ð,Ü˜#˜sŸ|™|Ó,ˆØˆ<Ü ×DÑDÀSÓIˆDÜ�X‰X×)Ñ)Ø˜C Ô'7¸Ó'<ó
ˆð —[‘[ˆŒ
Ø&ˆŒØ4ˆŒà!$ˆÔÜ  RÔ(Øˆ	ä�y‰y×#Ñ#×7Ñ7¸Ó<Ð<÷M 5Ñ4ús   ÂAP Ð P
r¸   ré  rê  rÍ   c                 ó   — t         j                  dk\  rt        j                  dt        «       nt        j                  dt        «       t
        s| S 	 t        }dat        | ||dz   ||¬«      }|rt        dt        |«      ¬«       ||aS # aw xY w)	a­  Script the function.

    Scripting a function or ``nn.Module`` will inspect the source code, compile
    it as TorchScript code using the TorchScript compiler, and return a :class:`ScriptModule` or
    :class:`ScriptFunction`. TorchScript itself is a subset of the Python language, so not all
    features in Python work, but we provide enough functionality to compute on
    tensors and do control-dependent operations. For a complete guide, see the
    :ref:`language-reference`.

    Scripting a dictionary or list copies the data inside it into a TorchScript instance than can be
    subsequently passed by reference between Python and TorchScript with zero copy overhead.

    ``torch.jit.script`` can be used as a function for modules, functions, dictionaries and lists
     and as a decorator ``@torch.jit.script`` for torchscript-classes and functions.

    Args:
        obj (Callable, class, or nn.Module):  The ``nn.Module``, function, class type,
                                                  dictionary, or list to compile.
        example_inputs (Union[List[Tuple], Dict[Callable, List[Tuple]], None]): Provide example inputs
            to annotate the arguments for a function or ``nn.Module``.

    Returns:
        If ``obj`` is ``nn.Module``, ``script`` returns
        a :class:`ScriptModule` object. The returned :class:`ScriptModule` will
        have the same set of sub-modules and parameters as the
        original ``nn.Module``. If ``obj`` is a standalone function,
        a :class:`ScriptFunction` will be returned. If ``obj`` is a ``dict``, then
        ``script`` returns an instance of `torch._C.ScriptDict`. If ``obj`` is a ``list``,
        then ``script`` returns an instance of `torch._C.ScriptList`.

    **Scripting a function**
        The ``@torch.jit.script`` decorator will construct a :class:`ScriptFunction`
        by compiling the body of the function.

        Example (scripting a function):

        .. testcode::

            import torch

            @torch.jit.script
            def foo(x, y):
                if x.max() > y.max():
                    r = x
                else:
                    r = y
                return r

            print(type(foo))  # torch.jit.ScriptFunction

            # See the compiled graph as Python code
            print(foo.code)

            # Call the function using the TorchScript interpreter
            foo(torch.ones(2, 2), torch.ones(2, 2))

        .. testoutput::
            :hide:

            ...

    ****Scripting a function using example_inputs**
        Example inputs can be used to annotate a function arguments.

        Example (annotating a function before scripting):

        .. testcode::

            import torch

            def test_sum(a, b):
                return a + b

            # Annotate the arguments to be int
            scripted_fn = torch.jit.script(test_sum, example_inputs=[(3, 4)])

            print(type(scripted_fn))  # torch.jit.ScriptFunction

            # See the compiled graph as Python code
            print(scripted_fn.code)

            # Call the function using the TorchScript interpreter
            scripted_fn(20, 100)

        .. testoutput::
            :hide:

            ...

    **Scripting an nn.Module**
        Scripting an ``nn.Module`` by default will compile the ``forward`` method and recursively
        compile any methods, submodules, and functions called by ``forward``. If a ``nn.Module`` only uses
        features supported in TorchScript, no changes to the original module code should be necessary. ``script``
        will construct :class:`ScriptModule` that has copies of the attributes, parameters, and methods of
        the original module.

        Example (scripting a simple module with a Parameter):

        .. testcode::

            import torch

            class MyModule(torch.nn.Module):
                def __init__(self, N, M):
                    super().__init__()
                    # This parameter will be copied to the new ScriptModule
                    self.weight = torch.nn.Parameter(torch.rand(N, M))

                    # When this submodule is used, it will be compiled
                    self.linear = torch.nn.Linear(N, M)

                def forward(self, input):
                    output = self.weight.mv(input)

                    # This calls the `forward` method of the `nn.Linear` module, which will
                    # cause the `self.linear` submodule to be compiled to a `ScriptModule` here
                    output = self.linear(output)
                    return output

            scripted_module = torch.jit.script(MyModule(2, 3))

        Example (scripting a module with traced submodules):

        .. testcode::

            import torch
            import torch.nn as nn
            import torch.nn.functional as F

            class MyModule(nn.Module):
                def __init__(self) -> None:
                    super().__init__()
                    # torch.jit.trace produces a ScriptModule's conv1 and conv2
                    self.conv1 = torch.jit.trace(nn.Conv2d(1, 20, 5), torch.rand(1, 1, 16, 16))
                    self.conv2 = torch.jit.trace(nn.Conv2d(20, 20, 5), torch.rand(1, 20, 16, 16))

                def forward(self, input):
                    input = F.relu(self.conv1(input))
                    input = F.relu(self.conv2(input))
                    return input

            scripted_module = torch.jit.script(MyModule())

        To compile a method other than ``forward`` (and recursively compile anything it calls), add
        the :func:`@torch.jit.export <torch.jit.export>` decorator to the method. To opt out of compilation
        use :func:`@torch.jit.ignore <torch.jit.ignore>` or :func:`@torch.jit.unused <torch.jit.unused>`.

        Example (an exported and ignored method in a module)::

            import torch
            import torch.nn as nn


            class MyModule(nn.Module):
                def __init__(self) -> None:
                    super().__init__()

                @torch.jit.export
                def some_entry_point(self, input):
                    return input + 10

                @torch.jit.ignore
                def python_only_fn(self, input):
                    # This function won't be compiled, so any
                    # Python APIs can be used
                    import pdb

                    pdb.set_trace()

                def forward(self, input):
                    if self.training:
                        self.python_only_fn(input)
                    return input * 99


            scripted_module = torch.jit.script(MyModule())
            print(scripted_module.some_entry_point(torch.randn(2, 2)))
            print(scripted_module(torch.randn(2, 2)))

        Example ( Annotating forward of nn.Module using example_inputs)::

            import torch
            import torch.nn as nn
            from typing import NamedTuple

            class MyModule(NamedTuple):
            result: List[int]

            class TestNNModule(torch.nn.Module):
                def forward(self, a) -> MyModule:
                    result = MyModule(result=a)
                    return result

            pdt_model = TestNNModule()

            # Runs the pdt_model in eager model with the inputs provided and annotates the arguments of forward
            scripted_model = torch.jit.script(pdt_model, example_inputs={pdt_model: [([10, 20, ], ), ], })

            # Run the scripted_model with actual inputs
            print(scripted_model([20]))
    r¾   zv`torch.jit.script` is not supported in Python 3.14+ and may break. Please switch to `torch.compile` or `torch.export`.zU`torch.jit.script` is deprecated. Please switch to `torch.compile` or `torch.export`.Fr)   )r¸   ré  rê  rÍ   r×  Úscript)Úmodel_id)
rÅ   rÆ   rÇ   rÈ   rÉ   r   rÖ  rñ  r   r   )r¸   ré  rê  rÍ   r×  ÚprevÚrets          r4   ró  ró  ù  s”   € ô` ×Ñ˜7Ò"Ü�‰ðBäõ	
ô 	�‰ØcÜô	
õ Øˆ
ðäˆØˆ	ÜØØØ! A‘~ØØ)ô
ˆñ Ü! (´]À3Ó5GÕHàà‰	ø�D‰	ús   Á4B	 Â	Bc                 ó¦   — |j                  «       D ]>  \  }}|| vs	| |   |k7  sŒt        j                  j                  j	                  |d|› �«      ‚ y )Nz™Default parameters on overloads do not affect the runtime so they must equal to the default parameter on the implementation function. Found on parameter )rS   rv   r™   ÚfrontendÚFrontendError)Úimpl_defaultsÚoverload_defaultsÚlocrB   Úoverload_values        r4   Ú_check_overload_defaultsrþ  î  s]   € Ø 1× 7Ñ 7Ö 9ÑˆˆnØ�}Ñ$¨°dÑ(;¸~Ó(MÜ—)‘)×$Ñ$×2Ñ2Øðà!˜Fð$óð ñ !:r6   c                 óÌ  — t        | | j                  «      j                  «       }t        j                  j
                  j                  | d d t        j                  | «      «      }t        ||j                  «      }t        | «      }t        |«      }t        j                  |«      }t        |||j                  «       «       t        j                  j                  ||||||«      }	|	S r;   )r!   ro   Údeclrv   r™   ÚannotationsÚget_signaturer“  r‘  r   rÊ   rä  rþ  Úrangerw   Ú_jit_script_compile_overload)
Úoverload_fnÚ	qual_nameÚimpl_fnÚoverload_declÚoverload_signatureÚimpl_astrû  Úimplementation_defaultsrÍ   rÌ   s
             r4   Ú_compile_function_with_overloadr  ù  sÎ   € Ü ¨[×-AÑ-AÓB×GÑGÓI€MÜŸ™×.Ñ.×<Ñ<Ø�T˜4¤×!1Ñ!1°+Ó!>óÐô ˜7 G×$4Ñ$4Ó5€HÜ(¨Ó5ÐÜ.¨wÓ7ÐÜ×<Ñ<¸WÓE€DÜØÐ!2°M×4GÑ4GÓ4Iôô 
�‰×	.Ñ	.ØØØØØØó
€Bð €Ir6   c                 ó8  — t        | «      }t        | «      }t        j                  |«      }|€|S | |v rt	        t        j
                  d| «      «      ‚|D �cg c]  }t        ||| «      ‘Œ }}|r||z   }t        | |«       t        j                  |«       |S c c}w )NÚfunction)	r   r   rÊ   Ú_get_fn_overloadsrb   Ú,get_overload_no_implementation_error_messager  r   Ú_clear_fn_overloads)r¸   Úexisting_compiled_fnsr  Úuncompiled_overloadsr  Úcompiled_fnss         r4   Ú_get_overloadsr    sº   € ä9¸#Ó>ÐÜ Ó$€IÜ(×:Ñ:¸9ÓEÐØÐ#Ø$Ð$à
Ð"Ñ"ÜÜ×FÑFÀzÐSVÓWó
ð 	
ñ 0óá/ˆKô 	(¨°YÀÕDØ/ð ð ñ
 Ø,¨|Ñ;ˆô ˜C Ô.Ü×%Ñ% iÔ0ØÐùòs   ÁBc                 óx   — t        | «      }t        j                  |«      st        | «      rt	        d|› d�«      ‚y )Nz	Function z˜ cannot be directly compiled because it is overloaded. It must be used in a context of a function where its inputs can determine which overload to call.)r   rÊ   r  r   rb   )r¸   r  s     r4   rå  rå  +  sI   € Ü Ó$€IÜ×&Ñ& yÔ1Ô5RÐSVÔ5WÜØ˜	�{ð #Fð Fó
ð 	
ð 6Xr6   c                 ó:  — t        j                  dt        «       t        j                  | «      st        d«      ‚t        | «      st        d«      ‚t        | t        j                  j                  «      xr t        | j                  «       «      dk(  }|s't        | j                  «       «      dkD  rt        d«      ‚t        | «      }t        j                  d«      }t!        | | j"                  «      }t        j$                  j'                  ||||«      }|| _        | S )a¸  Decorate to annotate classes or modules of different types.

    .. deprecated:: 2.5
        TorchScript is deprecated, please use ``torch.compile`` instead.

    This decorator can be used to define an interface that can be used to annotate
    classes or modules of different types. This can be used for to annotate a submodule
    or attribute class that could have different types that implement the same
    interface, or which could be swapped at runtime; or to store a list of modules or
    classes of varying types.

    It is sometimes used to implement "Callables" - functions or modules that implement
    an interface but whose implementations differ and which can be swapped out.

    Example:
    .. testcode::

        import torch
        from typing import List

        @torch.jit.interface
        class InterfaceType:
            def run(self, x: torch.Tensor) -> torch.Tensor:
                pass

        # implements InterfaceType
        @torch.jit.script
        class Impl1:
            def run(self, x: torch.Tensor) -> torch.Tensor:
                return x.relu()

        class Impl2(torch.nn.Module):
            def __init__(self) -> None:
                super().__init__()
                self.val = torch.rand(())

            @torch.jit.export
            def run(self, x: torch.Tensor) -> torch.Tensor:
                return x + self.val

        def user_fn(impls: List[InterfaceType], idx: int, val: torch.Tensor) -> torch.Tensor:
            return impls[idx].run(val)

        user_fn_jit = torch.jit.script(user_fn)

        impls = [Impl1(), torch.jit.script(Impl2())]
        val = torch.rand(4, 4)
        user_fn_jit(impls, 0, val)
        user_fn_jit(impls, 1, val)
    zH`torch.jit.interface` is deprecated. Please use `torch.compile` instead.z$interface must be applied to a classz1TorchScript interfaces must inherit from 'object'r¿   rÁ   zmTorchScript interface does not support inheritance yet. Please directly inherit from 'object' or 'nn.Module'.r)   )rÇ   rÈ   rÉ   r“  rÞ  rb   rJ   rß  rv   rÇ  r"   r]   râ  r   rÊ   rË   r    ro   rw   Ú_jit_script_interface_compileÚ__torch_script_interface__)r¸   Úis_module_interfacerï  r1  rÎ   Úmangled_classnames         r4   Ú	interfacer  5  sô   € ôf ‡M�MØRÜôô �?‰?˜3ÔÜÐAÓBÐBÜ˜sÔ#ÜÐNÓOÐOô % S¬%¯(©(¯/©/Ó:ÒR¼sÀ3Ç7Á7Ã9»~ÐQRÑ?RÐá¤3 s§w¡w£y£>°AÒ#5ÜðDó
ð 	
ô
 % SÓ)€NÜ
×
9Ñ
9¸!Ó
<€Cô ˜C §¡Ó
.€CÜŸ™×>Ñ>Ø˜˜SÐ"5óÐð &7€CÔ"Ø€Jr6   c                 óœ   — t        | «      }t        j                  j                  ||«      }t	        j
                  | «      }t        | ||«      S r;   )r   rv   rw   Ú	CallStackrÊ   Ú'createResolutionCallbackForClassMethodsr   )r¸   rü  Ú
_qual_nameÚerror_stackr1  s        r4   Ú_recursive_compile_classr"  Š  sC   € Ü  Ó%€Jô —(‘(×$Ñ$ Z°Ó5€KÜ
×
?Ñ
?ÀÓ
D€CÜ& s¨C°Ó<Ð<r6   ÚsÚpaddingÚoffsetÚcharc                 ó    — |t        | «      k\  r|t        | «      z  }dj                  t        ||z   «      D �cg c]  }|‘Œ c}«      | z   S c c}w rl  )r]   Újoinr  )r#  r$  r%  r&  r¥   s        r4   Úpadr)  —  sN   € Ø”#�a“&ÒØ”3�q“6ÑˆØ�7‰7¤%¨°&Ñ(8Ô"9Ó:Ñ"9˜Q’DÐ"9Ñ:Ó;¸aÑ?Ð?ùÒ:s   ¸	Ac                   ó8   — e Zd Zd
dededefd„Zdedefd„Zd„ Zy	)Ú_ScriptProfileColumnÚheaderÚ	alignmentr%  c                 ó<   — || _         || _        || _        i | _        y r;   )r,  r-  r%  Úrows)rO   r,  r-  r%  s       r4   rP   z_ScriptProfileColumn.__init__ž  s   € ØˆŒØ"ˆŒØˆŒØ$&ˆ�	r6   Úlinenor8   c                 ó"   — || j                   |<   y r;   )r/  )rO   r0  r8   s      r4   Úadd_rowz_ScriptProfileColumn.add_row¤  s   € Ø!ˆ�	‰	�&Òr6   c           
      óè  — t        | j                  «      }g }| j                  j                  «       D ]8  \  }}t	        |«      }|j                  ||f«       t        t        |«      |«      }Œ: | j                  dkD  r"|| j                  z   }||| j                  z  z  }nd}|D ��cg c]  \  }}|t        ||| j                  «      f‘Œ  }}}t        | j                  || j                  «      |fS c c}}w )Nr   )
r]   r,  r/  rS   rØ   ÚappendÚmaxr-  r)  r%  )rO   Ú
max_lengthr/  r…  r8   Úcellr$  s          r4   Úmaterializez _ScriptProfileColumn.materialize§  s×   € Ü˜Ÿ™Ó%ˆ
Ø&(ˆØŸ)™)Ÿ/™/Ö+‰JˆC�Ü�u“:ˆDØ�K‰K˜˜d˜Ô$ÜœS ›Y¨
Ó3‰Jð ,ð
 �>‰>˜AÒØ  4§>¡>Ñ1ˆGØ�w §¡Ñ/Ñ/‰GàˆGáHLÔMÉ¹9¸3À�”c˜$ ¨¯©Ó5Ò6ÈˆÑMÜ�4—;‘; ¨¯©Ó5°tÐ;Ð;ùó Ns   Â%#C.N)é   r   )	ro   rp   rq   rØ   r9  rP   r   r2  r8  r<   r6   r4   r+  r+  �  s4   „ ñ'˜sð '¨sð 'Àó 'ð"˜cð "¨#ó "ó<r6   r+  c                   ó.   — e Zd Zdee   dee   fd„Zd„ Zy)Ú_ScriptProfileTableÚcolsÚsource_rangec                 ó    — || _         || _        y r;   )r<  r=  )rO   r<  r=  s      r4   rP   z_ScriptProfileTable.__init__º  s   € ØˆŒ	Ø(ˆÕr6   c           	      óæ  — g }g }d}| j                   D ]6  }|j                  «       \  }}||z  }|j                  |t        |«      f«       Œ8 |j                  |«       |j                  t	        dt        |«      dd«      «       | j                  D ]P  }d}|D ]6  \  }}|j                  |«      }	|	€|t	        dt        |«      «      z  }Œ2||	z  }Œ8 |j                  |«       ŒR dj                  |«      S )Nrm  r   Ú=Ú
)	r<  r8  r4  rŒ  r)  r]   r=  r
  r(  )
rO   ÚoutputsÚcellsÚheader_bufferÚcolr,  r/  ÚlineÚ
row_bufferr7  s
             r4   Údump_stringz_ScriptProfileTable.dump_string¾  së   € ØˆØ24ˆØˆØ—9”9ˆCØŸ?™?Ó,‰LˆF�DØ˜VÑ#ˆMØ�L‰L˜&¤$ t£*Ð-Õ.ð ð
 	�‰�}Ô%Ø�‰”s˜2œs =Ó1°1°cÓ:Ô;Ø×%Ô%ˆDØˆJÛ %‘�˜Ø—x‘x “~�Ø�<Ø¤# b¬#¨f«+Ó"6Ñ6‘Jà $Ñ&‘Jð !&ð �N‰N˜:Õ&ð &ð �y‰y˜Ó!Ð!r6   N)ro   rp   rq   rÜ  r+  r9  rP   rH  r<   r6   r4   r;  r;  ¹  s$   „ ð)˜TÐ"6Ñ7ð )ÀtÈCÁyó )ó"r6   r;  c                   ó2   — e Zd Zdd„Zd„ Zd„ Zdefd„Zd„ Zy)	Ú_ScriptProfilerÓ   Nc                 óJ   — t         j                  j                  «       | _        y r;   )r   Ú	profilingrJ  Úprofiler^   s    r4   rP   z_ScriptProfile.__init__Ö  s   € Ü×(Ñ(×7Ñ7Ó9ˆ�r6   c                 ó8   — | j                   j                  «        y r;   )rM  Úenabler^   s    r4   rO  z_ScriptProfile.enableÙ  s   € Ø�‰×ÑÕr6   c                 ó8   — | j                   j                  «        y r;   )rM  Údisabler^   s    r4   rQ  z_ScriptProfile.disableÜ  s   € Ø�‰×ÑÕr6   c                 ób  — g }| j                   j                  «       D �]z  }|j                  «       }|j                  «       j	                  «       }t        d„ |D «       «      }|D �cg c]  }||d  ‘Œ	 }}|j                  «       }|t        |«      z   }t        ||«      }	t        d«      }
t        d«      }t        d«      }t        ddd«      }|j                  «       }|	D ]€  }|
j                  ||«       |j                  ||||z
     «       |j                  |«      }|€ŒA|j                  ||j                  «       «       |j                  ||j                  «       «       Œ‚ t        |
|||gt!        |	«      «      }|j#                  |j%                  «       «       �Œ} dj'                  |«      S c c}w )	Nc              3   óh   K  — | ]*  }t        |«      t        |j                  d «      «      z
  –— Œ, y­w)Ú N)r]   Úlstrip)Ú.0rF  s     r4   Ú	<genexpr>z-_ScriptProfile.dump_string.<locals>.<genexpr>ä  s(   è ø€ ÐTÁ|¸tœ˜T›¤S¨¯©°SÓ)9Ó%:Õ:Á|ùs   ‚02zLine #ÚHitsz	Time (ns)zLine Contentsr   r)   z

)rM  Ú_dump_statsÚsourceÚtextÚ
splitlinesÚminÚstarting_linenor]   r  r+  Úline_mapr2  r
  ÚcountÚduration_nsr;  rÜ  r4  rH  r(  )rO   rB  Úsource_statsÚ
source_refÚsource_linesÚdedentrF  Ú
start_lineÚend_liner=  r0  ÚhitsÚtime_nsÚline_contentsÚstatsÚstatÚtables                    r4   rH  z_ScriptProfile.dump_stringß  s‹  € ØˆØ ŸL™L×4Ñ4×6ˆLØ%×,Ñ,Ó.ˆJØ%Ÿ?™?Ó,×7Ñ7Ó9ˆLÜÑTÁ|ÓTÓTˆFÙ6BÓC±l¨d˜D  šM°lˆLÐCà#×3Ñ3Ó5ˆJØ!¤C¨Ó$5Ñ5ˆHÜ  ¨XÓ6ˆLÜ)¨(Ó3ˆFÜ'¨Ó/ˆDÜ*¨;Ó7ˆGÜ0°À!ÀQÓGˆMØ ×)Ñ)Ó+ˆEÛ$�Ø—‘˜t TÔ*Ø×%Ñ% d¨L¸À
Ñ9JÑ,KÔLØ—y‘y “�ØÑ#Ø—L‘L  t§z¡z£|Ô4Ø—O‘O D¨$×*:Ñ*:Ó*<Õ=ð %ô (Ø˜˜w¨Ð6¼¸\Ó8JóˆEð �N‰N˜5×,Ñ,Ó.Ö/ð3 7ð4 �{‰{˜7Ó#Ð#ùò- Ds   Á%F,c                 ó6   — t        | j                  «       «       y r;   )ÚprintrH  r^   s    r4   Údumpz_ScriptProfile.dumpý  s   € Üˆd×ÑÓ Õ!r6   r;  )	ro   rp   rq   rP   rO  rQ  rØ   rH  rp  r<   r6   r4   rJ  rJ  Õ  s"   „ ó:òòð$˜Só $ó<"r6   rJ  c                 ó    — | €t        d«      ‚| S )NzUnwrapping null optional)ÚAssertionError)r’  s    r4   Ú_unwrap_optionalrs    s   € Ø€yÜÐ7Ó8Ð8Ø€Hr6   zaten::_unwrap_optionalzaten::is_scriptingzaten::has_torch_functionr;   )Nr   NN)r   rT  )�r  Úcollectionsrv  rà  r¬   r“  r0   rÅ   rÇ   Úcollections.abcr   r   r   r   Útypingr   r   r	   Útyping_extensionsr
   r   rv   Útorch._jit_internalrÊ   Útorch._classesr   r   r   Útorch._utils_internalr   Útorch.jit._builtinsr   Útorch.jit._fuserr   r   Útorch.jit._monkeytype_configr   r   r   Útorch.jit._recursiver   r   r   r   Útorch.jit._stater   r   r   r   r   Útorch.jit.frontendr   r    r!   Útorch.nnr"   Útorch.overridesr#   r$   r%   Útorch.packager&   r'   Útorch.utilsr(   Ú_serializationr*   r+   r>   rw   rO  rj  r,   ro   rq   r5   Ú
__reduce__Ú
namedtupler7   r?   rC   rJ   rL   rs   r9   rˆ   r´   ÚWarningr»   rÏ   rÑ   rØ   rÇ  rä   Ú_magic_methodsrþ   r  r   rg   rƒ   r?  rF   rS   rB   ÚitemÚcallabler‚   r  Ú
startswithrH   r–  Ú_compiled_methods_allowlistr»  ÚmethodÚendswithrÉ  rÎ  rÑ  rÕ  rÖ  Úboolr,  rÜ  ÚtuplerŒ  rñ  r9  ró  rþ  r  r  rå  r  r"  rÞ   r)  r+  r;  rJ  rs  Úis_scriptingr<   r6   r4   Ú<module>r“     sÄ  ðòó Û Û Û Û Û Û 
Û ß AÓ Aß &Ñ &ß .ã Ý +Ý "ß >Ý 7Ý 1ß A÷ñ ÷
ó ÷õ ÷ PÑ OÝ ÷ñ ÷
 ;Ý "å 1ñ ˆTƒ]€ñ "Ó#€à":€‡�× Ñ Ô Ø$.€‡�× Ñ Ô !Ø—‘×(Ñ(€ð€Ô ð +€Ô Ø8€Ô Ù 
ˆ>˜;Ô 'ò
Að $€Ô ñ Ø&�×&Ñ& {°W¸fÐ4EÓF�IòðI€	Ô òXò$òC÷( "ñ  "ôF&'Ð*ô &'ôb;-�ô ;-÷|+ñ +ô
	�Gô 	ò+÷>(ñ (ð'Øð'Ø14ð'à
‡X�X‡_�_ó'ò0 ò€N÷>?Cñ ?CóB &ˆò	Kñ 	Ð$ k°?ÕCð &ôTB�v¨õ TBôlU ô Uðz
 ,×4Ñ4×:Ñ:Ö<‰
ˆˆdÙ˜Œ~¡j°°xÔ&@ØØ�?‰?˜4Ô ¡G¨L¸$Ô$?Øñ 	�˜d DÕ)ð =ò
ò&#ÐòPñ % U§X¡X§_¡_Ö5‰ˆˆfØ�?‰?˜4Ô  D§M¡M°,Ô$?Øð Ð-×6Ñ6Ò6ØÐ7Ò7áÐ)¨6¯?©?¹JÀtÓ<LÕMñ 6÷ñ ô�u—x‘x—‘ô ô ô ò
$òN8ò
$ó $ð €	ˆ4Ó ð
 ØØ	ØLPñH=ð
 ˜$˜u™+ t¨H°d¸5±kÐ,AÑ'BÀDÐHÑIóH=ðZ ØØ(,ØLPñnØ	ðnàðnð ðnð �C�5˜#�:Ñ
 Ñ
%ð	nð
 ˜$˜u™+ t¨H°d¸5±kÐ,AÑ'BÀDÐHÑIðnð 	ónòjòò.ò6
ðR�2ð R˜"ó Ròj=ð —(‘(×*Ò*€Ù 
ˆ?˜KÔ (ñ@ˆ3ð @˜ð @ cð @°Só @÷<ñ <÷8"ñ "÷8)"ñ )"òXñ Ð"Ð$<Ô =Ù �-×,Ò,Ð.BÔ CÙ Ð$Ð&@Ô AÙ Ð*Ð,FÔ GÙ Ð-Ð/IÕ Jr6   