[docs]classPoisson(ExponentialFamily):r""" Creates a Poisson distribution parameterized by :attr:`rate`, the rate parameter. Samples are nonnegative integers, with a pmf given by .. math:: \mathrm{rate}^k \frac{e^{-\mathrm{rate}}}{k!} Example:: >>> # xdoctest: +SKIP("poisson_cpu not implemented for 'Long'") >>> m = Poisson(torch.tensor([4])) >>> m.sample() tensor([ 3.]) Args: rate (Number, Tensor): the rate parameter """arg_constraints={"rate":constraints.nonnegative}support=constraints.nonnegative_integer@propertydefmean(self):returnself.rate@propertydefmode(self):returnself.rate.floor()@propertydefvariance(self):returnself.ratedef__init__(self,rate,validate_args=None):(self.rate,)=broadcast_all(rate)ifisinstance(rate,Number):batch_shape=torch.Size()else:batch_shape=self.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.