[docs]classCauchy(Distribution):r""" Samples from a Cauchy (Lorentz) distribution. The distribution of the ratio of independent normally distributed random variables with means `0` follows a Cauchy distribution. Example:: >>> # xdoctest: +IGNORE_WANT("non-deterinistic") >>> m = Cauchy(torch.tensor([0.0]), torch.tensor([1.0])) >>> m.sample() # sample from a Cauchy distribution with loc=0 and scale=1 tensor([ 2.3214]) Args: loc (float or Tensor): mode or median of the distribution. scale (float or Tensor): half width at half maximum. """arg_constraints={"loc":constraints.real,"scale":constraints.positive}support=constraints.realhas_rsample=Truedef__init__(self,loc,scale,validate_args=None):self.loc,self.scale=broadcast_all(loc,scale)ifisinstance(loc,Number)andisinstance(scale,Number):batch_shape=torch.Size()else:batch_shape=self.loc.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.