/usr/local/lib64/python3.6/site-packages/torch/nn/modules/__pycache__
NameSizeModeActions
activation.cpython-36.pyc476350644editdlrm
adaptive.cpython-36.pyc97250644editdlrm
batchnorm.cpython-36.pyc310390644editdlrm
channelshuffle.cpython-36.pyc19010644editdlrm
container.cpython-36.pyc279700644editdlrm
conv.cpython-36.pyc577890644editdlrm
distance.cpython-36.pyc36840644editdlrm
dropout.cpython-36.pyc103100644editdlrm
flatten.cpython-36.pyc58130644editdlrm
fold.cpython-36.pyc128070644editdlrm
instancenorm.cpython-36.pyc188080644editdlrm
lazy.cpython-36.pyc116900644editdlrm
linear.cpython-36.pyc101880644editdlrm
loss.cpython-36.pyc914650644editdlrm
module.cpython-36.pyc665300644editdlrm
normalization.cpython-36.pyc113600644editdlrm
padding.cpython-36.pyc222170644editdlrm
pixelshuffle.cpython-36.pyc43980644editdlrm
pooling.cpython-36.pyc532030644editdlrm
rnn.cpython-36.pyc446530644editdlrm
sparse.cpython-36.pyc209560644editdlrm
transformer.cpython-36.pyc207370644editdlrm
upsampling.cpython-36.pyc107800644editdlrm
utils.cpython-36.pyc25280644editdlrm
_functions.cpython-36.pyc54410644editdlrm
__init__.cpython-36.pyc52360644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/nn/modules/__pycache__/flatten.cpython-36.pyc (5813B)
3 ûEgÈã@sXddlmZddlmZmZddlmZddlmZGdd„deƒZ Gdd „d eƒZ d S) é)ÚModuleé)ÚTupleÚUnion)ÚTensor)Ú_sizecs\eZdZUdZddgZeedeeddœ‡fdd„ Ze e d œd d „Z e d œd d„Z ‡Z S)ÚFlattena Flattens a contiguous range of dims into a tensor. For use with :class:`~nn.Sequential`. Shape: - Input: :math:`(*, S_{\text{start}},..., S_{i}, ..., S_{\text{end}}, *)`,' where :math:`S_{i}` is the size at dimension :math:`i` and :math:`*` means any number of dimensions including none. - Output: :math:`(*, \prod_{i=\text{start}}^{\text{end}} S_{i}, *)`. Args: start_dim: first dim to flatten (default = 1). end_dim: last dim to flatten (default = -1). Examples:: >>> input = torch.randn(32, 1, 5, 5) >>> m = nn.Sequential( >>> nn.Conv2d(1, 32, 5, 1, 1), >>> nn.Flatten() >>> ) >>> output = m(input) >>> output.size() torch.Size([32, 288]) Ú start_dimÚend_dimrN)r r Úreturncstt|ƒjƒ||_||_dS)N)ÚsuperrÚ__init__r r )Úselfr r )Ú __class__©úD/usr/local/lib64/python3.6/site-packages/torch/nn/modules/flatten.pyr $szFlatten.__init__)Úinputr cCs|j|j|jƒS)N)Úflattenr r )rrrrrÚforward)szFlatten.forward)r cCsdj|j|jƒS)Nzstart_dim={}, end_dim={})Úformatr r )rrrrÚ extra_repr,szFlatten.extra_repréÿÿÿÿ)rr)Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __constants__Úintr r r rrÚstrrÚ __classcell__rr)rrrs rcsšeZdZUdZeeeefZddgZe eef e e ef e eefe e efddœ‡fdd„ Z dd „Zd d „Zeed œd d„Zedœdd„Z‡ZS)Ú Unflattena Unflattens a tensor dim expanding it to a desired shape. For use with :class:`~nn.Sequential`. * :attr:`dim` specifies the dimension of the input tensor to be unflattened, and it can be either `int` or `str` when `Tensor` or `NamedTensor` is used, respectively. * :attr:`unflattened_size` is the new shape of the unflattened dimension of the tensor and it can be a `tuple` of ints or a `list` of ints or `torch.Size` for `Tensor` input; a `NamedShape` (tuple of `(name, size)` tuples) for `NamedTensor` input. Shape: - Input: :math:`(*, S_{\text{dim}}, *)`, where :math:`S_{\text{dim}}` is the size at dimension :attr:`dim` and :math:`*` means any number of dimensions including none. - Output: :math:`(*, U_1, ..., U_n, *)`, where :math:`U` = :attr:`unflattened_size` and :math:`\prod_{i=1}^n U_i = S_{\text{dim}}`. Args: dim (Union[int, str]): Dimension to be unflattened unflattened_size (Union[torch.Size, Tuple, List, NamedShape]): New shape of the unflattened dimension Examples: >>> input = torch.randn(2, 50) >>> # With tuple of ints >>> m = nn.Sequential( >>> nn.Linear(50, 50), >>> nn.Unflatten(1, (2, 5, 5)) >>> ) >>> output = m(input) >>> output.size() torch.Size([2, 2, 5, 5]) >>> # With torch.Size >>> m = nn.Sequential( >>> nn.Linear(50, 50), >>> nn.Unflatten(1, torch.Size([2, 5, 5])) >>> ) >>> output = m(input) >>> output.size() torch.Size([2, 2, 5, 5]) >>> # With namedshape (tuple of tuples) >>> input = torch.randn(2, 50, names=('N', 'features')) >>> unflatten = nn.Unflatten('features', (('C', 2), ('H', 5), ('W', 5))) >>> output = unflatten(input) >>> output.size() torch.Size([2, 2, 5, 5]) ÚdimÚunflattened_sizeN)r!r"r csRtt|ƒjƒt|tƒr$|j|ƒnt|tƒr:|j|ƒntdƒ‚||_ ||_ dS)Nz'invalid argument type for dim parameter) r r r Ú isinstancerÚ_require_tuple_intrÚ_require_tuple_tupleÚ TypeErrorr!r")rr!r")rrrr fs    zUnflatten.__init__cCsdt|tƒrHx8t|ƒD],\}}t|tƒstddjt|ƒj|ƒƒ‚qWdStddjt|ƒjƒƒ‚dS)Nz*unflattened_size must be tuple of tuples, z&but found element of type {} at pos {}z,unflattened_size must be a tuple of tuples, zbut found type {})r#ÚtupleÚ enumerater&rÚtyper)rrÚidxÚelemrrrr%ss  zUnflatten._require_tuple_tuplecCsdt|ttfƒrLx8t|ƒD],\}}t|tƒstddjt|ƒj|ƒƒ‚qWdStdjt|ƒjƒƒ‚dS)Nz(unflattened_size must be tuple of ints, z&but found element of type {} at pos {}z;unflattened_size must be a tuple of ints, but found type {}) r#r'Úlistr(rr&rr)r)rrr*r+rrrr$}s zUnflatten._require_tuple_int)rr cCs|j|j|jƒS)N)Z unflattenr!r")rrrrrr†szUnflatten.forward)r cCsdj|j|jƒS)Nzdim={}, unflattened_size={})rr!r")rrrrr‰szUnflatten.extra_repr)rrrrrrrZ NamedShaperrr!rr"r r%r$rrrrrr)rrr 2s -  &   r N) ÚmodulerÚtypingrrZtorchrZ torch.typesrrr rrrrÚs   *