FilesLast commitLast update
2 months ago
5 months ago
5 months ago
22 days ago
5 months ago
10 days ago
22 days ago
1 month ago
5 days ago
README

StatelessUniform

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 uniform distribution based on the Philox4x32-10 pseudo-random number generation algorithm. The random values are in the range [from, to).

  • Computation formula:

    yi=ui×(to−from)+from,ui∼Uniform(0,1]y_i = u_i \times (to - from) + from, \quad u_i \sim \text{Uniform}(0, 1]

    Here, uiu_i is generated by the Philox4x32-10 algorithm. The normalization method is the same as that of the competitor curand_uniform: u=x×2−32+2−33u = x \times 2^{-32} + 2^{-33}.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
shape Input Shape of the output tensor, a 1-D tensor. INT64 ND
seed Input Random number seed of the Philox algorithm, a 0-D scalar. INT64 ND
offset Input Offset of the Philox algorithm, a 0-D scalar. It must be a multiple of 4. INT64 ND
from Input Inclusive lower bound of the uniform distribution random range, a 0-D scalar. DOUBLE ND
to Input Exclusive upper bound of the uniform distribution random range, a 0-D scalar. DOUBLE ND
y Output Outputs uniform distribution random values with the specified shape, with the value range [from, to). FLOAT16, BFLOAT16, FLOAT32 ND
dtype Attribute Data type of the output, which is FLOAT32 by default. Type -

Constraint Description

  • offset must be a multiple of 4.
  • The output tensor supports 0 to 8 dimensions.
  • from must be less than or equal to to, and to - from cannot exceed the representation range of the output data type.

Invocation Description

Invocation Method Sample Code Description
aclnn invocation test_aclnn_stateless_uniform Invokes the StatelessUniform operator through the aclnnInplaceUniform API.
Graph-mode invocation test_geir_stateless_uniform Invokes the StatelessUniform operator by building a graph through the operator IR.