/usr/local/lib64/python3.6/site-packages/torch/jit/__pycache__
NameSizeModeActions
annotations.cpython-36.pyc127740644editdlrm
frontend.cpython-36.pyc344800644editdlrm
quantized.cpython-36.pyc185170644editdlrm
supported_ops.cpython-36.pyc82240644editdlrm
unsupported_tensor_ops.cpython-36.pyc22950644editdlrm
_async.cpython-36.pyc40560644editdlrm
_builtins.cpython-36.pyc49660644editdlrm
_check.cpython-36.pyc61010644editdlrm
_freeze.cpython-36.pyc88310644editdlrm
_fuser.cpython-36.pyc27810644editdlrm
_logging.cpython-36.pyc3710644editdlrm
_monkeytype_config.cpython-36.pyc69840644editdlrm
_pickle.cpython-36.pyc8350644editdlrm
_recursive.cpython-36.pyc254780644editdlrm
_script.cpython-36.pyc485820644editdlrm
_serialization.cpython-36.pyc59120644editdlrm
_state.cpython-36.pyc37030644editdlrm
_trace.cpython-36.pyc352480644editdlrm
__init__.cpython-36.pyc65480644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/jit/__pycache__/annotations.cpython-36.pyc (12774B)
3 Eg>@sddlZddlZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZddlmZmZmZddlmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0dd l1m2Z2dd l3m4Z4ej5j6j7r:dd lm8Z8m9Z9dd lm:Z:Gd dde;ZddZ?ddZ@ddZAddZBddZCddZDdd ZEd!d"ZFe4ejGd#d$d%ZHd&d'ZId(d)ZJd*d+ZKd,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@ddddddd d"d)d+gZLdS)AN)ListTupleis_tupleis_listDictis_dictOptional is_optional_qualified_nameAnyFuture is_future is_ignored_fnUnionis_union)BroadcastingList1BroadcastingList2BroadcastingList3)_get_script_class) TensorType TupleType FloatTypeIntType ComplexTypeListType StringTypeDictTypeBoolType OptionalType InterfaceTypeAnyTypeNoneType DeviceObjType StreamObjType FutureTypeEnumType UnionType)dedent)get_source_lines_and_file)Type)RRefis_rref)RRefTypec@seZdZddZddZdS)ModulecCs||_||_dS)N)namemembers)selfr0r1r3A/usr/local/lib64/python3.6/site-packages/torch/jit/annotations.py__init__szModule.__init__c Cs<y |j|Stk r6td|jd|dYnXdS)NzModule z has no member called )r1KeyError RuntimeErrorr0)r2r0r3r3r4 __getattr__ s zModule.__getattr__N)__name__ __module__ __qualname__r5r8r3r3r3r4r/sr/c @sLeZdZeddejiejeddeieeee e e d Z ddZ dd Zd S) EvalEnvtorchTensortypingr) r=r>r?rrrr rr cCs ||_tjjjrt|jd<dS)Nr,)rcbr= distributedrpc is_availabler,env)r2r@r3r3r4r54s zEvalEnv.__init__cCs4||jkr|j|S|jdk r(|j|Stt|dS)N)rDr@getattrbuiltins)r2r0r3r3r4 __getitem__9s     zEvalEnv.__getitem__N)r9r:r;r/r=r>rrrr rr rDr5rGr3r3r3r4r<'s r<c Cst||}|dk r2|r2|\}}|dd}||f}|dkrd\}}y"tdjt|d}t|}Wntk rxYnX|dk rt|||}|S)Nrr)NN)try_real_annotationsr)joinr* get_type_line TypeErrorparse_type_line) fnr@locZ is_method signatureZ param_types return_type type_linesourcer3r3r4 get_signature@s     rTcCstj|ptj|S)N)inspect isfunctionismethod) the_callabler3r3r4is_function_or_methodZsrYcCs:t| rt|dr|j}t|r2tj|jdk SdSdS)N__call__F)rYhasattrrZrUgetfullargspecvarargs)rXr3r3r4 is_vararg`s r^cCs`t| r$t|dr$t|jr$|j}t|rJt|r>tj|}tj|jSddt|DSdS)NrZcSsg|] }t|qSr3)str).0ir3r3r4 xsz#get_param_names..) rYr[rZrrUunwrapr\argsrange)rNZn_argsr3r3r4get_param_namesls  rfc Csytdjt|d}Wnttfk r2dSX|dkr@dStj|}t|jdkrt |jdtj rt j j j|d|jdjdt|jdkst |jdtj rt j j j|ddS)NrHrrzCannot instantiate class 'z' in a script functionz$Expected a single top-level function)r)rJr*rLIOErrorastparselenbody isinstanceClassDefr=jitZfrontendZ FrontendErrorr0 FunctionDef)rNrOrSZpy_astr3r3r4check_fn{s  "rpc st|\}}yt|it|}Wn0ttfk rP}ztd|WYdd}~XnXt|tsb|f}yt|it|}Wn0ttfk r}ztd|WYdd}~XnXfdd|D}|t|fS)zParses a type annotation specified as a comment. Example inputs: # type: (Tensor, torch.Tensor) -> Tuple[Tensor] # type: (Tensor, Tuple[Tensor, Tensor]) -> Tensor z6Failed to parse the argument list of a type annotationNz4Failed to parse the return type of a type annotationcsg|]}t|qSr3) ann_to_type)r`ann)rOr3r4rbsz#parse_type_line..) split_type_lineevalr< NameError SyntaxErrorr7rltuplerq) rRr@rOZ arg_ann_strZ ret_ann_strZarg_anneZret_ann arg_typesr3)rOr4rMs  rMc sld|jd}ddt|D}ttfdd|}tjdttfdd|}t|d krtjd ttfd d|}t|d krtd t|d d d dddSt|dkr|d dj Sd}g}x6|D].\}}d|kr||f}Pq|kr|j |qW|dkr.cs |dkS)Nrr3)r|) type_commentr3r4szget_type_line..z!# type:\ ignore(\[[a-zA-Z-]+\])?$csj|d S)Nr)search)r|) type_patternr3r4r~srz&#[ ]*type[ ]*(?!: ignore(\[.*\])?$):csj|dS)Nr)r)r|)wrong_type_patternr3r4r~szThe annotation prefix in line z* is probably invalid. It must be '# type:'zl See PEP 484 (https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code)z for examplesNrz# type: (...) -> z_Return type line '# type: (...) -> ...' not found on multiline type annotation for type lines: cSsg|] }|dqS)rr3)r`r|r3r3r4rbszl (See PEP 484 https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code)cs"||jtd}|jS)N)findrjstrip)r|Z item_type)r}r3r4get_parameter_typesz)get_type_line..get_parameter_typez, z...)split enumeratelistfilterrecompilerjr7r_rappendrJmapreplace) rSlinesZ type_linesZwrong_type_linesZ return_lineZparameter_type_linesr{r|rtypesZparameter_typesr3)r}rrr4rKs@     "     rKc CsZtd}y|jd}Wntk r4tddYnX|||j||ddjfS)aSplits the comment with the type annotation into parts for argument and return types. For example, for an input of: # type: (Tensor, torch.Tensor) -> Tuple[Tensor, Tensor] This function will return: ("(Tensor, torch.Tensor)", "Tuple[Tensor, Tensor]") z# type:z->z3Syntax error in type annotation (cound't find `->`)Nr)rjindex ValueErrorr7r)rRZ start_offsetZ arrow_posr3r3r4rss rsc sytj|Wntk r"dSXjgddjjD}tfdd|DrZdSfddjjD}tj}||fS)z:Tries to use the Py3.5+ annotation syntax to get the type.NcSsg|] }|jqSr3) annotation)r`pr3r3r4rbsz(try_real_annotations..c3s|]}|jkVqdS)N)empty)r`rr)sigr3r4 sz'try_real_annotations..csg|]}t|jqSr3)rqr)r`r)rOr3r4rbs)rUrPrreturn_annotation parametersvaluesallrq)rNrOZ all_annotsryrQr3)rOrr4rIs  rI)rxcsJt|}|std|jddd|D}fdd|D}tjj|S)NzNo enum values defined for: ''cSsh|]}t|jqSr3)typevalue)r`vr3r3r4 sz&get_enum_value_type..csg|]}t|qSr3)try_ann_to_type)r`t)rOr3r4rbsz'get_enum_value_type..)rr __class__r=_CZunify_type_list)rxrOZ enum_valuesrZir_typesr3)rOr4get_enum_value_type s rc CsPt|tjrdSt|tjtjtjtjtjtjtj tj tj f rLt j ddSdS)NTzTorchScript will treat type annotations of Tensor dtype-specific subtypes as if they are normal Tensors. dtype constraints are not enforced in compilation either.F) issubclassr=r>Z LongTensorZ DoubleTensorZ FloatTensorZ IntTensorZ ShortTensorZ HalfTensorZ CharTensorZ ByteTensorZ BoolTensorwarningswarn)rrr3r3r4 is_tensors   rcs|tjjkrtjS|dkr$tjStj|r>t|r>tjSt |rt |j dkrj|j dfkrjt gSt fdd|j DSt |rt|j d}|rt|St|r(t|j d}t|j d}|dkrtd|j ddj|dkrtd|j ddjt||St|rt|j dtdrT|j d}n |j d}t|}d}|st|jt|t|t|St|rg}x^|j D]T} | dkr|jtjt| } d}| st|jt|t| |j| qWt|Stjj j!r4t"|r4t#t|j dSt$|rRt%t|j dS|t&krdt'jS|t(krvt)jS|t*krt+jS|t,krt-jS|t.krt/jS|t0krt1jS|tdkrtjStj|rt2|drt3|j4S|tj5kr t6jS|tj7krt8jS|tj9kr2t+jStj|rt|t:j;rt<|dkrttj=j>j?|} | j@} ntA|} tB| tC|tD|Stj|rt<|} | dk r| StjEjF|rtj=j>j?|Sd d }tjGjH||S) Nrrcsg|]}t|qSr3)r)r`a)rOr3r4rb5sz#try_ann_to_type..zUnknown type annotation: 'z' at zQUnsupported annotation {} could not be resolved because {} could not be resolved.__torch_script_interface__cSsdS)Nr3)keyr3r3r4fake_rcbsz!try_ann_to_type..fake_rcb)IrU SignaturerrZ getInferredr#getisclassrrrj__args__rrrrrr highlightrr rrAssertionErrorformatreprr rrr(r=rArBrCr-r.rr&floatrcomplexrintrr_rboolrr r"r[r!rZdevicer$ZStreamr%ZdtypeenumEnumrrn_scriptZ_recursive_compile_classZqualified_namer r'rr _jit_internalZcan_compile_classrZ_resolve_type_from_object)rrrOZ elem_typerrZ containedZ valid_typemsginnerrZ maybe_typeZscripted_classr0Zmaybe_script_classrr3)rOr4r*s                          rcCs2t||}|dk r|Std|d|jdS)NzUnknown type annotation: 'z' at )rrr)rrrOZthe_typer3r3r4rqs rqr rrrrrrrrrr rrrrrrrrrr")MrhrrUrrFr=rrrrrrrrr r r r r rrrrrrr_staterZtorch._Crrrrrrrrrr r!r"r#r$r%r&r'r(textwrapr)Ztorch._sourcesr*r?r+rArBrCr,r-r.objectr/r<rTrYr^rfrprMrKrsrIrrrrrq__all__r3r3r3r4s|D P      >]