/usr/local/lib64/python3.6/site-packages/torch/distributions/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/distributions/__pycache__/weibull.cpython-36.pyc (2737B)
3
Eg& @ sh d dl Z d dlmZ d dlmZ d dlmZ d dlmZm Z d dl
mZ d dlm
Z
G dd d eZdS )
N)constraints)Exponential)TransformedDistribution)AffineTransformPowerTransform)
broadcast_all)euler_constantc sd e Zd ZdZejejdZejZd fdd Zd fdd Z e
dd Ze
d
d Zdd
Z
ZS )Weibulla
Samples from a two-parameter Weibull distribution.
Example:
>>> m = Weibull(torch.tensor([1.0]), torch.tensor([1.0]))
>>> m.sample() # sample from a Weibull distribution with scale=1, concentration=1
tensor([ 0.4784])
Args:
scale (float or Tensor): Scale parameter of distribution (lambda).
concentration (float or Tensor): Concentration parameter of distribution (k/shape).
)scale
concentrationNc sf t ||\| _| _| jj | _ttj| j|d}t| jdt d| jdg}t
t| j|||d d S )N)
validate_args)exponentr )locr
)
r r
r
reciprocalconcentration_reciprocalr torchZ ones_liker r superr __init__)selfr
r r base_dist
transforms) __class__ G/usr/local/lib64/python3.6/site-packages/torch/distributions/weibull.pyr s
zWeibull.__init__c s| | j t|}| jj||_| jj||_|jj |_| jj|}t|jdt d|jdg}t
t|j||dd | j|_|S )N)r
r )r r
F)r )
Z_get_checked_instancer r
expandr r r r r r r r Z_validate_args)r Zbatch_shapeZ _instancenewr r )r r r r % s
zWeibull.expandc C s | j tjtjd| j S )N )r
r explgammar )r r r r mean3 s zWeibull.meanc C s@ | j jdtjtjdd| j tjdtjd| j S )N r )r
powr r r r )r r r r variance7 s "zWeibull.variancec C s$ t d| j tj| j| j d S )Nr )r r r logr
)r r r r entropy<