StatelessRandom
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: returns random numbers drawn from the discrete uniform distribution over the range [from, to - 1].
- Computation formula:
output[i]=X%(to−from)+fromoutput[i] = X \% (to - from) + from
Here, X is a uint32 random number generated by the Philox random number generator.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| shape | Input | Shape dimensions of the output tensor. | INT64 | ND |
| seed | Input | Random number seed. | INT64 | ND |
| offset | Input | Random number offset, which must be a multiple of 4. | INT64 | ND |
| from | Input | Optional parameter, which is the lower bound of the random number range. | INT64 | ND |
| to | Input | Optional parameter, which is the upper bound of the random number range. | INT64 | ND |
| y | Output | Output tensor, which contains random values within the specified range. | FLOAT, FLOAT16, BFLOAT16, INT64, INT32, INT16, INT8, UINT8, BOOL | ND |
| dtype | Attribute | Data type of the output tensor. | DataType | - |
Constraint Description
- offset is a multiple of 4.
- The output tensor supports 0 to 8 dimensions.
- from must be less than to. The range specified by from/to-1 cannot exceed the range of the self data type.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| aclnn invocation | test_aclnn_inplace_random | Invokes the StatelessRandom operator through the aclnnInplaceRandom or aclnnInplaceRandomTensor API. |
| Graph-mode invocation | test_geir_stateless_random | Invokes the StatelessRandom operator by building a graph through the operator IR. |