FilesLast commitLast update
5 months ago
5 months ago
4 months ago
22 days ago
3 months ago
25 days ago
22 days ago
10 days ago
5 days ago
README

StatelessNormal

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: generates a random number tensor that follows the normal distribution based on the specified mean and standard deviation (stdev). It uses the counter-based Philox4x32-10 random number generation algorithm and the Box-Muller transform, strictly matching GPU precision (the same seed + offset produces the same random sequence), and supports mean and stdev in the form of a scalar or a tensor.

  • Computation formula:

    y=BoxMuller(Philox(seed,offset))×stdev+meany = BoxMuller(Philox(seed, offset)) \times stdev + mean

    Here, mean and stdev are a scalar or a tensor. When they are tensors, only item 0 participates in the computation. All output elements share this set of mean and standard deviation values, and the remaining elements do not participate in the computation.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
shape Input Shape of the output tensor. INT64 ND
seed Input Seed of the Philox random number generator. INT64 ND
offset Input Offset of the Philox random number generator, which must be a multiple of 4. INT64 ND
mean Input Mean of the normal distribution, which can be a scalar or a tensor. When it is a tensor, only item 0 participates in the computation, and all output elements share this mean. FLOAT, FLOAT16, BF16 ND
stdev Input Standard deviation of the normal distribution, which can be a scalar or a tensor. When it is a tensor, only item 0 participates in the computation, and all output elements share this standard deviation. FLOAT, FLOAT16, BF16 ND
y Output Outputs random values that follow the normal distribution with the specified shape. FLOAT, BF16, FLOAT16 ND

Constraint Description

  • offset must be a multiple of 4.
  • The data types of mean and stdev must be in lockstep with the output y.
  • When mean and stdev are tensors, only item 0 participates in the computation. All output elements share this set of mean and standard deviation values, and the remaining elements do not participate in the computation.
  • Only the SIMT programming model is supported (Ascend 950 series).

Invocation Description

Invocation Method Sample Code Description
aclnn invocation test_aclnn_stateless_normal.cpp Invokes the StatelessNormal operator through the aclnnInplaceNormal API, where both mean and stdev are scalars.