
    Αi                        S SK Jr  S SKJr  S SKrS SKJr  \(       a  S SKJr  S SKJ	r	  S SK
Jr   " S S	5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r\" 5       r\" 5       rg)    )annotations)TYPE_CHECKINGN)
constraint)Sequence)Tensor)
Constraintc                  l    \ rS rSrSr   S	       S
S jjr\SS j5       r\SS j5       rSS jr	Sr
g)Variable   zRandom variable of probability distribution.

Args:
    is_discrete (bool): Is the variable discrete or continuous.
    event_rank (int): The rank of event dimensions.
    constraint (Constraint|None, optional): The constraint of the variable.
Nc                (    Xl         X l        X0l        g N)_is_discrete_event_rank_constraint)selfis_discrete
event_rankr   s       \/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/paddle/distribution/variable.py__init__Variable.__init__&   s     (%%    c                    U R                   $ r   )r   r   s    r   r   Variable.is_discrete0   s       r   c                    U R                   $ r   )r   r   s    r   r   Variable.event_rank4   s    r   c                V    U R                   c   eU R                   R                  U5      $ )zQCheck whether the 'value' meet the constraint conditions of this
random variable.)r   check)r   values     r   r   Variable.constraint8   s-     +++%%e,,r   )r   r   r   )Fr   N)r   boolr   intr   zConstraint | NonereturnNoner#   r!   r#   r"   r   r   r#   r   )__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   __static_attributes__ r   r   r
   r
      sj     "(,	&& & &	&
 
& ! !    -r   r
   c                  0   ^  \ rS rSrSSU 4S jjjrSrU =r$ )Real?   c                D   > [         TU ]  SU[        R                  5        g NF)superr   r   realr   r   	__class__s     r   r   Real.__init__@   s    
JOO<r   r/   r   r   r"   r#   r$   r(   r)   r*   r+   r   r.   __classcell__r8   s   @r   r1   r1   ?   s    = =r   r1   c                  0   ^  \ rS rSrSSU 4S jjjrSrU =r$ )PositiveD   c                D   > [         TU ]  SU[        R                  5        g r4   )r5   r   r   positiver7   s     r   r   Positive.__init__E   s    
J,?,?@r   r/   r:   r;   r<   r>   s   @r   r@   r@   D   s    A Ar   r@   c                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )IndependentI   zReinterprets some of the batch axes of variable as event axes.

Args:
    base (Variable): Base variable.
    reinterpreted_batch_rank (int): The rightmost batch rank to be
        reinterpreted.
c                l   > Xl         X l        [        TU ]  UR                  UR
                  U-   5        g r   )_base_reinterpreted_batch_rankr5   r   r   r   )r   basereinterpreted_batch_rankr8   s      r   r   Independent.__init__R   s0    
)A&doo0HH	
r   c                >   U R                   R                  U5      nUR                  5       U R                  :  a  [	        SU R                   35      eUR                  / UR                  S UR                  5       U R                  -
   QSP75      R                  S5      $ )Nz/Input dimensions must be equal or grater than  )	rI   r   dimrJ   
ValueErrorreshapeshaperL   all)r   r   rets      r   r   Independent.constraintY   s    jj##E*779t555A$B`B`Aab  {{IciiC#'')d&C&CCDIbI

#b'	r   )rI   rJ   )rK   r
   rL   r"   r#   r$   r'   )	r(   r)   r*   r+   r,   r   r   r.   r=   r>   s   @r   rF   rF   I   s    
 r   rF   c                  T    \ rS rSrSS	S jjr\S
S j5       r\SS j5       rSS jrSr	g)Stackd   c                    Xl         X l        g r   )_vars_axis)r   varsaxiss      r   r   Stack.__init__e   s    

r   c                :    [        S U R                   5       5      $ )Nc              3  8   #    U  H  oR                   v   M     g 7fr   )r   .0vars     r   	<genexpr>$Stack.is_discrete.<locals>.<genexpr>k   s     9js??j   )anyr[   r   s    r   r   Stack.is_discretei   s    9djj999r   c                n    [        S U R                   5       5      nU R                  U-   S:  a  US-  nU$ )Nc              3  8   #    U  H  oR                   v   M     g 7fr   )r   rb   s     r   re   #Stack.event_rank.<locals>.<genexpr>o   s     8Zc>>Zrg   r      )maxr[   r\   )r   ranks     r   r   Stack.event_rankm   s5    8TZZ88::q AIDr   c           	        UR                  5       * U R                  s=::  a  UR                  5       :  d,  O  [        SUR                  5        SU R                   S35      e[        R                  " [        U R                  [        R                  " XR                  5      5       VVs/ s H  u  p!UR                  U5      PM     snnU R                  5      $ s  snnf )NzInput dimensions z- should be grater than stack constraint axis .)	rP   r\   rQ   paddlestackzipr[   unstackr   )r   r   rd   s      r   r   Stack.constraintt   s    

8UYY[8#EIIK= 1##'::,a1 
 || #&JJujj A##JC 		% # JJ
 	
s   (C
)r\   r[   Nr:   )r]   zSequence[Variable]r^   r"   r#   r$   r%   r&   r'   )
r(   r)   r*   r+   r   r-   r   r   r   r.   r/   r   r   rX   rX   d   s4     : :  
r   rX   )
__future__r   typingr   rs   paddle.distributionr   collections.abcr   r   paddle.distribution.constraintr   r
   r1   r@   rF   rX   r6   rC   r/   r   r   <module>r}      sm    #    *(9- -D=8 =
Ax A
( 6
H 
D v:r   