+
    &j                         ^ RI HtHt ^ RIt^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt R.t]! R	]	R
7      t ! R R]	]],          4      tR# )    )GenericTypeVarN)SizeTensor)constraints)Distribution)_sum_rightmost)_sizeIndependentD)boundc                     a a ] tR t^t oRt/ 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
]P                  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V3R lR llt]P$                  ! 4       3V3R lR lltR tR tRR ltR tV3R ltRtVtV ;t# )r   aI  
Reinterprets some of the batch dims of a distribution as event dims.

This is mainly useful for changing the shape of the result of
:meth:`log_prob`. For example to create a diagonal Normal distribution with
the same shape as a Multivariate Normal distribution (so they are
interchangeable), you can::

    >>> from torch.distributions.multivariate_normal import MultivariateNormal
    >>> from torch.distributions.normal import Normal
    >>> loc = torch.zeros(3)
    >>> scale = torch.ones(3)
    >>> mvn = MultivariateNormal(loc, scale_tril=torch.diag(scale))
    >>> [mvn.batch_shape, mvn.event_shape]
    [torch.Size([]), torch.Size([3])]
    >>> normal = Normal(loc, scale)
    >>> [normal.batch_shape, normal.event_shape]
    [torch.Size([3]), torch.Size([])]
    >>> diagn = Independent(normal, 1)
    >>> [diagn.batch_shape, diagn.event_shape]
    [torch.Size([]), torch.Size([3])]

Args:
    base_distribution (torch.distributions.distribution.Distribution): a
        base distribution
    reinterpreted_batch_ndims (int): the number of batch dims to
        reinterpret as event dims
c                >   < V ^8  d   QhRS[ RS[RS[R,          RR/# )   base_distributionreinterpreted_batch_ndimsvalidate_argsNreturn)r   intbool)format__classdict__s   "w/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributions/independent.py__annotate__Independent.__annotate__3   s=     P PP $'P d{	P
 
P    c                  < V\        VP                  4      8  d%   \        R V R\        VP                  4       24      hVP                  VP                  ,           pV\        VP                  4      ,           pVR\        V4      V,
           pV\        V4      V,
          R pWn        W n        \        SV `  WgVR7       R# )zQExpected reinterpreted_batch_ndims <= len(base_distribution.batch_shape), actual z vs Nr   )lenbatch_shape
ValueErrorevent_shape	base_distr   super__init__)	selfr   r   r   shape	event_dimr    r"   	__class__s	   &&&&    r   r%   Independent.__init__3   s     %s+<+H+H'II34D=N=Z=Z9[8\^  (336G6S6SS2S9J9V9V5WW	4c%j945CJ245*)B&Or   c                \  < V P                  \        V4      p\        P                  ! V4      pV P                  P                  WP                  R V P                   ,           4      Vn        V P                  Vn        \        \        V`'  WP                  RR7       V P                  Vn
        V# )NFr   )_get_checked_instancer   torchr   r#   expandr"   r   r$   r%   _validate_args)r&   r    	_instancenewr)   s   &&& r   r.   Independent.expandG   s    ((i@jj---**+KT-K-KLL
 )-(F(F%k3()) 	) 	
 "00
r   c                    < V ^8  d   QhRS[ /# r   r   r   )r   r   s   "r   r   r   U   s     * *T *r   c                .    V P                   P                  # N)r#   has_rsampler&   s   &r   r8   Independent.has_rsampleT   s    ~~)))r   c                    < V ^8  d   QhRS[ /# r4   r5   )r   r   s   "r   r   r   Y   s     4 4t 4r   c                T    V P                   ^ 8  d   R# V P                  P                  # )r   F)r   r#   has_enumerate_supportr9   s   &r   r=   !Independent.has_enumerate_supportX   s#    ))A-~~333r   c                    V P                   P                  pV P                  '       d!   \        P                  ! WP                  4      pV# r7   )r#   supportr   r   independent)r&   results   & r   r@   Independent.support^   s:     ''))) ,,V5S5STFr   c                    < V ^8  d   QhRS[ /# r4   r   )r   r   s   "r   r   r   g        # #f #r   c                .    V P                   P                  # r7   )r#   meanr9   s   &r   rH   Independent.meanf       ~~"""r   c                    < V ^8  d   QhRS[ /# r4   rE   )r   r   s   "r   r   r   k   rF   r   c                .    V P                   P                  # r7   )r#   moder9   s   &r   rM   Independent.modej   rJ   r   c                    < V ^8  d   QhRS[ /# r4   rE   )r   r   s   "r   r   r   o   s     ' '& 'r   c                .    V P                   P                  # r7   )r#   variancer9   s   &r   rQ   Independent.variancen   s    ~~&&&r   c                    < V ^8  d   QhRS[ /# r4   rE   )r   r   s   "r   r   r   r   s     3 36 3r   c                8    V P                   P                  V4      # r7   )r#   sampler&   sample_shapes   &&r   rU   Independent.sampler   s    ~~$$\22r   c                &   < V ^8  d   QhRS[ RS[/# )r   rW   r   )r
   r   )r   r   s   "r   r   r   u   s     4 4E 4V 4r   c                8    V P                   P                  V4      # r7   )r#   rsamplerV   s   &&r   r[   Independent.rsampleu   s    ~~%%l33r   c                b    V P                   P                  V4      p\        W P                  4      # r7   )r#   log_probr	   r   )r&   valuer^   s   && r   r^   Independent.log_probx   s'    >>**51h(F(FGGr   c                `    V P                   P                  4       p\        WP                  4      # r7   )r#   entropyr	   r   )r&   rb   s   & r   rb   Independent.entropy|   s%    ..((*g'E'EFFr   c                r    V P                   ^ 8  d   \        R4      hV P                  P                  VR7      # )r   z5Enumeration over cartesian product is not implemented)r.   )r   NotImplementedErrorr#   enumerate_support)r&   r.   s   &&r   rf   Independent.enumerate_support   s:    ))A-%G  ~~//v/>>r   c                r    V P                   P                  R V P                   RV P                   R2,           # )(z, ))r)   __name__r#   r   r9   s   &r   __repr__Independent.__repr__   s8    NN##$..!D$B$B#C1EF	
r   c                \   < V ^8  d   Qh/ S[ S[S[P                  3,          ;R&   S[;R&   # )r   arg_constraintsr#   )dictstrr   
Constraintr   )r   r   s   "r   r   r      s.     < #{5556;= > L? r   )r#   r   r7   )T)rk   
__module____qualname____firstlineno____doc__ro   r%   r.   propertyr8   r=   r   dependent_propertyr@   rH   rM   rQ   r-   r   rU   r[   r^   rb   rf   rl   __annotate_func____static_attributes____classdictcell____classcell__)r)   r   s   @@r   r   r      s     : :<OP P( * * 4 4
 ## $ # # # # ' ' #(**, 3 3 -2JJL 4 4HG?
k  r   )typingr   r   r-   r   r   torch.distributionsr    torch.distributions.distributionr   torch.distributions.utilsr	   torch.typesr
   __all__r   r    r   r   <module>r      sE    #   + 9 4  / C|$y
,
 y
r   