[object Object]

[object Object][object Object]undefined
[object Object]
  • Function: Calculates the negative log likelihood loss.
  • Formula: self is the input, with shape (N, C) or (C), where N indicates the batch size and C indicates the number of classes. target indicates the real label, with shape (N, C) or (C). The value range of each element is [-1, C - 1]. To ensure that the shape is the same as that of the input, -1 is padded. That is, the label before the first -1 indicates the real label yTrue to which the sample belongs. For example, if y = [0,3,-1,1], the real label yTrue is [0,3]. The formula for calculating each sample is as follows:istarget[k]={ 1,k in yTrue 0,otherwiseistarget[k]=\begin{cases} \ 1, & \text{k in yTrue}\\ \ 0, & \text{otherwise} \end{cases} ln=j,istarget[j]=1Ci,istarget[i]=0Cmax(0,1x[j]x[i])Cl_n=\sum^C_{j,istarget[j]=1}\sum^C_{i,istarget[i]=0} \frac{max(0,1-x[j]-x[i])}{C} If [object Object] is [object Object]:(x,y)=L={l1,,lN}\ell(x, y) = L = \{l_1,\dots,l_N\}^\top If [object Object] is not [object Object]:(x,y)={n=1N1Nln,if reduction=mean;n=1Nln,if reduction=sum.\ell(x, y) = \begin{cases} \sum_{n=1}^N \frac{1}{N} l_n, & \text{if reduction} = \text{mean;}\\ \sum_{n=1}^N l_n, & \text{if reduction} = \text{sum.} \end{cases}
[object Object]

Each operator has calls. First, aclnnMultilabelMarginLossGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMultilabelMarginLoss is called to perform computation.

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

    [object Object]
  • 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:
    • aclnnMultilabelMarginLoss defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic compute.
[object Object]

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

[object Object]