W3cubDocs

/PyTorch 2.9

torch.Tensor.exponential_

Tensor.exponential_(lambd=1, *, generator=None) → Tensor

Fills self tensor with elements drawn from the PDF (probability density function):

f(x)=λeλx,x>0f(x) = \lambda e^{-\lambda x}, x > 0

Note

In probability theory, exponential distribution is supported on interval [0, inf\inf) (i.e., x>=0x >= 0) implying that zero can be sampled from the exponential distribution. However, torch.Tensor.exponential_() does not sample zero, which means that its actual support is the interval (0, inf\inf).

Note that torch.distributions.exponential.Exponential() is supported on the interval [0, inf\inf) and can sample zero.

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.Tensor.exponential_.html