Ë
    •\;jc  ã                   ó6   — d dl mZ ddlmZ g Z G d„ de«      Zy)é   )Ú
functionalé   )ÚLayerc                   ó0   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zˆ xZS )ÚPairwiseDistanceaŠ  

    It computes the pairwise distance between two vectors. The
    distance is calculated by p-oreder norm:

    .. math::

        \Vert x \Vert _p = \left( \sum_{i=1}^n \vert x_i \vert ^ p \right) ^ {1/p}.

    Parameters:
        p (float, optional): The order of norm. Default: :math:`2.0`.
        epsilon (float, optional): Add small value to avoid division by zero.
            Default: :math:`1e-6`.
        keepdim (bool, optional): Whether to reserve the reduced dimension
            in the output Tensor. The result tensor is one dimension less than
            the result of ``|x-y|`` unless :attr:`keepdim` is True. Default: False.
        name (str, optional): For details, please refer to :ref:`api_guide_Name`.
            Generally, no setting is required. Default: None.

    Shape:
        - x: :math:`[N, D]` or :math:`[D]`, where :math:`N` is batch size, :math:`D`
          is the dimension of the data. Available data type is float16, float32, float64.
        - y: :math:`[N, D]` or :math:`[D]`, y have the same dtype as x.
        - output: The same dtype as input tensor.
            - If :attr:`keepdim` is True, the output shape is :math:`[N, 1]` or :math:`[1]`,
              depending on whether the input has data shaped as :math:`[N, D]`.
            - If :attr:`keepdim` is False, the output shape is :math:`[N]` or :math:`[]`,
              depending on whether the input has data shaped as :math:`[N, D]`.

    Examples:
        .. code-block:: python

            >>> import paddle
            >>> x = paddle.to_tensor([[1., 3.], [3., 5.]], dtype=paddle.float64)
            >>> y = paddle.to_tensor([[5., 6.], [7., 8.]], dtype=paddle.float64)
            >>> dist = paddle.nn.PairwiseDistance()
            >>> distance = dist(x, y)
            >>> print(distance)
            Tensor(shape=[2], dtype=float64, place=Place(cpu), stop_gradient=True,
            [4.99999860, 4.99999860])
    c                 óZ   •— t         ‰| �  «        || _        || _        || _        || _        y ©N)ÚsuperÚ__init__ÚpÚepsilonÚkeepdimÚname)Úselfr   r   r   r   Ú	__class__s        €úaG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\paddle/nn/layer/distance.pyr   zPairwiseDistance.__init__@   s*   ø€ Ü‰ÑÔØˆŒØˆŒØˆŒØˆ�	ó    c                 ó†   — t        j                  ||| j                  | j                  | j                  | j
                  «      S r	   )ÚFÚpairwise_distancer   r   r   r   )r   ÚxÚys      r   ÚforwardzPairwiseDistance.forwardG   s2   € Ü×"Ñ"Øˆq�$—&‘&˜$Ÿ,™,¨¯©°d·i±ió
ð 	
r   c                 ó®   — d}| j                   dk7  r|dz  }| j                  dur|dz  }| j                  �|dz  } |j                  di | j                  ¤ŽS )Nzp={p}ç�íµ ÷Æ°>z, epsilon={epsilon}Fz, keepdim={keepdim}z, name={name}© )r   r   r   ÚformatÚ__dict__)r   Úmain_strs     r   Ú
extra_reprzPairwiseDistance.extra_reprL   sa   € ØˆØ�<‰<˜4ÒØÐ-Ñ-ˆHØ�<‰<˜uÑ$ØÐ-Ñ-ˆHØ�9‰9Ð Ø˜Ñ'ˆHØˆx�‰Ñ/ §¡Ñ/Ð/r   )g       @r   FN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r    Ú__classcell__)r   s   @r   r   r      s   ø„ ñ(õTò
ö
0r   r   N)Ú r   r   Úlayersr   Ú__all__r   r   r   r   Ú<module>r)      s   ðõ Ý à
€ô?0�uõ ?0r   