+
    &je                         ^ RI t ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
 ^ RIHt ^ RIHtHt R.t ! R	 R]4      tR# )
    NTensor)constraints)Distribution)broadcast_alllazy_propertylogits_to_probsprobs_to_logits) binary_cross_entropy_with_logits)_NumberNumber	Geometricc                   d  a a ] tR t^t oRtR]P                  R]P                  /t]P                  t
RV3R lV 3R llltRV 3R llt]V3R lR l4       t]V3R	 lR
 l4       t]V3R lR l4       t]V3R lR l4       t]V3R lR l4       t]P*                  ! 4       3R ltR tR tRtVtV ;t# )r   a<  
Creates a Geometric distribution parameterized by :attr:`probs`,
where :attr:`probs` is the probability of success of Bernoulli trials.

.. math::

    P(X=k) = (1-p)^{k} p, k = 0, 1, ...

.. note::
    :func:`torch.distributions.geometric.Geometric` :math:`(k+1)`-th trial is the first success
    hence draws samples in :math:`\{0, 1, \ldots\}`, whereas
    :func:`torch.Tensor.geometric_` `k`-th trial is the first success hence draws samples in :math:`\{1, 2, \ldots\}`.

Example::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = Geometric(torch.tensor([0.3]))
    >>> m.sample()  # underlying Bernoulli has 30% chance 1; 70% chance 0
    tensor([ 2.])

Args:
    probs (Number, Tensor): the probability of sampling `1`. Must be in range (0, 1]
    logits (Number, Tensor): the log-odds of sampling `1`.
probslogitsc                z   < V ^8  d   QhRS[ S[,          R,          RS[ S[,          R,          RS[R,          RR/# )   r   Nr   validate_argsreturn)r   r   bool)format__classdict__s   "u/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributions/geometric.py__annotate__Geometric.__annotate__2   sI     % %%% $&% d{	%
 
%    c           
       < VR J VR J 8X  d   \        R4      hVe   \        V4      w  V n        M!Vf   \        R4      h\        V4      w  V n        Ve   TMTp\        V\        4      '       d   \        P                  ! 4       pMVf   \        R4      hVP                  4       p\        S	V `-  WSR7       V P                  '       d   Ve   V P                  pV^ 8  pVP                  4       '       g[   VP                  V( ,          p\        R\        V4      P                    R\#        VP$                  4       R\'        V 4       RV 24      hR # R # R # )	Nz;Either `probs` or `logits` must be specified, but not both.zlogits is unexpectedly Nonez$probs_or_logits is unexpectedly Noner   zExpected parameter probs (z
 of shape z) of distribution z* to be positive but found invalid values:
)
ValueErrorr   r   AssertionErrorr   
isinstancer   torchSizesizesuper__init___validate_argsalldatatype__name__tupleshaperepr)
selfr   r   r   probs_or_logitsbatch_shapevaluevalidinvalid_value	__class__s
   &&&&     r   r&   Geometric.__init__2   sK    TMv~.M  )%0MTZ~$%BCC*62NT[#(#4%&ow//**,K&$%KLL)..0KB5#4JJEAIE99;; %

E6 2 U,,-Zekk8J7K L''+Dzl 3AANQ  	 $5r   c                p  < V P                  \        V4      p\        P                  ! V4      pR V P                  9   d!   V P
                  P                  V4      Vn        RV P                  9   d!   V P                  P                  V4      Vn        \        \        V`'  VRR7       V P                  Vn
        V# )r   r   Fr   )_get_checked_instancer   r"   r#   __dict__r   expandr   r%   r&   r'   )r/   r1   	_instancenewr5   s   &&& r   r:   Geometric.expandY   s    ((I>jj-dmm#

))+6CIt}}$++K8CJi&{%&H!00
r   c                    < V ^8  d   QhRS[ /# r   r   r   )r   r   s   "r   r   r   e   s     & &f &r   c                6    R V P                   ,          R ,
          # g      ?r   r/   s   &r   meanGeometric.meand   s    TZZ#%%r   c                    < V ^8  d   QhRS[ /# r?   r   )r   r   s   "r   r   r   i   s     , ,f ,r   c                B    \         P                  ! V P                  4      # N)r"   
zeros_liker   rC   s   &r   modeGeometric.modeh   s    

++r   c                    < V ^8  d   QhRS[ /# r?   r   )r   r   s   "r   r   r   m   s     5 5& 5r   c                X    R V P                   ,          R ,
          V P                   ,          # rA   rB   rC   s   &r   varianceGeometric.variancel   s    djj 3&$**44r   c                    < V ^8  d   QhRS[ /# r?   r   )r   r   s   "r   r   r   q   s     ; ; ;r   c                0    \        V P                  R R7      # T)	is_binary)r
   r   rC   s   &r   r   Geometric.logitsp   s    tzzT::r   c                    < V ^8  d   QhRS[ /# r?   r   )r   r   s   "r   r   r   u   s     < <v <r   c                0    \        V P                  R R7      # rR   )r	   r   rC   s   &r   r   Geometric.probst   s    t{{d;;r   c                   V P                  V4      p\        P                  ! V P                  P                  4      P
                  p\        P                  ! 4       ;_uu_ 4        \        P                  P                  4       '       dT   \        P                  ! W P                  P                  V P                  P                  R 7      pVP                  VR7      pM+V P                  P                  V4      P                  V^4      pVP                  4       V P                  ) P                  4       ,          P!                  4       uuRRR4       #   + '       g   i     R# ; i))dtypedevice)minN)_extended_shaper"   finfor   rY   tinyno_grad_C_get_tracing_staterandrZ   clampr<   uniform_loglog1pfloor)r/   sample_shaper-   r^   us   &&   r   sampleGeometric.samplex   s    $$\2{{4::++,11]]__xx**,,JJuJJ,<,<TZZEVEVWGGG%JJNN5)224;EEG

{1133::< ___s   #C EE	c                D   V P                   '       d   V P                  V4       \        WP                  4      w  rVP	                  \
        P                  R 7      p^ W"^8H  V^ 8H  ,          &   W) P                  4       ,          V P                  P                  4       ,           # ))memory_format)	r'   _validate_sampler   r   cloner"   contiguous_formatrf   re   )r/   r2   r   s   && r   log_probGeometric.log_prob   sy    !!%($UJJ7%*A*AB-.zeqj)*~~''$**..*:::r   c                h    \        V P                  V P                  R R7      V P                  ,          # )none)	reduction)r   r   r   rC   s   &r   entropyGeometric.entropy   s(    ,T[[$**PVWjj	
r   )r   r   )NNNrH   )r+   
__module____qualname____firstlineno____doc__r   unit_intervalrealarg_constraintsnonnegative_integersupportr&   r:   propertyrD   rJ   rN   r   r   r   r"   r#   rj   rq   rv   __static_attributes____classdictcell____classcell__)r5   r   s   @@r   r   r      s     4  9 98[EUEUVO--G% %N	 & & , , 5 5 ; ; < < #(**, 
=;
 
r   )r"   r   torch.distributionsr    torch.distributions.distributionr   torch.distributions.utilsr   r   r	   r
   torch.nn.functionalr   torch.typesr   r   __all__r    r   r   <module>r      s=      + 9  A ' -|
 |
r   