o
    /ôjš  ã                   @   sZ   d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
 dgZG dd„ deƒZdS )	é    )Úconstraints)ÚExponential)ÚTransformedDistribution)ÚAffineTransformÚExpTransform)Úbroadcast_allÚParetoc                       s€   e Zd ZdZejejdœZd‡ fdd„	Zd‡ fdd„	Ze	dd	„ ƒZ
e	d
d„ ƒZe	dd„ ƒZejddd�dd„ ƒZdd„ Z‡  ZS )r   aÃ  
    Samples from a Pareto Type 1 distribution.

    Example::

        >>> # xdoctest: +IGNORE_WANT("non-deterministic")
        >>> m = Pareto(torch.tensor([1.0]), torch.tensor([1.0]))
        >>> m.sample()  # sample from a Pareto distribution with scale=1 and alpha=1
        tensor([ 1.5623])

    Args:
        scale (float or Tensor): Scale parameter of the distribution
        alpha (float or Tensor): Shape parameter of the distribution
    )ÚalphaÚscaleNc                    sJ   t ||ƒ\| _| _t| j|d�}tƒ td| jd�g}tƒ j|||d� d S )N)Úvalidate_argsr   )Úlocr
   )r   r
   r	   r   r   r   ÚsuperÚ__init__)Úselfr
   r	   r   Ú	base_distÚ
transforms©Ú	__class__© úk/var/www/html/academy/tools/voices/clone/sv-venv/lib/python3.10/site-packages/torch/distributions/pareto.pyr      s   zPareto.__init__c                    s8   |   t|¡}| j |¡|_| j |¡|_tƒ j||d�S )N)Ú	_instance)Ú_get_checked_instancer   r
   Úexpandr	   r   )r   Úbatch_shaper   Únewr   r   r   r   "   s   zPareto.expandc                 C   s    | j jdd�}|| j |d  S )Né   ©Úmin)r	   Úclampr
   ©r   Úar   r   r   Úmean(   s   zPareto.meanc                 C   s   | j S ©N)r
   ©r   r   r   r   Úmode.   s   zPareto.modec                 C   s4   | j jdd�}| j d¡| |d  d¡|d   S )Né   r   r   )r	   r   r
   Úpowr   r   r   r   Úvariance2   s   &zPareto.varianceFr   )Úis_discreteÚ	event_dimc                 C   s   t  | j¡S r"   )r   Úgreater_than_eqr
   r#   r   r   r   Úsupport8   s   zPareto.supportc                 C   s   | j | j  ¡ d| j ¡   S )Nr   )r
   r	   ÚlogÚ
reciprocalr#   r   r   r   Úentropy<   s   zPareto.entropyr"   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚpositiveÚarg_constraintsr   r   Úpropertyr!   r$   r'   Údependent_propertyr+   r.   Ú__classcell__r   r   r   r   r      s    



N)Ztorch.distributionsr   Ztorch.distributions.exponentialr   Ú,torch.distributions.transformed_distributionr   Ztorch.distributions.transformsr   r   Útorch.distributions.utilsr   Ú__all__r   r   r   r   r   Ú<module>   s   