Bernoulli - version 15#

This page documents version 15 of operator Bernoulli. See Bernoulli for the latest version (since version 22).

  • Domain: ai.onnx

  • Since version: 15

Draws binary random numbers (0 or 1) from a Bernoulli distribution. The input tensor should be a tensor containing probabilities p (a value in the range [0,1]) to be used for drawing the binary random number, where an output of 1 is produced with probability p and an output of 0 is produced with probability (1-p).

This operator is non-deterministic and may not produce the same values in different implementations (even if a seed is specified).

Inputs

  • input (T1): All values in input have to be in the range:[0, 1].

Outputs

  • output (T2): The returned output tensor only has values 0 or 1, same shape as input tensor.

Attributes

  • dtype (int): The data type for the elements of the output tensor. if not specified, we will use the data type of the input tensor.

  • seed (float): (Optional) Seed to the random generator, if not specified we will auto generate one.

Type Constraints

  • T1: Constrain input types to float tensors. Allowed types: tensor(double), tensor(float), tensor(float16).

  • T2: Constrain output types to all numeric tensors and bool tensors. Allowed types: tensor(bfloat16), tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8).