
    zj                        d dl mZ g Z G d d          Z G d de          Z G d de          Z G d d	e          Zd
S )    )annotationsc                  "    e Zd ZdZddZd	dZdS )
	EntryAttraX  
    Entry Config for paddle.static.nn.sparse_embedding with Parameter Server.

    Examples:
        .. code-block:: python

            >>> import paddle
            >>> paddle.enable_static()

            >>> sparse_feature_dim = 1024
            >>> embedding_size = 64

            >>> entry = paddle.distributed.ProbabilityEntry(0.1)

            >>> input = paddle.static.data(name='ins', shape=[1], dtype='int64')

            >>> emb = paddle.static.nn.sparse_embedding(
            ...     input=input,
            ...     size=[sparse_feature_dim, embedding_size],
            ...     is_test=False,
            ...     entry=entry,
            ...     param_attr=paddle.ParamAttr(
            ...         name="SparseFeatFactors",
            ...         initializer=paddle.nn.initializer.Uniform()
            ...     )
            ... )

    returnNonec                    d | _         d S )N)_nameselfs    m/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/paddle/distributed/entry_attr.py__init__zEntryAttr.__init__1   s    


    strc                     t          d          )z
        Returns the attributes of this parameter.

        Returns:
            Parameter attributes(map): The attributes of this parameter.
        zEntryAttr is base class)NotImplementedErrorr
   s    r   _to_attrzEntryAttr._to_attr4   s     "";<<<r   N)r   r   r   r   )__name__
__module____qualname____doc__r   r    r   r   r   r      sF         :   = = = = = =r   r   c                  ,     e Zd ZdZd	 fdZd
dZ xZS )ProbabilityEntrya
  
    Examples:
        .. code-block:: python

            >>> import paddle
            >>> paddle.enable_static()

            >>> sparse_feature_dim = 1024
            >>> embedding_size = 64

            >>> entry = paddle.distributed.ProbabilityEntry(0.1)

            >>> input = paddle.static.data(name='ins', shape=[1], dtype='int64')

            >>> emb = paddle.static.nn.sparse_embedding(
            ...     input=input,
            ...     size=[sparse_feature_dim, embedding_size],
            ...     is_test=False,
            ...     entry=entry,
            ...     param_attr=paddle.ParamAttr(
            ...         name="SparseFeatFactors",
            ...         initializer=paddle.nn.initializer.Uniform()
            ...     )
            ... )


    probabilityfloatr   r   c                    t                                                       t          |t                    st	          d          |dk    s|dk    rt	          d          d| _        || _        d S )Nz$probability must be a float in (0,1)r      probability_entry)superr   
isinstancer   
ValueErrorr	   _probability)r   r   	__class__s     r   r   zProbabilityEntry.__init__[   st    +u-- 	ECDDD!{a//CDDD(
'r   r   c                ^    d                     | j        t          | j                  g          S N:)joinr	   r   r#   r
   s    r   r   zProbabilityEntry._to_attrg   s&    xxS):%;%;<===r   )r   r   r   r   r   r   r   r   r   r   r   __classcell__r$   s   @r   r   r   >   s[         8
( 
( 
( 
( 
( 
(> > > > > > > >r   r   c                  ,     e Zd ZdZd	 fdZd
dZ xZS )CountFilterEntrya  
    Examples:
        .. code-block:: python

            >>> import paddle
            >>> paddle.enable_static()

            >>> sparse_feature_dim = 1024
            >>> embedding_size = 64

            >>> entry = paddle.distributed.CountFilterEntry(10)

            >>> input = paddle.static.data(name='ins', shape=[1], dtype='int64')

            >>> emb = paddle.static.nn.sparse_embedding(
            ...     input=input,
            ...     size=[sparse_feature_dim, embedding_size],
            ...     is_test=False,
            ...     entry=entry,
            ...     param_attr=paddle.ParamAttr(
            ...         name="SparseFeatFactors",
            ...         initializer=paddle.nn.initializer.Uniform()
            ...     )
            ... )

    count_filterintr   r   c                    t                                                       t          |t                    st	          d          |dk     rt	          d          d| _        || _        d S )Nz3count_filter must be a valid integer greater than 0r   z<count_filter must be a valid integer greater or equal than 0count_filter_entry)r    r   r!   r/   r"   r	   _count_filter)r   r.   r$   s     r   r   zCountFilterEntry.__init__   sy    ,,, 	E   !N   *
)r   r   c                ^    d                     | j        t          | j                  g          S r&   )r(   r	   r   r2   r
   s    r   r   zCountFilterEntry._to_attr   s&    xxS);%<%<=>>>r   )r.   r/   r   r   r   r)   r+   s   @r   r-   r-   k   s[         6* * * * * * ? ? ? ? ? ? ? ?r   r-   c                  ,     e Zd ZdZd	 fdZd
dZ xZS )ShowClickEntrya  
    Examples:
        .. code-block:: python

            >>> import paddle
            >>> paddle.enable_static()

            >>> sparse_feature_dim = 1024
            >>> embedding_size = 64

            >>> shows = paddle.static.data(name='show', shape=[1], dtype='int64')
            >>> clicks = paddle.static.data(name='click', shape=[1], dtype='int64')
            >>> input = paddle.static.data(name='ins', shape=[1], dtype='int64')

            >>> entry = paddle.distributed.ShowClickEntry("show", "click")

            >>> emb = paddle.static.nn.sparse_embedding(
            ...     input=input,
            ...     size=[sparse_feature_dim, embedding_size],
            ...     is_test=False,
            ...     entry=entry,
            ...     param_attr=paddle.ParamAttr(
            ...         name="SparseFeatFactors",
            ...         initializer=paddle.nn.initializer.Uniform()
            ...     )
            ... )


    	show_namer   
click_namer   r   c                    t                                                       t          |t                    rt          |t                    st	          d          d| _        || _        || _        d S )Nz"show_name click_name must be a strshow_click_entry)r    r   r!   r   r"   r	   
_show_name_click_name)r   r6   r7   r$   s      r   r   zShowClickEntry.__init__   si    )S)) 	CJ1L1L 	CABBB'
#%r   c                P    d                     | j        | j        | j        g          S r&   )r(   r	   r:   r;   r
   s    r   r   zShowClickEntry._to_attr   s"    xxT_d6FGHHHr   )r6   r   r7   r   r   r   r   r)   r+   s   @r   r5   r5      sc         <& & & & & &I I I I I I I Ir   r5   N)
__future__r   __all__r   r   r-   r5   r   r   r   <module>r?      s    # " " " " "
(= (= (= (= (= (= (= (=V*> *> *> *> *>y *> *> *>Z-? -? -? -? -?y -? -? -?`*I *I *I *I *IY *I *I *I *I *Ir   