FilesLast commitLast update
20 days ago
1 month ago
20 days ago
19 days ago
3 months ago
20 days ago
19 days ago
1 month ago
5 days ago
README

StatelessExponential

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 random numbers that follow the exponential distribution with the parameter lambd based on the Philox4x32-10 PRNG, and fills the input tensor self in place with random numbers that follow the Exp(lambd) distribution. This operator is an internal service operator used by the without-replacement sampling path of the aclnnMultinomialTensor API on Ascend 950 (it generates exponentially distributed random perturbations for the subsequent div + argmax/topk to complete without-replacement multinomial sampling).

  • Computation formula:

    x=−1λln⁡(u),u∼U(0,1]x = -\frac{1}{\lambda} \ln(u), \quad u \sim U(0, 1]

    Here, u is generated by the Philox4x32-10 PRNG, and lambd > 0 is the rate parameter of the exponential distribution.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
self Input/Output Tensor to be filled (written in place), which determines the total number of generated random numbers and the output dtype; ≤8 dimensions. FLOAT16, BFLOAT16, FLOAT ND
seed Input Seed of the random number generator, which affects the generated random number sequence. INT64 ND
offset Input Offset of the random number generator, which must be a multiple of 4. INT64 ND
lambd Attribute Rate parameter λ of the exponential distribution, which must be greater than 0. FLOAT -

Constraint Description

  1. self supports only FLOAT16/BFLOAT16/FLOAT, the ND format, and at most 8 dimensions; non-contiguous inputs are converted to contiguous ones by AutoContiguous.
  2. lambd must be > 0.
  3. offset must be a multiple of 4.
  4. Only Ascend 950 is supported. Graph building (op_graph), the L2 APIs, and non-contiguous tensors are not supported.

Invocation Description

Invocation Method Sample Code Description
aclnn invocation test_aclnn_multinomial_tensor The StatelessExponential service operator is invoked internally when the computation flow is built through the aclnnMultinomialTensor API.
aclnn invocation test_aclnn_stateless_exponential Invokes the StatelessExponential operator through the aclnnStatelessExponentialTensor API.