Skip to main content

ClikaRT::ops::bernoulli

function

bernoulli()​

Tensor bernoulli(Tensor probabilities, StreamOrDevice device = {})

Independent Bernoulli draws from per-element success probabilities.

Each output element is 1 with probability probabilities[i], else 0; shape and dtype mirror probabilities.

Parameters

  • probabilities: per-element success chances in [0, 1]; float dtype.
  • device: stream or device; default = the input's.

Returns: 0/1 draws, same shape and dtype as probabilities.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) on a non-float input.

Declared in ClikaRT/compute/ops.h, line 4020