[docs]classHalfCauchy(TransformedDistribution):r""" Creates a half-Cauchy distribution parameterized by `scale` where:: X ~ Cauchy(0, scale) Y = |X| ~ HalfCauchy(scale) Example:: >>> # xdoctest: +IGNORE_WANT("non-deterinistic") >>> m = HalfCauchy(torch.tensor([1.0])) >>> m.sample() # half-cauchy distributed with scale=1 tensor([ 2.3214]) Args: scale (float or Tensor): scale of the full Cauchy distribution """arg_constraints={"scale":constraints.positive}support=constraints.nonnegativehas_rsample=Truedef__init__(self,scale,validate_args=None):base_dist=Cauchy(0,scale,validate_args=False)super().__init__(base_dist,AbsTransform(),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.