[docs]classExponential(ExponentialFamily):r""" Creates a Exponential distribution parameterized by :attr:`rate`. Example:: >>> # xdoctest: +IGNORE_WANT("non-deterinistic") >>> m = Exponential(torch.tensor([1.0])) >>> m.sample() # Exponential distributed with rate=1 tensor([ 0.1046]) Args: rate (float or Tensor): rate = 1 / scale of the distribution """arg_constraints={"rate":constraints.positive}support=constraints.nonnegativehas_rsample=True_mean_carrier_measure=0@propertydefmean(self):returnself.rate.reciprocal()@propertydefmode(self):returntorch.zeros_like(self.rate)@propertydefstddev(self):returnself.rate.reciprocal()@propertydefvariance(self):returnself.rate.pow(-2)def__init__(self,rate,validate_args=None):(self.rate,)=broadcast_all(rate)batch_shape=torch.Size()ifisinstance(rate,Number)elseself.rate.size()super().__init__(batch_shape,validate_args=validate_args)
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.