[doc] clarify the range of sampled rv for torch.tensor.exponential_ (#113195)

Range of sampled random variable needs to be clarified for `torch.tensor.exponential_` whose supported interval is (0, inf) is different from [0, inf] of exponential distribution.

Background: https://github.com/pytorch/pytorch/pull/37984#discussion_r1059527457, https://github.com/pytorch/pytorch/issues/48841#issuecomment-1530439039, https://github.com/pytorch/pytorch/pull/91673#discussion_r1069955813

Pull Request resolved: https://github.com/pytorch/pytorch/pull/113195
Approved by: https://github.com/albanD
This commit is contained in:
min-jean-cho
2023-11-15 00:30:10 +00:00
committed by PyTorch MergeBot
parent f5ce4d8baf
commit 56c453233f

View File

@ -1909,11 +1909,19 @@ add_docstr_all(
r"""
exponential_(lambd=1, *, generator=None) -> Tensor
Fills :attr:`self` tensor with elements drawn from the exponential distribution:
Fills :attr:`self` tensor with elements drawn from the PDF (probability density function):
.. math::
f(x) = \lambda e^{-\lambda x}
f(x) = \lambda e^{-\lambda x}, x > 0
.. note::
In probability theory, exponential distribution is supported on interval [0, :math:`\inf`) (i.e., :math:`x >= 0`)
implying that zero can be sampled from the exponential distribution.
However, :func:`torch.Tensor.exponential_` does not sample zero,
which means that its actual support is the interval (0, :math:`\inf`).
Note that :func:`torch.distributions.exponential.Exponential` is supported on the interval [0, :math:`\inf`) and can sample zero.
""",
)