/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__/parameter.cpython-36.pyc (7568B)
3 Eg@srddlZddlmZddlmZGdddejZGdddZdd ZGd d d eeZ Gd d d eejZ dS)N)_disabled_torch_function_impl) OrderedDictcs>eZdZdZd ddZddZfdd Zd d ZeZ Z S) ParameteraJA kind of Tensor that is to be considered a module parameter. Parameters are :class:`~torch.Tensor` subclasses, that have a very special property when used with :class:`Module` s - when they're assigned as Module attributes they are automatically added to the list of its parameters, and will appear e.g. in :meth:`~Module.parameters` iterator. Assigning a Tensor doesn't have such effect. This is because one might want to cache some temporary state, like last hidden state of the RNN, in the model. If there was no such class as :class:`Parameter`, these temporaries would get registered too. Args: data (Tensor): parameter tensor. requires_grad (bool, optional): if the parameter requires gradient. See :ref:`locally-disable-grad-doc` for more details. Default: `True` NTcCs"|dkrtjg}tjj|||S)N)torchtensorTensor_make_subclass)clsdata requires_gradr >/usr/local/lib64/python3.6/site-packages/torch/nn/parameter.py__new__s zParameter.__new__cCsHt||kr|t|St||jjtjd|j}||t|<|SdS)N)Z memory_format)idtyper clonerZpreserve_formatr )selfmemoresultr r r __deepcopy__s    zParameter.__deepcopy__csdtt|jS)NzParameter containing: )superr__repr__)r) __class__r r r$szParameter.__repr__cCstjj|j|jtffS)N)r_utilsZ_rebuild_parameterr r r)rprotor r r __reduce_ex__'szParameter.__reduce_ex__)NT) __name__ __module__ __qualname____doc__rrrrr__torch_function__ __classcell__r r )rr rs   rcseZdZejjejjejjejjejj ejj ejj ejj ejj ejjejjejjejjejjejjejgZdddZeddZddZdd Zd d Zefdffd d ZZS)UninitializedTensorMixinNcCs>|dkr|jj}|dkr |jj}tj|||d|_|j|_dS)a~Create a Parameter or Tensor with the same properties of the uninitialized one. Given a shape, it materializes a parameter in the same device and with the same `dtype` as the current one or the specified ones in the arguments. Args: shape : (tuple): the shape for the materialized tensor. device (:class:`torch.device`): the desired device of the parameters and buffers in this module. Optional. dtype (:class:`torch.dtype`): the desired floating point type of the floating point parameters and buffers in this module. Optional. N)devicedtype)r r#r$rempty cls_to_becomer)rshaper#r$r r r materializeEs z$UninitializedTensorMixin.materializecCs tddS)NaCan't access the shape of an uninitialized parameter or buffer. This error usually happens in `load_state_dict` when trying to load an uninitialized parameter into an initialized one. Call `forward` to initialize the parameters before accessing their attributes.) RuntimeError)rr r r r'YszUninitializedTensorMixin.shapecCs tddS)NzCan't share memory on an uninitialized parameter or buffer. Call `forward` to initialize the parameters before calling `module.share_memory()`.)r))rr r r share_memory_asz&UninitializedTensorMixin.share_memory_cCsd|jjdS)N<>)rr)rr r r rgsz!UninitializedTensorMixin.__repr__cCs|j|jffS)N)rr )rrr r r rjsz&UninitializedTensorMixin.__reduce_ex__csJ||jks|jjdkr4|dkr"i}tj||||Stdj||jdS)Nzmethod-wrapperaAttempted to use an uninitialized parameter in {}. This error happens when you are using a `LazyModule` or explicitly manipulating `torch.nn.parameter.{}` objects. When using LazyModules Call `forward` with a dummy batch to initialize the parameters before calling torch functions)_allowed_methodsrrrr ValueErrorformat)r functypesargskwargs)rr r r qsz+UninitializedTensorMixin.__torch_function__)NN)rrrrr__hash__sizeZcopy_Zis_floating_pointZhalffloatdoublecharshortintlongZcudacpuZtoZ get_deviceZ!_has_compatible_shallow_copy_typer-r(propertyr'r*rr classmethodr r!r r )rr r"1s.  r"cCs t|tS)N) isinstancer")paramr r r is_lazysrAc@s$eZdZdZeZdddddZdS)UninitializedParameteraA parameter that is not initialized. Unitialized Parameters are a a special case of :class:`torch.nn.Parameter` where the shape of the data is still unknown. Unlike a :class:`torch.nn.Parameter`, uninitialized parameters hold no data and attempting to access some properties, like their shape, will throw a runtime error. The only operations that can be performed on a uninitialized parameter are changing its datatype, moving it to a different device and converting it to a regular :class:`torch.nn.Parameter`. The default device or dtype to use when the parameter is materialized can be set during construction using e.g. ``device='cuda'``. TN)returncCs(||d}tjgf|}tjj|||S)N)r#r$)rrrr)r r r#r$factory_kwargsr r r r rs zUninitializedParameter.__new__)TNN)rrrrrr&rr r r r rBsrBc@s&eZdZdZejZdddddZdS)UninitializedBufferaA buffer that is not initialized. Unitialized Buffer is a a special case of :class:`torch.Tensor` where the shape of the data is still unknown. Unlike a :class:`torch.Tensor`, uninitialized parameters hold no data and attempting to access some properties, like their shape, will throw a runtime error. The only operations that can be performed on a uninitialized parameter are changing its datatype, moving it to a different device and converting it to a regular :class:`torch.Tensor`. The default device or dtype to use when the buffer is materialized can be set during construction using e.g. ``device='cuda'``. FN)rCcCs(||d}tjgf|}tjj|||S)N)r#r$)rrrr)r r r#r$rDr r r r rs zUninitializedBuffer.__new__)FNN)rrrrrrr&rr r r r rEsrE) rZtorch._Cr collectionsrrrr"rArBrEr r r r s  +P