+
    &j[                     n    ^ RI t ^ RI HtHt ^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
Ht R.t ! R R]	4      tR# )	    N)infTensor)Categoricalconstraints)Binomial)Distribution)broadcast_allMultinomialc                     a a ] tR t^t oRtR]P                  R]P                  /t]	V3R lR l4       t
]	V3R lR l4       tRV3R lV 3R	 llltRV 3R
 lltR t]P                  ! R^R7      R 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V3R ltRtVtV ;t# )r
   a  
Creates a Multinomial distribution parameterized by :attr:`total_count` and
either :attr:`probs` or :attr:`logits` (but not both). The innermost dimension of
:attr:`probs` indexes over categories. All other dimensions index over batches.

Note that :attr:`total_count` need not be specified if only :meth:`log_prob` is
called (see example below)

.. 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.

-   :meth:`sample` requires a single shared `total_count` for all
    parameters and samples.
-   :meth:`log_prob` allows different `total_count` for each parameter and
    sample.

Example::

    >>> # xdoctest: +SKIP("FIXME: found invalid values")
    >>> m = Multinomial(100, torch.tensor([ 1., 1., 1., 1.]))
    >>> x = m.sample()  # equal probability of 0, 1, 2, 3
    tensor([ 21.,  24.,  30.,  25.])

    >>> Multinomial(probs=torch.tensor([1., 1., 1., 1.])).log_prob(x)
    tensor([-4.1338])

Args:
    total_count (int): number of trials
    probs (Tensor): event probabilities
    logits (Tensor): event log probabilities (unnormalized)
probslogitsc                    < V ^8  d   QhRS[ /#    returnr   )format__classdict__s   "w/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributions/multinomial.py__annotate__Multinomial.__annotate__9   s     - -f -    c                <    V P                   V P                  ,          # N)r   total_countselfs   &r   meanMultinomial.mean8   s    zzD,,,,r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   r   =   s     @ @& @r   c                l    V P                   V P                  ,          ^V P                  ,
          ,          # )   r   r   r   s   &r   varianceMultinomial.variance<   s$    $**,DJJ??r   c          
      `   < V ^8  d   QhRS[ RS[R,          RS[R,          RS[R,          RR/# )r   r   r   Nr   validate_argsr   )intr   bool)r   r   s   "r   r   r   @   sP     P PP }P 	P
 d{P 
Pr   c                .  < \        V\        4      '       g   \        R 4      hWn        \	        W#R7      V n        \        WP                  R7      V n        V P
                  P                  pV P
                  P                  RR p\        SV `1  WVVR7       R# )z*inhomogeneous total_count is not supported)r   r   r#   Nr'   )
isinstancer(   NotImplementedErrorr   r   _categoricalr   r   	_binomialbatch_shapeparam_shapesuper__init__)r   r   r   r   r'   r1   event_shape	__class__s   &&&&&  r   r4   Multinomial.__init__@   s|     +s++%&RSS&'eC!kL''33''33BC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/   expandr3   r4   r5   _validate_args)r   r1   	_instancenewr6   s   &&& r   r<   Multinomial.expandQ   s}    ((i@jj-**,,33K@k3()) 	) 	
 "00
r   c                :    V P                   P                  ! V/ VB # r   )r/   _new)r   argskwargss   &*,r   rB   Multinomial._new\   s      %%t6v66r   T)is_discrete	event_dimc                B    \         P                  ! V P                  4      # r   )r   multinomialr   r   s   &r   supportMultinomial.support_   s     &&t'7'788r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   r   e   s     ( ( (r   c                .    V P                   P                  # r   )r/   r   r   s   &r   r   Multinomial.logitsd   s      '''r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   r   i   s     ' 'v 'r   c                .    V P                   P                  # r   )r/   r   r   s   &r   r   Multinomial.probsh   s      &&&r   c                4   < V ^8  d   QhRS[ P                  /# r   )r:   r;   )r   r   s   "r   r   r   m   s     - -UZZ -r   c                .    V P                   P                  # r   )r/   r2   r   s   &r   r2   Multinomial.param_shapel   s      ,,,r   c                4   \         P                  ! V4      pV P                  P                  \         P                  ! V P                  34      V,           4      p\        \        VP                  4       4      4      pVP                  VP                  ^ 4      4       VP                  ! V!  pVP                  V P                  V4      4      P                  4       pVP                  RV\         P                  ! V4      4       VP!                  V P"                  4      # )r   r,   )r:   r;   r/   sampler   listrangedimappendpoppermuter?   _extended_shapezero_scatter_add_	ones_liketype_asr   )r   sample_shapesamplesshifted_idxcountss   &&   r   rV   Multinomial.samplep   s    zz,/##**JJ((*+l:

 5/0;??1-.//;/T11,?@FFHB)AB~~djj))r   c                   \         P                  ! V P                  4      pV P                  P	                  4       pW,          \         P
                  ! V^,           4      ,
          pV P                  P                  RR7      R,          p\         P                  ! V P                  P                  V4      4      p\         P
                  ! V^,           4      pWV,          P                  ^ R.4      pW7,           # )r"   F)r<   :r"   NNr,   )r:   tensorr   r/   entropylgammar0   enumerate_supportexplog_probsum)r   ncat_entropyterm1rJ   binomial_probsweightsterm2s   &       r   ri   Multinomial.entropy~   s    LL))*''//1%,,q1u"55..22%2@D4>>#:#:7#CD,,w{+)..2w7}r   c                   V P                   '       d   V P                  V4       \        V P                  V4      w  r!VP	                  \
        P                  R 7      p\
        P                  ! VP                  R4      ^,           4      p\
        P                  ! V^,           4      P                  R4      p^ W!^ 8H  V\        ) 8H  ,          &   W!,          P                  R4      pW4,
          V,           # ))memory_formatr,   )
r=   _validate_sampler	   r   cloner:   contiguous_formatrj   rn   r   )r   valuer   log_factorial_nlog_factorial_xs
log_powerss   &&    r   rm   Multinomial.log_prob   s    !!%(%dkk59E,C,CD,,uyy}q'89 <<	266r:23
v#~./n))"-
1J>>r   c                &   < V ^8  d   Qh/ S[ ;R&   # )r   r   )r(   )r   r   s   "r   r   r      s     P Q r   )r0   r/   r   )r"   NNNr   )__name__
__module____qualname____firstlineno____doc__r   simplexreal_vectorarg_constraintspropertyr   r$   r4   r<   rB   dependent_propertyrJ   r   r   r2   r:   r;   rV   ri   rm   __annotate_func____static_attributes____classdictcell____classcell__)r6   r   s   @@r   r
   r
      s     #L  3 3X{?V?VWO - - @ @P P"	7 ##B9 C9 ( ( ' ' - - #(**, *	?{  r   )r:   r   r   torch.distributionsr   r   torch.distributions.binomialr    torch.distributions.distributionr   torch.distributions.utilsr	   __all__r
    r   r   <module>r      s0      8 1 9 3 /F?, F?r   