U
    9%eM                     @   sB  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Zd dlmZ d dlmZ d dlmZ d dlmZ d dlmZmZmZ d dlmZmZmZmZ d dlmZ e  d	d
Z!e  ddZ"ddddddddddddddddddgZ#dd  Z$d!d" Z%d#d$ Z&d%d& Z'd'd( Z(e)e*e+e,e-dej.ej/ej0fZ1d)d* Z2G d+d, d,ej3j4j5Z6d-d. Z7dad0d1Z8G d2d3 d3Z9e9 Z:d4d5 Z;d6d7 Z<dbd8d9Z=d:d; Z>dcd=d>Z?d?d@ Z@dAdB ZAdCdD ZBdEdF ZCdGdH ZDdIdJ ZEdKdL ZFdMdN ZGdOdP ZHdQdR ZIdSdT ZJdUdV ZKdWdX ZLdYdZ ZMd[d\ ZNd]d^ ZOd_d` ZPdS )d    N)DictListSetType)
fake_range)_find_builtin)AttributeTypeIsSupportedChecker)_add_script_class_get_script_class
_python_cu)get_class_propertiesget_default_argsget_jit_class_defget_jit_def)ModuleScriptMethodStub)resolution_callbackdef_original_methodPropertyStub)r   r   _version_parameters_buffersZ_non_persistent_buffers_setZ_backward_hooksZ_backward_pre_hooks_forward_hooksZ_forward_hooks_with_kwargs_forward_pre_hooksZ_forward_pre_hooks_with_kwargsZ_forward_hooks_always_calledZ_state_dict_hooksZ_state_dict_pre_hooksZ_load_state_dict_pre_hooksZ_load_state_dict_post_hooks_modules_initializingZdump_patchesc                 C   sF   t | }|sBt| | j}tjj| }tj||||}t	| | |S N)
r
   r   __name__torchjitZfrontendZget_default_args_for_class_CZ_jit_script_class_compiler	   )objrcbZqualified_nameZscript_classastdefaults r&   S/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/torch/jit/_recursive.py_compile_and_register_class7   s       
r(   c                 C   s$   t | }t| |dd}t||| S NRecursiveScriptModule	self_name)_jit_internal#createResolutionCallbackFromClosurer   r   )funcnamer#   r$   r&   r&   r'   	make_stubE   s    
r1   c                 C   s"   t | |}t|tr|S t||S r   )getattr
isinstancer   r1   )	nn_modulemethod_namer/   r&   r&   r'   make_stub_from_methodK   s    

	r6   c                 C   sD   g }t | D ]2}t| |d }t|tjjkr|t| | q|S r   )dirr2   r-   get_torchscript_modifierFunctionModifiersEXPORTappendr6   )modstubsr0   itemr&   r&   r'    make_stubs_from_exported_methodsZ   s    r?   c                 C   sH   t | dt }dd }|t| }t }|D ]}||kr,|| q,|S )N__jit_ignored_attributes__c                 S   s   dd t |  D S )Nc                 S   s   h | ]\}}t |tr|qS r&   )r3   property).0kvr&   r&   r'   	<setcomp>m   s     
 zGjit_ignored_properties.<locals>.get_properties_names.<locals>.<setcomp>)varsitems)moduler&   r&   r'   get_properties_namesl   s    z4jit_ignored_properties.<locals>.get_properties_names)r2   listtypesetadd)rH   !user_annotated_ignored_attributesrI   
propertiesZuser_annoted_ignored_propertiesZignored_attrr&   r&   r'   jit_ignored_propertiesg   s      rP   c                    s~   t |tr|S t |ttfr4t fdd|D S ddd tD }ttdt	t
| d d  d| d		d S )
Nc                 3   s   | ]}t  |V  qd S r   )_get_valid_constant)rB   xattr
owner_typer&   r'   	<genexpr>   s     z&_get_valid_constant.<locals>.<genexpr>z, c                 s   s   | ]}t |V  qd S r   )r   typename)rB   typr&   r&   r'   rV      s     z

        'z' object in attribute '.zo' is not a valid constant.
        Valid constants are:
        1. a nn.ModuleList
        2. a value of type {z,}
        3. a list or tuple of (2)
        )r3   _constant_typestuplerJ   join	TypeErrortextwrapdedentr   rW   rK   )rT   rD   rU   	constantsr&   rS   r'   rQ      s$    
rQ   c                       s   e Zd Z fddZ  ZS )SourceContextc                    s   t  |||| d S r   )super__init__)selfsourcefilenameZfile_linenoZleading_whitespace_len	__class__r&   r'   rc      s    zSourceContext.__init__)r   
__module____qualname__rc   __classcell__r&   r&   rg   r'   ra      s   ra   c                    sR   t jdk rt| di S t| }|r(|S  fdd t| trB| nt| } |S )N)   
   __annotations__c                    s6   t | }|r|S | jD ]} |}|r|  S qi S r   )inspectget_annotations	__bases__)clscls_annotationsbaseget_cls_annotationsr&   r'   rv      s    


z,get_annotations.<locals>.get_cls_annotations)sysversion_infor2   ro   rp   r3   rK   )r"   annotationsrr   r&   ru   r'   rp      s    


rp   Tc                    sH  t jt| }t| t jjr&|  t| t jjt jj	frD|
  t| t jjrZ|  t| t jjrp|  t|  t| t jjjri  t| dt }|| t| } fdd}t }| j D ]V\}}||krq|dkst|t jst|||\}	}
|||	 dd || q| j D ]`\}}||kr@q*|dks\t|t js\t|||\}	}
|||	 dd || q*| j D ]\}}||krq|||\}	}
|dkr|||	 dd q|	  r|	 ! stt jj"#|	 }n
t$||}|%|| || qtt| dd}  D ]"\}}t j&'|rH|| qH|D ]}||kr|| jkrd	}n,|| jkrd
}n|| jkrd}ntdt()d| d| d qpt*| |st()d| d qpt| |}|+|t,||t| j- || qpt| di }|.t/t0| | | D ]\}}|1|| qT| j2 D ]\}}|t3ksv|4drqv||krqv||krqvt|t j5j6}|r|j7}t89|rFz*t j:;|}|<|t j=| | W n: t>k
r@ } zd| }|?|| W 5 d}~X Y nX qvt@|}|rd|A|| qvt|t j:jBr|<|t j=| | qv|||\}	}|	  r|||	 dd nH|rdnd}|	C  d| }dt Dt| d| d}|?|| qv| jEF D ]}|G| q| jHF D ]}|I| q2|S )z
    Build a ConcreteModuleTypeBuilder from an nn.Module. This
    ConcreteModuleType doesn't have a JIT type associated with it yet, it
    must be filled in by the caller.
    r@   c              
      s   d}z|  krH |  t jjjd krHt jj |  t }t j	|}n@t
|t jjrxt jj|jt }t j	|}nt j|}d}W n> tk
r } z td|  d| d| |W 5 d }~X Y nX ||fS )NFforwardTzError inferring type for z: )r   nnr   rn   r    ry   ann_to_typer   r!   ZInferredTyper3   	AttributerK   _jit_try_infer_typeRuntimeError)r0   r>   inferredr|   	attr_typereZclass_annotationsr&   r'   
infer_type   s*     .z/infer_concrete_type_builder.<locals>.infer_typeNTFZ__constants__r&   	submodulebuffer	parameterz3added_names must be submodule, parameter, or buffer'zA' was found in ScriptModule constants,  but it is a non-constant z. Consider removing it.zb' was found in ScriptModule constants, but was not actually set in __init__. Consider removing it.__overloads____z(This function exists as an attribute on the Python module, but we failed to compile it to a TorchScript function. 
The error stack is reproduced here:
zFIts type was inferred; try adding a type annotation for the attribute. z. zT(This attribute exists on the Python module, but we failed to convert Python type: 'z' to a TorchScript type. ))Jr   r!   ZConcreteModuleTypeBuilderrK   r3   r{   
ModuleDictZset_module_dict
ModuleList
SequentialZset_module_listZParameterListZset_parameter_listZParameterDictZset_parameter_dictrp   ZaoZquantizationZQuantWrapperr2   rJ   Zadd_ignored_attributesrP   rL   r   rG   ZTensorAssertionErrorZadd_attributerM   r   r   successZis_interface_typeConcreteModuleTypefrom_jit_typeget_module_concrete_typeZ
add_moduler-   is_finalwarningswarnhasattrZadd_constantrQ   r   updateget_overload_name_mappingget_overload_annotationsZadd_overload__dict__ignored_attributes
startswithZ_opsZOpOverloadPacketopro   
isfunctionr    scriptZadd_function_attributer~   	ExceptionZadd_failed_attributer   Zadd_builtin_functionZScriptFunctionreasonrW   r   valuesZadd_forward_hookr   Zadd_forward_pre_hook)r4   share_typesconcrete_type_builderrN   ignored_propertiesr   Zadded_namesr0   r>   r   _sub_concrete_typeZconstants_setannhintvalue	overloadsZoverloaded_namesZisoverloadpacketZscripted_fneZbuiltin_symbol_namer   Zinferred_msgZadditional_infohookpre_hookr&   r   r'   infer_concrete_type_builder   s     








 

    
r   c                   @   sJ   e Zd ZU eee eejj	 f e
d< eejj	 e
d< dd Zdd ZdS )ConcreteTypeStore
type_storemethods_compiledc                 C   s   i | _ t | _d S r   )r   rL   r   )rd   r&   r&   r'   rc     s    zConcreteTypeStore.__init__c                 C   sf   t |}t|}|| jkr$g | j|< | j| }|D ]}||r2|  S q2| }| j| | |S )z|
        Infer a ConcreteType from this `nn.Module` instance. Underlying JIT
        types are re-used if possible.
        )r   rK   r   equalsbuildr;   )rd   r4   r   Znn_module_typeZknown_typesZ
known_typeconcrete_typer&   r&   r'   get_or_create_concrete_type  s    




z-ConcreteTypeStore.get_or_create_concrete_typeN)r   ri   rj   r   r   r   r   r   r!   r   rn   r   rc   r   r&   r&   r&   r'   r     s   
r   c                 C   s\   dd |D }dd |D }dd |D }dd |D }dd |D }|  ||||| d S )Nc                 S   s   g | ]
}|j qS r&   r   rB   mr&   r&   r'   
<listcomp>  s     z<create_methods_and_properties_from_stubs.<locals>.<listcomp>c                 S   s   g | ]
}|j qS r&   r   r   r&   r&   r'   r     s     c                 S   s   g | ]}t |jqS r&   )r   r   r   r&   r&   r'   r     s     c                 S   s   g | ]
}|j qS r&   r   rB   pr&   r&   r'   r     s     c                 S   s   g | ]
}|j qS r&   r   r   r&   r&   r'   r     s     )Z_create_methods_and_properties)r   method_stubsproperty_stubsZmethod_defsZmethod_rcbsZmethod_defaultsZproperty_defsZproperty_rcbsr&   r&   r'   (create_methods_and_properties_from_stubs  s        r   c                 C   sL   dd |D }dd |D }dd |D }dd |D }|  |||| d S )Nc                 S   s   g | ]
}|j qS r&   r   rB   hr&   r&   r'   r     s     z+create_hooks_from_stubs.<locals>.<listcomp>c                 S   s   g | ]
}|j qS r&   r   r   r&   r&   r'   r     s     c                 S   s   g | ]
}|j qS r&   r   r   r&   r&   r'   r     s     c                 S   s   g | ]
}|j qS r&   r   r   r&   r&   r'   r     s     )Z_create_hooks)r   
hook_stubspre_hook_stubsZ	hook_defsZ	hook_rcbsZpre_hook_defsZpre_hook_rcbsr&   r&   r'   create_hooks_from_stubs  s
    r   c                 C   sZ   t | tstt | tjjr,t| dr,| jS |r<t	| }nt
| |}|  | }|S )a  
    Gets a concrete type for nn_modules. If share_types is True, the concrete
    type is fetched from concrete_type_store. If it is False, a new concrete type
    is created without first searching concrete_type_store.

    Args:
        nn_module:  The original Python nn.Module that we are creating a ScriptModule for.
        share_types = Whether to share underlying JIT types between modules (if possible).

    Returns:
        A concrete type for nn_module.
    _concrete_type)r3   r   r   r   r    ScriptModuler   r   concrete_type_storer   r   Zset_poisonedr   )r4   r   r   r   r&   r&   r'   r     s     
r   c                 C   sj   t t| }t t| }tt| || t|}tj	|}| j
 D ]\}}||| qLt|S )z
    Create and return a RecursiveScriptClass instance from a Python object.

    Arguments:
        obj: A Python object.
    )r-   _qualified_namerK   Z'createResolutionCallbackForClassMethodsr(   r   Z	get_classr   r!   Z_create_object_with_typer   rG   setattrwrap_cpp_class)r"   Zqualified_class_namer#   Zclass_tyZ
cpp_objectr0   r   r&   r&   r'   create_script_class  s    
r   Fc                 C   s@   t | tjjrtt|  t| |}|s4t |  t	| ||S )a  
    Creates a new ScriptModule from an nn.Module

    Args:
        nn_module:  The original Python nn.Module that we are creating a ScriptModule for.
        stubs_fn:  Lambda that takes an nn.Module and generates a list of ScriptMethodStubs to compile.
        share_types:  Whether to share underlying JIT types between modules (if possible).
            NOTE: Only set to False this when we cannot guarantee type sharing will work
                correctly. This only happens today for traced modules, where the same
                module can produce different traced methods depending on the inputs.
        is_tracing: Whether this function is called during tracing or scripting. If tracing,
                we don't need to do AttributeTypeIsSupportedChecker because all the unsupported
                attributes will be baked as constant in the tracing graph. In addition,
                this check significantly slows down the traced modules when the module size is big.
    )
r3   r   r    r*   r   check_module_initializedr   r   checkcreate_script_module_impl)r4   stubs_fnr   
is_tracingr   r&   r&   r'   create_script_module  s    
r   c                    s  t j j}t}t\}}tdt }t fdd}t j	j
|}	 tjkrt || t || t j tj  t|	j D ]\}
}||	j|
< qt|	j D ]\}
}||	j|
< qtt jjt jjt jjfr$d kr$|	dt d tt jjr~d kr~t  rtt!t  }|	d| d n
|	d	 |D ]X}|j"d
krq|j"j#}||j$% j%krq&|}t'(|j"|}||	j)|< q|D ]V}|j$% j%}&|j$* j%}|j$+ }|r&|j%nd
}t,||||	j)|< qt-D ]@}|krRq@t|d
}t./|t.j0j1kr@t2|	| q@|	S )aR  
    Convert an nn.Module to a RecursiveScriptModule.

    Args:
        nn_module:  The original Python nn.Module that we are creating a ScriptModule for.
        concrete_type:  The fully initialized ConcreteType of the module.
        stubs_fn:  Lambda that takes an nn.Module and generates a list of ScriptMethodStubs to compile.
    r@   c           	         sN      D ]2}t|}t|tjjr.|jn|}|| q 	 D ]\}}t|}t|t
svtdt| |j}t|tjjrt||}n t|tjjr|}nt||}|| || j|< qHtD ]l}|krqt|d }t|r,t|r,t|j}|| }t| || qֈ |rt| || qֈ | _d S )NzExpected Module but got )Zget_attributeskeysr2   r3   r   r    r}   r   r   Zget_modulesr   r   rK   jit_typer!   ZInterfaceTypeinterface_scriptr   r   r   r7   ro   ismethodr-   is_ignored_fn__func____get__Zis_ignored_attributer   )	script_moduler0   Z
orig_valuer   module_typeZscriptedr>   Zunbound_functionZbound_methodr   
cpp_moduler   r4   r   r&   r'   init_fnE  sL    

   

z*create_script_module_impl.<locals>.init_fn__len__zdef __len__(self):
   return 
__contains__z3def __contains__(self, key: str):
   return key in z2def __contains__(self, key: str):
   return False
N)3r   r!   Z_create_module_with_typer   get_property_stubsget_hook_stubsr2   rJ   rP   r    r*   
_constructr   r   r   r   Z_run_emit_module_hookrM   	enumerate_c_get_forward_pre_hooksr   _get_forward_hooksr   r3   r{   r   r   r   Z_method_namesZdefinelenr   reprr   r   r   r0   Z_get_method	functoolswrapsr   Zgetter_namesetter_namerA   r7   r-   r8   r9   ZCOPY_TO_SCRIPT_WRAPPER!add_python_attr_to_scripted_model)r4   r   r   r   r   r   r   rN   r   r   idxfnr   Zmethod_stubr0   Zscript_methodZwrapped_script_methodZproperty_stubZproperty_namefgetr   fsetr>   r&   r   r'   r   2  s    	  3
   







r   c                 C   s<   t | |d }|d krdS t tjj|d }|d kr4dS ||kS )NF)r2   r   r    r*   )script_modelrT   Zscript_attrZdefault_attrr&   r&   r'   script_model_defines_attr  s    r   c                 C   s*   t ||r&t| |r&t| |t|| d S r   )r   r   r   r2   )r   origrT   r&   r&   r'   r     s    r   c                    s   i }t t| D ]  |krqt|  d }t|s4qt|dr|jd k	rt|| j}|d kr`q|j	|kr|t
td|j	 fddtt|D }tt||||< q|S )Nri   methodc                    s   g | ]} d  t | qS )r   )str)rB   ir0   r&   r'   r     s     z,get_overload_annotations.<locals>.<listcomp>)r7   rK   r2   callabler   ri   r-   Z_get_overloaded_methodsrh   r   r   Z,get_overload_no_implementation_error_messageranger   rJ   zip)r<   rP   r   r>   Zmethod_overloadsnamesr&   r   r'   r     s0     
 r   c                 C   sL   i }|   D ]:\}}|j}||kr*g ||< |D ]\}}|| | q.q|S r   )rG   r   r;   )overload_infooverload_name_mappingsorig_fnr   original_nameoverload_namer   r&   r&   r'   r     s    r   c                 C   s@   t jj| d t t| }|d kr<t| }t	d| d S )Nz>Must explicitly add type annotations to overloaded functions: )
r   r    ry   Zget_signaturer   ro   r   r-   r   r   )r/   	signatureZ	qual_namer&   r&   r'   _check_no_signature  s       
r  c           
      C   s   g }|   D ]n\}}t||jdd}|D ]P\}}t| t||jdd}tj| ||}t	|}	|
t|	|| q(q|S r)   )rG   r   r   r  r   r!   Z_replace_overloaded_method_decldeclr-   r.   r;   r   )
r   overload_stubsr  r   Zorig_astr  Zoverload_fnZover_astZnew_ast_rcbr&   r&   r'   make_stubs_for_overloads  s,          
r
  c                 C   s   t | tjjstt| ds6tdtt|  dt| ds| j	
 D ]8\}}|d k	rJtjj|rJtdtt| |qJ| j
 D ]8\}}|d k	rtjj|rtdtt| |qd S )Nr   r   z=' has not been initialized, did you forget to call 'super()'?Zremote_parameterszK'{}' has uninitialized parameters {}. Did you forget to run a forward pass?zH'{}' has uninitialized buffers {}. Did you forget to run a forward pass?)r3   r   r{   r   r   r   r   rW   rK   r   rG   r   Zis_lazyformatr   )r<   r0   parambufr&   r&   r'   r   0  s,    

  r   c                    s\  t |  t| dt }t| }g }t| drdt| jsdt| jdd}ttj	j
dd}||krddg}g }t| D ]6}||kr~qpt| |d}t|tjjkrp|| qp|| }tt| di  t| |}	 t|	 t|	}
 | _ fdd}t||}t }g }|D ](}||krq
|| || q
g }|D ]}|t| | q<|
| S )z
    Implements the default rules for which methods should act as starting
    points for compilation (TODO add a link when the rules are published).
    r@   rz   r   Nr   c                    s   |  kS r   r&   )r5   r  r&   r'   ignore_overloadedr  s    z3infer_methods_to_compile.<locals>.ignore_overloaded)r   r2   rJ   rP   r   r-   r   rz   r   r{   r   r7   r8   r9   r:   r;   dictr   r   r   r
  r   filterrL   rM   r6   )r4   rN   r   methodsZforward_funcZmodule_forwardZexportedr0   r>   r   r  r  Zfiltered_methodsZuniquerZuniqued_methodsr=   r   r&   r  r'   infer_methods_to_compileI  sX      



r  c                 C   s   t |  i }g }| j D ]`}|j|kr^t|t||j krhtd|j dt| j dn
|||j< |t||j qg }| j	 D ]`}|j|krt|t||j krtd|j dt| j dn
|||j< |t||j q||fS )z=
    Returns forward hook and pre_hook ScriptModuleStubs
    zHook 'z' on zV has at least two different python definitions. Please use unique names for all hooks.z
Pre-hook ')
r   r   r   r   idr   rK   r;   r1   r   )r4   Zhook_mapr   r   r   r   r&   r&   r'   r     s*    



r   c                    s   t | }t|dd}i  t|D ]H}t||d}t|tr |jsXtd| d| j dt	
|j |< q  fdd|D }|S )	zx
    Create property stubs for the properties of the module by creating method
    stubs for the getter and setter.
    r*   r+   Nz	Property z of z must have a getterc                    s    g | ]}t  | j |qS r&   )r   r0   )rB   r$   Zrcbsr&   r'   r     s     z&get_property_stubs.<locals>.<listcomp>)rK   r   r7   r2   r3   rA   r   r   r   r-   r.   )r4   Z	module_tyZproperties_astsr0   r>   r=   r&   r  r'   r     s    
r   c                    s0   t |tjjr|S t|  fdd}t||S )a%  
    Makes a ScriptModule from an nn.Module, using the interface methods rule for
    determining which methods to compile.

    Args:
        mod_interface: the interface type that the module have
        nn_module:  The original Python nn.Module that we are creating a ScriptModule for.
    c                    s&   g }   D ]}|t| | q|S )z
        Rule to infer the methods from the interface type to know which
        methods need to act as starting points for compilation.
        )ZgetMethodNamesr;   r6   )r4   r=   r   mod_interfacer&   r'   "infer_interface_methods_to_compile  s    z<interface_script.<locals>.infer_interface_methods_to_compile)r3   r   r    r   r   r   )r  r4   r  r&   r  r'   r     s
    	
r   c                 C   sd   t | rd S t| tjjr d S t| sJt| sJt	d|  d|  dt 
| }tjj| |dS )N`z|` is not a function. Recursive scripting only supports Python functions or methods currently.
Consider manually annotating `z` with @torch.jit.script.)r	  )r-   r   r3   r   r{   r   ro   r   r   r   r.   r    r   )r   locr#   r&   r&   r'   try_compile_fn  s    
	
r  c                 C   s   t j| S )zE
    Wrap this torch._C.Object in a Python RecursiveScriptClass.
    )r   r    ZRecursiveScriptClass)Z	cpp_classr&   r&   r'   r     s    r   c                 C   s   dd }t jj| |S )zb
    Wrap this torch._C.ScriptModule in a Python ScriptModule, recursively for all submodules
    c                 S   s   t j| j D ]\}}t| |t| qt jj| j	 | _
t| j D ]\}}|| j|< qPt| j D ]\}}|| j|< qrd S r   )r   r!   r   r   rG   r   wrap_cpp_moduler   r   _typer   r   r   r   r   r   )r   r0   r   r   r   r&   r&   r'   r     s    z wrap_cpp_module.<locals>.init_fn)r   r    r*   r   )r   r   r&   r&   r'   r    s    r  c              	   C   sB   t |rd S t||j}tj   t| |fd W 5 Q R X |S )Nr&   )r-   r   r1   r   r   Z_disable_emit_hooksr   )r   r   Zstubr&   r&   r'   compile_unbound_method  s    
r  c                    s.    fdd}|_ j|_tj| |S )z
    Returns a function that lazily binds `unbound_method` to a provided
    Module IValue, then invokes the method. We do this so that any Python
    shenanigans that will poison type sharing are impossible at compile
    time.
    c                    s0    fdd}t jj| |}t|}|| S )Nc                    s\    j }t|D ]&}t||d }t|rt| || q   D ]\}}t| || qBd S r   )Zpy_classr7   r2   r-   r   r   Zget_constantsrG   )r   Z
orig_classr0   r>   r   )r   r&   r'   r   $  s    
z7lazy_bind.<locals>.lazy_binding_method.<locals>.init_fn)r   r    r*   r   types
MethodType)r   argsr   r   r   r   unbound_methodr&   r'   lazy_binding_method#  s    z&lazy_bind.<locals>.lazy_binding_method)Zoriginal_fnr   r   r-   Zcopy_torchscript_modifier)r   r#  r$  r&   r"  r'   	lazy_bind  s
    r%  )T)T)TF)Qcollectionsr   ro   rw   r^   r  r   typingr   r   r   r   r   Ztorch._jit_internalr-   Ztorch._sourcesr   Ztorch.jit._builtinsr   Ztorch.jit._checkr   Ztorch.jit._stater	   r
   r   Ztorch.jit.frontendr   r   r   r   Ztorch.nnr   
namedtupler   r   r   r(   r1   r6   r?   rP   boolfloatintr   rK   ZdeviceZlayoutZdtyperZ   rQ   r!   Z_jit_tree_viewsZSourceRangeFactoryra   rp   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r
  r   r  r   r   r   r  r   r  r  r%  r&   r&   r&   r'   <module>   s    
 o!

 
 $
 >$