
    ёi                    t    S SK Jr  S SKJr  S SKJrJr  SSKJr	  SSK
Jr  \(       a  S SKr/ r " S	 S
\5      rg)    )annotations)TYPE_CHECKING)param_one_aliasparam_two_alias   )
functional   )LayerNc                    ^  \ rS rSrSr\" SS/5          S       SU 4S jjj5       r\" SS/SS	/5      SS
 j5       rSS jr	\
SS j5       r\R                  SS j5       r\
SS j5       r\R                  SS j5       rSrU =r$ )PairwiseDistance   a  

It computes the pairwise distance between two vectors. The
distance is calculated by p-order 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])
epsilonepsc                R   > [         TU ]  5         Xl        X l        X0l        X@l        g N)super__init__pr   keepdimname)selfr   r   r   r   	__class__s        X/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/nn/layer/distance.pyr   PairwiseDistance.__init__I   s$     		    xx1yx2c                    [         R                  " XU R                  U R                  U R                  U R
                  5      $ r   )Fpairwise_distancer   r   r   r   )r   r   r   s      r   forwardPairwiseDistance.forwardW   s0    ""$&&$,,dii
 	
r   c                    SnU R                   S:w  a  US-  nU R                  SLa  US-  nU R                  b  US-  nUR                  " S0 U R                  D6$ )Nzp={p}ư>z, epsilon={epsilon}Fz, keepdim={keepdim}z, name={name} )r   r   r   format__dict__)r   main_strs     r   
extra_reprPairwiseDistance.extra_repr]   s_    <<4--H<<u$--H99 'H///r   c                    U R                   $ r   r   r   s    r   r   PairwiseDistance.epsg   s    ||r   c                    Xl         g r   r.   r   values     r   r   r0   k   s    r   c                    U R                   $ r   r   r/   s    r   normPairwiseDistance.normo   s    vvr   c                    Xl         g r   r5   r2   s     r   r6   r7   s   s    r   )r   r   r   r   )g       @r&   FN)r   floatr   r9   r   boolr   z
str | None)r   paddle.Tensorr   r;   returnr;   )r<   str)r<   r9   )r3   r9   r<   None)__name__
__module____qualname____firstlineno____doc__r   r   r   r#   r+   propertyr   setterr6   __static_attributes____classcell__)r   s   @r   r   r      s    (T i'(   	
  ) c4[3+.
 /

0   	ZZ    
[[ r   r   )
__future__r   typingr   paddle.utils.decorator_utilsr   r    r   r!   layersr
   paddle__all__r   r'   r   r   <module>rO      s/    #   I  
Wu Wr   