[object Object]

[object Object][object Object]undefined
[object Object]
  • This API is used to calculate the negative log likelihood loss.

  • Formula:

    If [object Object] is [object Object]:

    (x,y)=L={l1,,lN},ln=wynxn,yn,wc=weight[c]1{cignoreIndex},\ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad l_n = - w_{y_n} x_{n,y_n}, \quad w_{c} = \text{weight}[c] \cdot \mathbb{1}\{c \not= \text{ignoreIndex}\},

    xx indicates self, yy indicates target, ww indicates weight, and NN indicates the batch size. If [object Object] is not [object Object]:

    (x,y)={n=1N1n=1Nwynln,if reduction=‘mean‘n=1Nln,if reduction=‘sum‘\ell(x, y) = \begin{cases} \sum_{n=1}^N \frac{1}{\sum_{n=1}^N w_{y_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, aclnnNLLLoss2dGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnNLLLoss2d 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:
    • aclnnNLLLoss2d 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]