/usr/local/lib64/python3.6/site-packages/torch/nn/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/nn/__pycache__/parameter.cpython-36.pyc (7568B)
3
Eg @ sr d dl Z d dlmZ d dlmZ G dd de jZG dd dZdd ZG d
d deeZ G dd
d
ee jZ
dS ) N)_disabled_torch_function_impl)OrderedDictc s> e Zd ZdZdddZdd Z fdd Zd
d ZeZ Z
S )
ParameteraJ A 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`
NTc C s" |d krt jg }t jj| ||S )N)torchtensorTensor_make_subclass)clsdata
requires_grad r >/usr/local/lib64/python3.6/site-packages/torch/nn/parameter.py__new__ s
zParameter.__new__c C sH t | |kr|t | S t| | jjtjd| j}||t | <