[object Object][object Object][object Object]undefined
[object Object]
  • API function: Implements the backward propagation of aclnnCdist.
  • Formulas:out=grady=grad((x1x2)pp)=grad1p×((x1x2)p)1p1×p×(x1x2)p1=grad((x1x2)p)(p1)p×(x1x2)p1=grad((x1x2)p)1p×((p1))×(x1x2)p1=graddiffp1cdistp1=graddiff×diffp2cdistp1\begin{aligned} out&=grad \cdot y' \\ &= grad \cdot \left( \sqrt[p]{\sum (x_1 - x_2)^p} \right)' \\ &= grad \cdot \frac{1}{p} \times \left( \sum (x_1 - x_2)^p \right)^{\frac{1}{p}-1} \times p \times (x_1 - x_2)^{p-1} \\ &= grad \cdot \left( \sum (x_1 - x_2)^p \right)^{\frac{-(p-1)}{p}} \times (x_1 - x_2)^{p-1} \\ &= grad \cdot \left( \sum (x_1 - x_2)^p \right)^{\frac{1}{p} \times (-(p-1))} \times (x_1 - x_2)^{p-1} \\ &= grad \cdot \frac{diff^{p-1}}{cdist^{p-1}} \\ &= grad \cdot \frac{diff \times |diff|^{p-2}}{cdist^{p-1}} \end{aligned}
    • diff=x1x2\mathrm{diff} = x_1 - x_2: difference between variables.
    • cdist=(x1x2)pp\mathrm{cdist} = \sqrt[p]{\sum (x_1 - x_2)^p}: p-norm distance
[object Object]

Each operator is divided into two functions (see../common/two-phase-api.md). You must call aclnnCdistBackwardGetWorkspaceSize to obtain the input parameters, calculate the required workspace size based on the workflow, and then call aclnnCdistBackward to perform the computation.

[object Object]
[object Object]
[object Object]
  • Parameter description:

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter validation. The following error codes may be returned.

    [object Object]
[object Object]
  • Parameter description:

    [object Object]
  • Returns

    [object Object]: status code. For details, see .

[object Object]

Deterministic computing is supported by default.

[object Object]

The following example is for reference only. For details, see .

[object Object]