12 Samples from a two-parameter Weibull distribution. 16 >>> m = Weibull(torch.tensor([1.0]), torch.tensor([1.0])) 17 >>> m.sample() # sample from a Weibull distribution with scale=1, concentration=1 21 scale (float or Tensor): Scale parameter of distribution (lambda). 22 concentration (float or Tensor): Concentration parameter of distribution (k/shape). 24 arg_constraints = {
'scale': constraints.positive,
'concentration': constraints.positive}
25 support = constraints.positive
27 def __init__(self, scale, concentration, validate_args=None):
28 self.scale, self.
concentration = broadcast_all(scale, concentration)
30 base_dist =
Exponential(torch.ones_like(self.scale))
33 super(Weibull, self).__init__(base_dist,
35 validate_args=validate_args)
37 def expand(self, batch_shape, _instance=None):
39 new.scale = self.scale.expand(batch_shape)
40 new.concentration = self.concentration.expand(batch_shape)
41 new.concentration_reciprocal = new.concentration.reciprocal()
42 base_dist = self.base_dist.expand(batch_shape)
43 transforms = [
PowerTransform(exponent=new.concentration_reciprocal),
45 super(Weibull, new).__init__(base_dist,
def _get_checked_instance(self, cls, _instance=None)