FilesLast commitLast update
12 days ago
12 days ago
2 months ago
12 days ago
5 days ago
12 days ago
12 days ago
5 days ago
24 days ago
12 days ago
5 days ago
README

stateless_bernoulli

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products ×
Atlas A2 products ×
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×

Function Description

  • Operator function: Extracts binary random numbers (0 or 1) from the Bernoulli distribution. prob is the probability of generating a binary random number, and the input tensor specifies the shape.

  • Computation formula:

    out∼Bernoulli(prob)out∼Bernoulli(prob)

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
shape Input Shape of the random numbers. INT32, INT64 ND
prob Input Keep probability. FLOAT16, BF16, FLOAT ND
seed Input Obtains the random seed. INT64 ND
offset Input Step size for obtaining values. INT64 ND
y Output Obtains the output tensor. INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, BOOL, FLOAT16, BFLOAT16, FLOAT ND
dtype Attribute Data type of the output. INT (ge::DataType enumeration value, default DT_FLOAT) -
probMode Attribute (Optional) Semantic mode of prob: 1 = scalar semantics (prob is a single-element tensor, and its value is used as the probability); 0 = tensor semantics (prob is a probability tensor whose shape must be broadcastable to the output shape). Default 0. INT -

Constraint Description

  • When probMode=0, the shape of prob must be broadcastable to the output shape. Output tensors with more than 8 dimensions are not supported.
  • When probMode=1, prob must be a single-element tensor.

Invocation Description

Invocation Method Sample Code Description
aclnn invocation test_aclnn_bernoulli_tensor Invokes the stateless_bernoulli operator through the aclnnBernoulliTensor API.
aclnn invocation test_aclnn_bernoulli Invokes the stateless_bernoulli operator through the aclnnBernoulli API.