+
    –°³j­  ã                   ó~   € ^ RI t ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 RR.t
 ! R	 R]4      t ! R
 R]4      tR# )é    N©ÚTensor)Úconstraints)ÚCategorical)ÚDistribution)Ú_sizeÚOneHotCategoricalÚ OneHotCategoricalStraightThroughc                   ó°  a a€ ] tR t^t oRtR]P                  R]P                  /t]P                  t
RtRV3R lV 3R llltRV 3R lltR 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]V3R lR l4       t]V3R lR l4       t]P0                  ! 4       3R ltR tR tRR ltRtVtV ;t# )r	   aa  
Creates a one-hot categorical distribution parameterized by :attr:`probs` or
:attr:`logits`.

Samples are one-hot coded vectors of size ``probs.size(-1)``.

.. note:: The `probs` argument must be non-negative, finite and have a non-zero sum,
          and it will be normalized to sum to 1 along the last dimension. :attr:`probs`
          will return this normalized value.
          The `logits` argument will be interpreted as unnormalized log probabilities
          and can therefore be any real number. It will likewise be normalized so that
          the resulting probabilities sum to 1 along the last dimension. :attr:`logits`
          will return this normalized value.

See also: :func:`torch.distributions.Categorical` for specifications of
:attr:`probs` and :attr:`logits`.

Example::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = OneHotCategorical(torch.tensor([ 0.25, 0.25, 0.25, 0.25 ]))
    >>> m.sample()  # equal probability of 0, 1, 2, 3
    tensor([ 0.,  0.,  0.,  1.])

Args:
    probs (Tensor): event probabilities
    logits (Tensor): event log probabilities (unnormalized)
ÚprobsÚlogitsTc                óZ   <€ V ^8„  d   QhRS[ R,          RS[ R,          RS[R,          RR/# )é   r   Nr   Úvalidate_argsÚreturn)r   Úbool)ÚformatÚ__classdict__s   "€Úh/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributions/one_hot_categorical.pyÚ__annotate__ÚOneHotCategorical.__annotate__1   sE   ø€ ÷ 
Pñ 
Pá˜�}ð
Pñ ˜•ð
Pñ ˜d•{ð	
Pð
 
ñ
Pó    c                ó¨   <€ \        W4      V n        V P                  P                  pV P                  P                  RR p\        SV `  WEVR7       R# )é   N©r   éÿÿÿÿ)r   Ú_categoricalÚbatch_shapeÚparam_shapeÚsuperÚ__init__)Úselfr   r   r   r   Úevent_shapeÚ	__class__s   &&&&  €r   r!   ÚOneHotCategorical.__init__1   sM   ø€ ô (¨Ó6ˆÔØ×'Ñ'×3Ñ3ˆØ×'Ñ'×3Ñ3°B°CÐ8ˆä‰Ñ˜ÀÐÖOr   c                ó   <€ V P                  \        V4      p\        P                  ! V4      pV P                  P                  V4      Vn        \        \        V`  WP                  R R7       V P                  Vn	        V# )Fr   )
Ú_get_checked_instancer	   ÚtorchÚSizer   Úexpandr    r!   r#   Ú_validate_args)r"   r   Ú	_instanceÚnewr$   s   &&& €r   r*   ÚOneHotCategorical.expand=   sr   ø€ Ø×(Ñ(Ô):¸IÓFˆÜ—j’j Ó-ˆØ×,Ñ,×3Ñ3°KÓ@ˆÔÜÔ Ñ.Ø×)Ñ)¸ð 	/ô 	
ð "×0Ñ0ˆÔØˆ
r   c                ó:   € V P                   P                  ! V/ VB # ©N)r   Ú_new)r"   ÚargsÚkwargss   &*,r   r1   ÚOneHotCategorical._newG   s   € Ø× Ñ ×%Ò% tÐ6¨vÑ6Ð6r   c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   r   )r   r   s   "€r   r   r   K   ó   ø€ ÷ (ñ (™ñ (r   c                ó.   € V P                   P                  # r0   )r   Ú_param©r"   s   &r   r9   ÚOneHotCategorical._paramJ   ó   € à× Ñ ×'Ñ'Ð'r   c                ó    <€ V ^8„  d   QhRS[ /# r6   r   )r   r   s   "€r   r   r   O   s   ø€ ÷ 'ñ '‘vñ 'r   c                ó.   € V P                   P                  # r0   ©r   r   r:   s   &r   r   ÚOneHotCategorical.probsN   ó   € à× Ñ ×&Ñ&Ð&r   c                ó    <€ V ^8„  d   QhRS[ /# r6   r   )r   r   s   "€r   r   r   S   r7   r   c                ó.   € V P                   P                  # r0   )r   r   r:   s   &r   r   ÚOneHotCategorical.logitsR   r<   r   c                ó    <€ V ^8„  d   QhRS[ /# r6   r   )r   r   s   "€r   r   r   W   s   ø€ ÷ 'ñ '‘fñ 'r   c                ó.   € V P                   P                  # r0   r?   r:   s   &r   ÚmeanÚOneHotCategorical.meanV   rA   r   c                ó    <€ V ^8„  d   QhRS[ /# r6   r   )r   r   s   "€r   r   r   [   s   ø€ ÷ Xñ X‘fñ Xr   c                óæ   € V P                   P                  pVP                  RR7      p\        P                  P
                  P                  W!P                  R,          R7      P                  V4      # )r   )Údim)Únum_classesr   )	r   r   Úargmaxr(   ÚnnÚ
functionalÚone_hotÚshapeÚto)r"   r   Úmodes   &  r   rS   ÚOneHotCategorical.modeZ   sU   € à×!Ñ!×'Ñ'ˆØ�|‰| ˆ|Ó#ˆÜ�x‰x×"Ñ"×*Ñ*¨4¿[¹[È½_Ð*ÓM×PÑPÐQVÓWÐWr   c                ó    <€ V ^8„  d   QhRS[ /# r6   r   )r   r   s   "€r   r   r   a   s   ø€ ÷ Gñ G™&ñ Gr   c                ór   € V P                   P                  ^V P                   P                  ,
          ,          # ©r   r?   r:   s   &r   ÚvarianceÚOneHotCategorical.variance`   s*   € à× Ñ ×&Ñ&¨!¨d×.?Ñ.?×.EÑ.EÕ*EÕFÐFr   c                ó4   <€ V ^8„  d   QhRS[ P                  /# r6   )r(   r)   )r   r   s   "€r   r   r   e   s   ø€ ÷ -ñ -™UŸZ™Zñ -r   c                ó.   € V P                   P                  # r0   )r   r   r:   s   &r   r   ÚOneHotCategorical.param_shaped   s   € à× Ñ ×,Ñ,Ð,r   c                ó,  € \         P                  ! V4      pV P                  P                  pV P                  P                  pV P                  P                  V4      p\         P                  P                  P                  WC4      P                  V4      # r0   )
r(   r)   r   r   Ú_num_eventsÚsamplerN   rO   rP   rR   )r"   Úsample_shaper   Ú
num_eventsÚindicess   &&   r   r_   ÚOneHotCategorical.sampleh   sn   € Ü—z’z ,Ó/ˆØ×!Ñ!×'Ñ'ˆØ×&Ñ&×2Ñ2ˆ
Ø×#Ñ#×*Ñ*¨<Ó8ˆÜ�x‰x×"Ñ"×*Ñ*¨7Ó?×BÑBÀ5ÓIÐIr   c                ó®   € V P                   '       d   V P                  V4       VP                  R4      ^,          pV P                  P	                  V4      # )r   r   )r+   Ú_validate_sampleÚmaxr   Úlog_prob)r"   Úvaluerb   s   && r   rg   ÚOneHotCategorical.log_probo   sE   € Ø××ÐØ×!Ñ! %Ô(Ø—)‘)˜B“- Õ"ˆØ× Ñ ×)Ñ)¨'Ó2Ð2r   c                ó6   € V P                   P                  4       # r0   )r   Úentropyr:   s   &r   rk   ÚOneHotCategorical.entropyu   s   € Ø× Ñ ×(Ñ(Ó*Ð*r   c                óˆ  € V P                   ^ ,          p\        P                  ! W P                  P                  V P                  P
                  R7      pVP                  V3R\        V P                  4      ,          ,           V3,           4      pV'       d,   VP                  V3V P                  ,           V3,           4      pV# )r   )ÚdtypeÚdevicerW   )
r#   r(   Úeyer9   rn   ro   ÚviewÚlenr   r*   )r"   r*   ÚnÚvaluess   &&  r   Úenumerate_supportÚ#OneHotCategorical.enumerate_supportx   sŒ   € Ø×Ñ˜QÕˆÜ—’˜1§K¡K×$5Ñ$5¸d¿k¹k×>PÑ>PÔQˆØ—‘˜a˜T D¬3¨t×/?Ñ/?Ó+@Õ$@Õ@ÀAÀ4ÕGÓHˆßØ—]‘] A 4¨$×*:Ñ*:Õ#:¸a¸TÕ#AÓBˆFØˆr   )r   )NNNr0   )T) Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚsimplexÚreal_vectorÚarg_constraintsrP   ÚsupportÚhas_enumerate_supportr!   r*   r1   Úpropertyr9   r   r   rG   rS   rX   r   r(   r)   r_   rg   rk   ru   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r$   r   s   @@r   r	   r	      s  ù‡ € ñð<  × 3Ñ 3°X¸{×?VÑ?VÐW€OØ×!Ñ!€GØ Ð÷
Põ 
P÷ò7ð ÷(ó ð(ð ÷'ó ð'ð ÷(ó ð(ð ÷'ó ð'ð ÷Xó ðXð
 ÷Gó ðGð ÷-ó ð-ð #(§*¢*£,ô Jò3ò+÷ô r   c                   ó^   a € ] tR t^�t o RtRt]P                  ! 4       3V 3R lR lltRt	V t
R# )r
   z÷
Creates a reparameterizable :class:`OneHotCategorical` distribution based on the straight-
through gradient estimator from [1].

[1] Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computation
(Bengio et al., 2013)
Tc                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   r`   r   )r   r   )r   r   s   "€r   r   Ú-OneHotCategoricalStraightThrough.__annotate__Œ   s   ø€ ÷ 2ñ 2¡Eð 2¹Vñ 2r   c                óŠ   € V P                  V4      pV P                  P                  pW#VP                  4       ,
          ,           # r0   )r_   r   r   Údetach)r"   r`   Úsamplesr   s   &&  r   ÚrsampleÚ(OneHotCategoricalStraightThrough.rsampleŒ   s5   € Ø—+‘+˜lÓ+ˆØ×!Ñ!×'Ñ'ˆØ %§,¡,£.Õ0Õ1Ð1r   © N)rw   rx   ry   rz   r{   Úhas_rsampler(   r)   r‹   r‚   rƒ   )r   s   @r   r
   r
   �   s)   ø‡ € ñð €Kà,1¯JªJ«L÷ 2÷ 2ð 2r   )r(   r   Útorch.distributionsr   Útorch.distributions.categoricalr   Ú torch.distributions.distributionr   Útorch.typesr   Ú__all__r	   r
   r�   r   r   Ú<module>r”      sB   ðó Ý Ý +Ý 7Ý 9Ý ð Ð BÐ
C€ôp˜ô pôf2Ð'8ö 2r   