+
    –°³jx  ã                   ó¦   € ^ RI t ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ R	IHt R
R.t ! R R
]4      t ! R R]	4      tR# )é    N©ÚTensor)Úconstraints)ÚCategorical)ÚDistribution)ÚTransformedDistribution)ÚExpTransform)Úbroadcast_allÚclamp_probs)Ú_sizeÚExpRelaxedCategoricalÚRelaxedOneHotCategoricalc                   ó<  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]P&                  ! 4       3V3R lR lltR tRtVtV ;t# )r   a“  
Creates a ExpRelaxedCategorical parameterized by
:attr:`temperature`, and either :attr:`probs` or :attr:`logits` (but not both).
Returns the log of a point in the simplex. Based on the interface to
:class:`OneHotCategorical`.

Implementation based on [1].

See also: :func:`torch.distributions.OneHotCategorical`

Args:
    temperature (Tensor): relaxation temperature
    probs (Tensor): event probabilities
    logits (Tensor): unnormalized log probability for each event

[1] The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables
(Maddison et al., 2017)

[2] Categorical Reparametrization with Gumbel-Softmax
(Jang et al., 2017)
ÚprobsÚlogitsTc          
      ó`   <€ V ^8„  d   QhRS[ RS[ R,          RS[ R,          RS[R,          RR/# ©é   Útemperaturer   Nr   Úvalidate_argsÚreturn©r   Úbool)ÚformatÚ__classdict__s   "€Úh/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributions/relaxed_categorical.pyÚ__annotate__Ú"ExpRelaxedCategorical.__annotate__/   sP   ø€ ÷ Pñ PáðPñ ˜�}ðPñ ˜•ð	Pñ
 ˜d•{ðPð 
ñPó    c                ó´   <€ \        W#4      V n        Wn        V P                  P                  pV P                  P                  RR p\
        SV `  WVVR7       R# )é   N©r   éÿÿÿÿ)r   Ú_categoricalr   Úbatch_shapeÚparam_shapeÚsuperÚ__init__)Úselfr   r   r   r   r%   Úevent_shapeÚ	__class__s   &&&&&  €r   r(   ÚExpRelaxedCategorical.__init__/   sS   ø€ ô (¨Ó6ˆÔØ&ÔØ×'Ñ'×3Ñ3ˆØ×'Ñ'×3Ñ3°B°CÐ8ˆä‰Ñ˜ÀÐÖOr   c                ó"  <€ V P                  \        V4      p\        P                  ! V4      pV P                  Vn        V P
                  P                  V4      Vn        \        \        V`#  WP                  R R7       V P                  Vn
        V# )Fr"   )Ú_get_checked_instancer   ÚtorchÚSizer   r$   Úexpandr'   r(   r*   Ú_validate_args©r)   r%   Ú	_instanceÚnewr+   s   &&& €r   r1   ÚExpRelaxedCategorical.expand=   s   ø€ Ø×(Ñ(Ô)>À	ÓJˆÜ—j’j Ó-ˆØ×*Ñ*ˆŒØ×,Ñ,×3Ñ3°KÓ@ˆÔÜÔ# SÑ2Ø×)Ñ)¸ð 	3ô 	
ð "×0Ñ0ˆÔØˆ
r   c                ó:   € V P                   P                  ! V/ VB # ©N)r$   Ú_new)r)   ÚargsÚkwargss   &*,r   r9   ÚExpRelaxedCategorical._newH   s   € Ø× Ñ ×%Ò% tÐ6¨vÑ6Ð6r   c                ó4   <€ V ^8„  d   QhRS[ P                  /# ©r   r   )r/   r0   )r   r   s   "€r   r   r   L   s   ø€ ÷ -ñ -™UŸZ™Zñ -r   c                ó.   € V P                   P                  # r8   )r$   r&   ©r)   s   &r   r&   Ú!ExpRelaxedCategorical.param_shapeK   s   € à× Ñ ×,Ñ,Ð,r   c                ó    <€ V ^8„  d   QhRS[ /# r>   r   )r   r   s   "€r   r   r   P   s   ø€ ÷ (ñ (™ñ (r   c                ó.   € V P                   P                  # r8   )r$   r   r@   s   &r   r   ÚExpRelaxedCategorical.logitsO   s   € à× Ñ ×'Ñ'Ð'r   c                ó    <€ V ^8„  d   QhRS[ /# r>   r   )r   r   s   "€r   r   r   T   s   ø€ ÷ 'ñ '‘vñ 'r   c                ó.   € V P                   P                  # r8   )r$   r   r@   s   &r   r   ÚExpRelaxedCategorical.probsS   s   € à× Ñ ×&Ñ&Ð&r   c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   Úsample_shaper   )r   r   )r   r   s   "€r   r   r   W   s   ø€ ÷ ?ñ ?¡Eð ?¹Vñ ?r   c                óp  € V P                  V4      p\        \        P                  ! W P                  P
                  V P                  P                  R 7      4      pVP                  4       ) P                  4       ) pV P                  V,           V P                  ,          pWUP                  RRR7      ,
          # ))ÚdtypeÚdeviceT©ÚdimÚkeepdimr#   )
Ú_extended_shaper   r/   Úrandr   rK   rL   Úlogr   Ú	logsumexp)r)   rI   ÚshapeÚuniformsÚgumbelsÚscoress   &&    r   ÚrsampleÚExpRelaxedCategorical.rsampleW   sŒ   € Ø×$Ñ$ \Ó2ˆÜÜ�JŠJ�u§K¡K×$5Ñ$5¸d¿k¹k×>PÑ>PÔQó
ˆð  —|‘|“~Ð&×+Ñ+Ó-Ð.ˆØ—+‘+ Õ'¨4×+;Ñ+;Õ;ˆØ×(Ñ(¨R¸Ð(Ó>Õ>Ð>r   c                ó"  € V P                   P                  pV P                  '       d   V P                  V4       \	        V P
                  V4      w  r1\        P                  ! V P                  \        V4      4      P                  4       V P                  P                  4       P                  V^,
          ) 4      ,
          pW1P                  V P                  4      ,
          pWUP                  RRR7      ,
          P                  R4      pWT,           # )r!   TrM   r#   )r$   Ú_num_eventsr2   Ú_validate_sampler
   r   r/   Ú	full_liker   ÚfloatÚlgammarR   ÚmulrS   Úsum)r)   ÚvalueÚKr   Ú	log_scaleÚscores   &&    r   Úlog_probÚExpRelaxedCategorical.log_prob`   sÌ   € Ø×Ñ×)Ñ)ˆØ××ÐØ×!Ñ! %Ô(Ü% d§k¡k°5Ó9‰ˆÜ—O’OØ×Ñœe A›hó
ç
‰&‹(�T×%Ñ%×)Ñ)Ó+×/Ñ/°!°aµ%°Ó9õ:ˆ	ð Ÿ™ 4×#3Ñ#3Ó4Õ4ˆØŸ™¨R¸˜Ó>Õ>×CÑCÀBÓGˆØÕ Ð r   )r$   r   ©NNNr8   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚsimplexÚreal_vectorÚarg_constraintsÚsupportÚhas_rsampler(   r1   r9   Úpropertyr&   r   r   r/   r0   rX   rf   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r+   r   s   @@r   r   r      s¬   ù‡ € ñð.  × 3Ñ 3°X¸{×?VÑ?VÐW€Oà×Ñð ð €K÷Põ P÷	ò7ð ÷-ó ð-ð ÷(ó ð(ð ÷'ó ð'ð -2¯JªJ«L÷ ?ò ?÷
!ò 
!r   c                   ó  a a€ ] tR t^mt 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]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tRtVtV ;t# )r   a¯  
Creates a RelaxedOneHotCategorical distribution parametrized by
:attr:`temperature`, and either :attr:`probs` or :attr:`logits`.
This is a relaxed version of the :class:`OneHotCategorical` distribution, so
its samples are on simplex, and are reparametrizable.

Example::

    >>> # xdoctest: +IGNORE_WANT("non-deterministic")
    >>> m = RelaxedOneHotCategorical(torch.tensor([2.2]),
    ...                              torch.tensor([0.1, 0.2, 0.3, 0.4]))
    >>> m.sample()
    tensor([ 0.1294,  0.2324,  0.3859,  0.2523])

Args:
    temperature (Tensor): relaxation temperature
    probs (Tensor): event probabilities
    logits (Tensor): unnormalized log probability for each event
r   r   Tc          
      ó`   <€ V ^8„  d   QhRS[ RS[ R,          RS[ R,          RS[R,          RR/# r   r   )r   r   s   "€r   r   Ú%RelaxedOneHotCategorical.__annotate__‰   sP   ø€ ÷ 
Qñ 
Qáð
Qñ ˜�}ð
Qñ ˜•ð	
Qñ
 ˜d•{ð
Qð 
ñ
Qr   c                óV   <€ \        WW4R 7      p\        SV `	  V\        4       VR 7       R# )r"   N)r   r'   r(   r	   )r)   r   r   r   r   Ú	base_distr+   s   &&&&& €r   r(   Ú!RelaxedOneHotCategorical.__init__‰   s,   ø€ ô *Ø ô
ˆ	ô 	‰Ñ˜¤L£NÀ-ÐÖPr   c                óP   <€ V P                  \        V4      p\        SV `  WR 7      # ))r4   )r.   r   r'   r1   r3   s   &&& €r   r1   ÚRelaxedOneHotCategorical.expand•   s'   ø€ Ø×(Ñ(Ô)AÀ9ÓMˆÜ‰w‰~˜kˆ~Ó9Ð9r   c                ó    <€ V ^8„  d   QhRS[ /# r>   r   )r   r   s   "€r   r   rz   š   s   ø€ ÷ *ñ *™Vñ *r   c                ó.   € V P                   P                  # r8   )r|   r   r@   s   &r   r   Ú$RelaxedOneHotCategorical.temperature™   s   € à�~‰~×)Ñ)Ð)r   c                ó    <€ V ^8„  d   QhRS[ /# r>   r   )r   r   s   "€r   r   rz   ž   s   ø€ ÷ %ñ %™ñ %r   c                ó.   € V P                   P                  # r8   )r|   r   r@   s   &r   r   ÚRelaxedOneHotCategorical.logits�   s   € à�~‰~×$Ñ$Ð$r   c                ó    <€ V ^8„  d   QhRS[ /# r>   r   )r   r   s   "€r   r   rz   ¢   s   ø€ ÷ $ñ $‘vñ $r   c                ó.   € V P                   P                  # r8   )r|   r   r@   s   &r   r   ÚRelaxedOneHotCategorical.probs¡   s   € à�~‰~×#Ñ#Ð#r   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )r   r|   )r   )r   r   s   "€r   r   rz   m   s   ø‡ ‚ ñ4 %Ñ$ò5 r   © rh   r8   )ri   rj   rk   rl   rm   r   rn   ro   rp   rq   rr   r(   r1   rs   r   r   r   Ú__annotate_func__rt   ru   rv   rw   s   @@r   r   r   m   s‹   ù‡ € ñð(  × 3Ñ 3°X¸{×?VÑ?VÐW€Oà×!Ñ!€GØ€K÷
Qõ 
Q÷:ð ÷*ó ð*ð ÷%ó ð%ð ÷$ó ð$÷k … r   )r/   r   Útorch.distributionsr   Útorch.distributions.categoricalr   Ú torch.distributions.distributionr   Ú,torch.distributions.transformed_distributionr   Útorch.distributions.transformsr	   Útorch.distributions.utilsr
   r   Útorch.typesr   Ú__all__r   r   rŠ   r   r   Ú<module>r”      sK   ðó Ý Ý +Ý 7Ý 9Ý PÝ 7ß @Ý ð #Ð$>Ð
?€ôY!˜Lô Y!ôx6$Ð6ö 6$r   