/usr/local/lib64/python3.6/site-packages/torch/nn/__pycache__
NameSizeModeActions
common_types.cpython-36.pyc9900644editdlrm
cpp.cpython-36.pyc34600644editdlrm
functional.cpython-36.pyc1616480644editdlrm
grad.cpython-36.pyc118400644editdlrm
init.cpython-36.pyc175510644editdlrm
parameter.cpython-36.pyc75680644editdlrm
_reduction.cpython-36.pyc12440644editdlrm
__init__.cpython-36.pyc20020644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/nn/__pycache__/cpp.cpython-36.pyc (3460B)
3 ûEgÎ ã@s6dZddlmZGdd„deƒZGdd„dejƒZdS)z3Functionality for Python <-> C++ frontend inter-op.é)Únnc@s\eZdZdZdd„Zedd„ƒZdd„Zdd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dS)ÚOrderedDictWrapperaª A wrapper around a C++ OrderedDict that dynamically evaluates the OrderedDict getter on a bound C++ module, such that new changes on the C++ side are picked up. Otherwise accessing e.g. ``cpp_module._parameters`` just once would get a frozen copy of the parameters at the time of access. ``torch.nn.Module`` accesses ``_parameters`` et al. via ``self.__dict__`` so using properties does not work. cCs||_||_dS)N)Ú cpp_moduleÚattr)Úselfrr©rú8/usr/local/lib64/python3.6/site-packages/torch/nn/cpp.pyÚ__init__szOrderedDictWrapper.__init__cCst|j|jƒS)N)Úgetattrrr)rrrrÚcpp_dictszOrderedDictWrapper.cpp_dictcCs |jjƒS)N)r Úitems)rrrrr szOrderedDictWrapper.itemscCs |jjƒS)N)r Úkeys)rrrrr szOrderedDictWrapper.keyscCs |jjƒS)N)r Úvalues)rrrrr!szOrderedDictWrapper.valuescCs |jjƒS)N)r Ú__iter__)rrrrr$szOrderedDictWrapper.__iter__cCs |jjƒS)N)r Ú__len__)rrrrr'szOrderedDictWrapper.__len__cCs |jj|ƒS)N)r Ú __contains__)rÚkeyrrrr*szOrderedDictWrapper.__contains__cCs |jj|ƒS)N)r Ú __getitem__)rrrrrr-szOrderedDictWrapper.__getitem__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r Úpropertyr r r rrrrrrrrrrs rcsJeZdZdZ‡fdd„Zdd„Zedd„ƒZejdd„ƒZd d „Z ‡Z S) Ú ModuleWrapperzj A subclass of ``torch.nn.Module`` that wraps a C++ frontend module and delegates all access. csl||_tt|ƒjƒt|dƒ|_t|dƒ|_t|dƒ|_x.t|ƒD]"}|j dƒsBt ||t |j|ƒƒqBWdS)NÚ _parametersÚ_buffersÚ_modulesÚ_) rÚsuperrr rrrrÚdirÚ startswithÚsetattrr )rrr)Ú __class__rrr 7s    zModuleWrapper.__init__cCsZx6|jƒD]*}||jƒ|_|jdk r ||jjƒ|j_q Wx|jƒD]}||jƒ|_qBW|S)N)Ú parametersÚdataZ_gradÚbuffers)rÚfnÚparamÚbufrrrÚ_applyDs  zModuleWrapper._applycCs|jjS)N)rÚtraining)rrrrr*RszModuleWrapper.trainingcCs|jj|ƒdS)N)rZtrain)rÚmoderrrr*VscCs |jjƒS)N)rÚ__repr__)rrrrr,ZszModuleWrapper.__repr__) rrrrr r)rr*Úsetterr,Ú __classcell__rr)r"rr1s   rN)rZtorchrÚobjectrÚModulerrrrrÚs +