Ndtri

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: computes the inverse standard normal cumulative distribution function (probit / inverse normal CDF). It computes the standard normal quantile element by element for the input probability tensor. The bottom layer uses the piecewise rational approximation algorithm of the Cephes math library.

  • Computation formula:

yi=ndtri(xi)=Φ−1(xi)=2⋅erf−1(2xi−1),xi∈(0,1)y_i = \mathrm{ndtri}(x_i) = \Phi^{-1}(x_i) = \sqrt{2} \cdot \mathrm{erf}^{-1}(2 x_i - 1), \quad x_i \in (0, 1)

  • Special value handling:
Input xix_i Output yiy_i
0 -inf
1 +inf
Positive and negative FP32/BF16 subnormal values -inf; the inputs are treated as zero during computation
xi<0x_i < 0 (excluding the subnormal values above) or xi>1x_i > 1 NaN
NaN / +inf / -inf NaN

FP16 inputs are first promoted to FP32. FP16 subnormal values become normal FP32 values and are processed by the original numerical algorithm.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Probability tensor for the ndtri computation, which is x_i in the formula. The recommended value range is (0, 1). FLOAT, FLOAT16, BFLOAT16 ND
y Output Computation result of the inverse standard normal CDF, which is y_i in the formula. The output has the same shape and data type as the input. A scalar input produces a scalar output, and an empty tensor produces an empty tensor of the same shape. FLOAT, FLOAT16, BFLOAT16 ND

Constraint Description

  • The input x has at most 8 dimensions.
  • At runtime, each dimension of input x must be a non-negative integer, and the total number of elements must not exceed the maximum value of INT64.

Invocation Description

Invocation Method Sample Code Description
GE graph mode test_geir_ndtri Invokes the Ndtri operator by building a graph through the operator IR.