torch.Tensor.Tensor.bernoulli
Tensor.bernoulli(options?: BernoulliOptions): Tensor<S, D, Dev>Tensor.bernoulli(generator: unknown, options?: BernoulliOptions): Tensor<S, D, Dev>Returns a tensor with Bernoulli samples (0 or 1) from this tensor's values as probabilities. If a generator is provided, it is used for sampling.
Parameters
optionsBernoulliOptionsoptional
Returns
Tensor<S, D, Dev>– A new tensor with the same shape filled with 0s and 1s