[object Object]

[object Object][object Object]undefined
[object Object]
  • Function: Calculates the KL divergence.
  • Formulas:
    • Defines loss_pointwise and saves the intermediate result.

      loss_pointwisei={NaN if logTarget=false and targeti<=0,targeti(log(targeti)selfi) if logTarget=false,exptargeti(targetiselfi) else. loss\_pointwise_i=\begin{cases} NaN & \text{ if }&logTarget=false \text{ and } target_i <= 0, \\ target_i * \left ( \log{(target_i)}- self_i \right ) & \text{ if }& logTarget=false, \\ \exp^ {target_i} * \left ( target_i- self_i \right ) & \text{ else. } \end{cases}
    • Formula for computing [object Object]:

      out={loss_pointwiseˉ if reduction=1,loss_pointwise elif reduction=2,loss_pointwiseself.size(0) elif reduction=3,loss_pointwise else. out=\begin{cases} \bar{loss\_pointwise} & \text{ if }& reduction= 1, \\ \sum loss\_pointwise & \text{ elif }& reduction= 2,\\ \frac{\sum loss\_pointwise}{self.size(0)} & \text{ elif }& reduction= 3,\\ loss\_pointwise & \text{ else. } \end{cases}
[object Object]

Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation flow. Then, [object Object] is called to perform computation.

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

    [object Object]
    • [object Object]Atlas inference products[object Object] and [object Object]Atlas training products[object Object]: BFLOAT16 is not supported.
  • Returns

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

    The first-phase API performs input parameter validation. The following errors may be returned:

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

    [object Object]
  • Returns

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

[object Object]
  • Deterministic computation:
    • Default deterministic implementation of aclnnKlDiv.
[object Object]

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

[object Object]