FilesLast commitLast update
4 days ago
16 days ago
3 months ago
5 days ago
13 days ago
5 days ago
2 months ago
13 days ago
5 days ago
1 month ago
11 days ago
README

Sign

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: performs the Sign function computation on the input tensor element-wise and outputs the result tensor.

  • Computation formula:

    resultputi={1,inputi>00,inputi=0−1,inputi<0resultput_i = \left\{ \begin{aligned} 1,\quad input_i > 0\\ 0,\quad input_i = 0\\ -1,\quad input_i < 0 \end{aligned} \right.

  • Computation formula (BOOL type):

    resultputi={True,inputi=TrueFalse,inputi=Falseresultput_i = \left\{ \begin{aligned} \text{True},\quad input_i = \text{True}\\ \text{False},\quad input_i = \text{False}\\ \end{aligned} \right.

  • Computation formula (complex number, where real and imag below indicate taking the real part and the imaginary part respectively):

    resultputi=α⋅cos(θi)+β⋅sin(θi)α={1,real(inputi)>00,real(inputi)=0−1,real(inputi)<0β={1,imag(inputi)>00,imag(inputi)=0−1,imag(inputi)<0θi=arctan(imag(inputi)real(inputi))resultput_i = \alpha \cdot cos(\theta_i) + \beta \cdot sin(\theta_i) \\ \alpha = \left\{ \begin{aligned} 1,\quad real(input_i) > 0 \\ 0,\quad real(input_i) = 0 \\ -1,\quad real(input_i) < 0 \\ \end{aligned} \right. \\ \beta = \left\{ \begin{aligned} 1,\quad imag(input_i) > 0 \\ 0,\quad imag(input_i) = 0 \\ -1,\quad imag(input_i) < 0 \\ \end{aligned} \right. \\ \theta_i = arctan(\frac{imag(input_i)}{real(input_i)})

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input parameter for the sign computation, which is input_i in the formula. FLOAT, FLOAT16, BFLOAT16, INT32, INT64, DOUBLE, INT8, INT16, UINT8, UINT16, UINT32, UINT64, COMPLEX64, COMPLEX128, BOOL ND
y Output Output parameter of the sign computation, which is resultput_i in the formula. FLOAT, FLOAT16, BFLOAT16, INT32, INT64, DOUBLE, INT8, INT16, UINT8, UINT16, UINT32, UINT64, COMPLEX64, COMPLEX128, BOOL ND
  • The INT8, INT16, UINT8, UINT16, UINT32, and UINT64 types are supported only through the geir invocation.
  • The BOOL, DOUBLE, COMPLEX64, and COMPLEX128 types are supported only through the aclnn invocation.

Constraint Description

None

Invocation Description

Invocation Method Invocation Sample Description
aclnn invocation test_aclnn_sign Invokes the Sign operator through the aclnnSign API.