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

AcosGrad

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 backward gradient of the Acos (inverse cosine) operator.

  • Operator formula:

    zi=−1⋅dyi⋅11−yi2z_i = -1 \cdot dy_i \cdot \dfrac{1}{\sqrt{1 - y_i^2}}

    where:

    • yiy_i is the input tensor of the forward Acos operator;
    • dyidy_i is the gradient passed from upstream;
    • ziz_i is the gradient with respect to the original input tensor, which equals the upstream gradient multiplied by −1/1−yi2-1/\sqrt{1 - y_i^2}.
  • When the value is out of the domain (∣yi∣>1|y_i| > 1): 1−yi2<01 - y_i^2 < 0, the square root result is NaN, and the result is also NaN.

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
y Input The input tensor of the forward Acos operator. The value range is expected to fall within [-1, 1]. FLOAT16, FLOAT32, BFLOAT16 ND
dy Input The gradient tensor passed from upstream, whose shape and dtype are the same as those of y. FLOAT16, FLOAT32, BFLOAT16 ND
z Output The gradient with respect to the original input tensor, whose shape and dtype are the same as those of y. FLOAT16, FLOAT32, BFLOAT16 ND

Constraint Description

  • The shapes of y and dy must be exactly the same.
  • The dtypes of y and dy must be exactly the same.
  • Only the ND format is supported.
  • Non-contiguous tensors are supported, and the number of dimensions of a non-contiguous tensor cannot be greater than 8.

Invocation Description

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_acos_grad Invokes the AcosGrad operator by building a graph through the operator IR.