[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Computes the gradient value of binary cross entropy backpropagation.

  • Formula:

    The formula for calculating binary cross entropy is as follows:

    yi=weighti(targetiln(xi)+(1targeti)ln(1xi))y_i = - weight_i \cdot (target_i \cdot ln(x_i) + (1 - target_i) \cdot ln(1- x_i))

    xx indicates the output of the previous layer of the network, that is, the forward prediction value. targettarget indicates label values of the sample. Compute the partial derivative of the binary cross entropy to xx:

    yx=weight(targetiln(xi)+(1targeti)ln(1xi))x=weight((targetln(x))x+((1target)ln(1x))x)=weight(targetx(1target)1x)=weighttarget(1x)x(1target)x(1x)=weighttargetxx(1x)=weightxtargetx(1x)\begin{aligned} \frac {\partial y}{\partial x} &= -weight \cdot \frac {\partial (target_i \cdot ln(x_i) + (1-target_i) \cdot ln(1-x_i))}{\partial x} \\ &= -weight \cdot (\frac {\partial (target \cdot ln(x))}{\partial x} + \frac {\partial ((1-target) \cdot ln(1-x))}{\partial x}) \\ &= -weight \cdot (\frac {target}{x} - \frac {(1-target)}{1-x}) \\ &= -weight \cdot \frac {target(1-x)-x(1-target)}{x(1-x)} \\ &= -weight \cdot \frac {target-x}{x(1-x)} \\ &= weight \cdot \frac {x-target}{x(1-x)} \end{aligned} out=grad_outputweightxtargetx(1x)out=mean(grad_output) if reduction=meanout = grad\_output \cdot weight \cdot \frac {x-target}{x(1-x)} \\ out = mean(grad\_output) \ if \ reduction = mean
[object Object]

Each operator has calls. First, aclnnBinaryCrossEntropyBackwardGetWorkspaceSize is called to obtain the input parameters and compute the required workspace size based on the process. Then, aclnnBinaryCrossEntropyBackward is called to perform computation.

[object Object]
[object Object]
[object Object]
  • Parameters:

    [object Object]
    • [object Object]Atlas inference products[object Object] and [object Object]Atlas training products[object Object]: The data type cannot be BFLOAT16.
  • Returns:

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

    The first-phase API implements input parameter verification. The following errors may be thrown.

    [object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

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

[object Object]
  • Deterministic compute:
    • aclnnBinaryCrossEntropyBackward defaults to a deterministic implementation.
[object Object]

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

[object Object]