/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__/distance.cpython-36.pyc (3684B)
3 Eg] @sHddlmZddlmZddlmZGdddeZGdd d eZd S) )Module) functional)TensorcsXeZdZUdZdddgZeee deeedd fd d Z e e e d d dZ Z S)PairwiseDistancea Computes the pairwise distance between vectors :math:`v_1`, :math:`v_2` using the p-norm: .. math :: \Vert x \Vert _p = \left( \sum_{i=1}^n \vert x_i \vert ^ p \right) ^ {1/p}. Args: p (real): the norm degree. Default: 2 eps (float, optional): Small value to avoid division by zero. Default: 1e-6 keepdim (bool, optional): Determines whether or not to keep the vector dimension. Default: False Shape: - Input1: :math:`(N, D)` or :math:`(D)` where `N = batch dimension` and `D = vector dimension` - Input2: :math:`(N, D)` or :math:`(D)`, same shape as the Input1 - Output: :math:`(N)` or :math:`()` based on input dimension. If :attr:`keepdim` is ``True``, then :math:`(N, 1)` or :math:`(1)` based on input dimension. Examples:: >>> pdist = nn.PairwiseDistance(p=2) >>> input1 = torch.randn(100, 128) >>> input2 = torch.randn(100, 128) >>> output = pdist(input1, input2) normepskeepdim@ư>FN)pr r returncs$tt|j||_||_||_dS)N)superr__init__rr r )selfr r r ) __class__E/usr/local/lib64/python3.6/site-packages/torch/nn/modules/distance.pyr$szPairwiseDistance.__init__)x1x2rcCstj|||j|j|jS)N)FZpairwise_distancerr r )rrrrrrforward*szPairwiseDistance.forward)r r F)__name__ __module__ __qualname____doc__ __constants__floatrr boolr rrr __classcell__rr)rrrs  rcsPeZdZUdZddgZeed eeddfdd Z e e e d d d Z Z S)CosineSimilarityaReturns cosine similarity between :math:`x_1` and :math:`x_2`, computed along `dim`. .. math :: \text{similarity} = \dfrac{x_1 \cdot x_2}{\max(\Vert x_1 \Vert _2 \cdot \Vert x_2 \Vert _2, \epsilon)}. Args: dim (int, optional): Dimension where cosine similarity is computed. Default: 1 eps (float, optional): Small value to avoid division by zero. Default: 1e-8 Shape: - Input1: :math:`(\ast_1, D, \ast_2)` where D is at position `dim` - Input2: :math:`(\ast_1, D, \ast_2)`, same number of dimensions as x1, matching x1 size at dimension `dim`, and broadcastable with x1 at other dimensions. - Output: :math:`(\ast_1, \ast_2)` Examples:: >>> input1 = torch.randn(100, 128) >>> input2 = torch.randn(100, 128) >>> cos = nn.CosineSimilarity(dim=1, eps=1e-6) >>> output = cos(input1, input2) dimr r:0yE>N)r"r rcstt|j||_||_dS)N)rr!rr"r )rr"r )rrrrGszCosineSimilarity.__init__)rrrcCstj|||j|jS)N)rZcosine_similarityr"r )rrrrrrrLszCosineSimilarity.forward)rr#) rrrrrintr"rr rrrr rr)rrr!.s r!N) modulerrrZtorchrrr!rrrrs   '