FilesLast commitLast update
8 days ago
2 months ago
3 months ago
18 days ago
5 months ago
18 days ago
3 months ago
2 months ago
1 month ago
19 days ago
9 days ago
README

Atan2

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 element-wise arctangent computation on input tensors self and other. self indicates the y-coordinate, and other indicates the x-coordinate. The computation result is the angle between the point (other, self) and the positive direction of the x-axis (in radians), with a value range of [-π, π]. Broadcasting is supported.

  • Computation formula:

    outi=atan2(selfi,otheri)out_{i}=atan2(self_{i}, other_{i})

    where selfiself_{i} indicates the ii-th element of the input tensor self, and otheriother_{i} indicates the ii-th element of the input tensor other. The computation result is determined by the quadrant in which (other, self) is located:

    outi={atan(selfi/otheri)+πif otheri<0,selfi≥0atan(selfi/otheri)−πif otheri<0,selfi<0atan(selfi/otheri)if otheri>0π/2if otheri=0,selfi>0−π/2if otheri=0,selfi<0nanif otheri=0,selfi=0out_{i}=\begin{cases} atan(self_{i}/other_{i})+\pi & \text{if } other_{i}<0, self_{i}\ge 0 \\ atan(self_{i}/other_{i})-\pi & \text{if } other_{i}<0, self_{i}<0 \\ atan(self_{i}/other_{i}) & \text{if } other_{i}>0 \\ \pi/2 & \text{if } other_{i}=0, self_{i}>0 \\ -\pi/2 & \text{if } other_{i}=0, self_{i}<0 \\ nan & \text{if } other_{i}=0, self_{i}=0 \end{cases}

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
self Input Input parameter for the atan2 computation, which is self_i in the formula and indicates the y-coordinate. The shape must satisfy the broadcast relationship with other. INT8, INT16, INT32, INT64, UINT8, BOOL, FLOAT, FLOAT16, DOUBLE, BFLOAT16 ND
other Input Input parameter for the atan2 computation, which is other_i in the formula and indicates the x-coordinate. The shape must satisfy the broadcast relationship with self. INT8, INT16, INT32, INT64, UINT8, BOOL, FLOAT, FLOAT16, DOUBLE, BFLOAT16 ND
out Output Output parameter for the atan2 computation, which is out_i in the formula. The shape is the shape of self and other after broadcasting. FLOAT, FLOAT16, DOUBLE, BFLOAT16 ND
  • The inputs self and other support the INT8, INT16, INT32, INT64, UINT8, and BOOL types. The API automatically converts them to floating-point types before the computation.
  • DOUBLE is computed through the AICPU path.
  • Atlas inference products and Atlas training products: BFLOAT16 is not supported.

Constraint Description

  • The shapes of self and other must satisfy the broadcast relationship, and the shape of out is the shape of self and other after broadcasting.
  • The dimensions of input and output tensors do not exceed 8, and non-contiguous Tensors are supported.
  • Deterministic computation: aclnnAtan2&aclnnInplaceAtan2 uses a deterministic implementation by default.

Invocation Description

Invocation Method Invocation Sample Description
aclnn invocation test_aclnn_atan2 Invokes the Atan2 operator through the aclnnAtan2 and aclnnInplaceAtan2 API.