pytorch / 2 / generated / torch.tensor.bernoulli.html

torch.Tensor.bernoulli

Tensor.bernoulli(*, generator=None) → Tensor

Returns a result tensor where each result[i] \texttt{result[i]} is independently sampled from Bernoulli ( self[i] ) \text{Bernoulli}(\texttt{self[i]}) . self must have floating point dtype, and the result will have the same dtype.

See torch.bernoulli()

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