[object Object]

[object Object][object Object]undefined
[object Object]

Description: Performs backpropagation of the negative log-likelihood loss.

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

  • [object Object]

  • [object Object]

[object Object]
  • Parameters:

    • gradOutput (aclTensor*, compute input): aclTensor on the device. The shape is three-dimensional (the first dimension is N) or one-dimensional (the number of elements is 1). are supported. The can be ND.

      • [object Object]Atlas training series products[object Object]: The data type can be FLOAT or FLOAT16.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT, FLOAT16, or BFLOAT16.
    • self (aclTensor*, compute input): aclTensor on the device. The shape is four-dimensional. The first dimension N indicates the batch size, and the second dimension C indicates the number of classes. are supported. The can be ND. Dimensions 0, 2, and 3 of self must be the same as dimensions 0, 1, and 2 of target, respectively. Otherwise, false is returned.

      • [object Object]Atlas training series products[object Object]: The data type can be FLOAT or FLOAT16.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT, FLOAT16, or BFLOAT16.
    • target (aclTensor*, compute input): aclTensor on the device, indicating the real label. The shape is three-dimensional. The first dimension is N, the value range of each element is [0, C – 1]. The data type can be INT64 or UINT8. are supported. The can be ND.

    • weight (aclTensor*, compute input): aclTensor on the device, weight of each class. The shape is (C, ). are supported. The can be ND.

      • [object Object]Atlas training series products[object Object]: The data type can be FLOAT or FLOAT16.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT, FLOAT16, or BFLOAT16.
    • reduction (int64_t, compute input): int64_t on the host, specifying the reduction to be applied to the output. The value can be 0 ('none') | 1 ('mean') | 2 ('sum'). none indicates that no reduction is applied; mean indicates that the sum of the output will be divided by the number of elements in the output; sum indicates that the output will be summed. When reduction is 0, the shapes of target and gradOutput must be the same. Otherwise, false is returned.

    • ignoreIndex (int64_t, compute input): int64_t on the host, target value that is ignored and does not affect the input gradient.

    • totalWeight (aclTensor*, compute input): aclTensor on the device. The data type is the same as that of weight, and the shape is (1,). When [object Object] is set to [object Object], [object Object] is the [object Object] obtained from the corresponding position through [object Object], with the [object Object] corresponding to [object Object] removed and the remaining [object Object] summed. When [object Object] is set to other values, this parameter is not processed by default. The can be ND.

      • [object Object]Atlas training series products[object Object]: The data type can be FLOAT or FLOAT16.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT, FLOAT16, or BFLOAT16.
    • out (aclTensor*, compute output): aclTensor on the device. The shape is the same as that of self. are supported. The can be ND. The data type is the same as that of self.

      • [object Object]Atlas training series products[object Object]: The data type can be FLOAT or FLOAT16.
      • [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training series products/Atlas A3 inference series products[object Object]: The data type can be FLOAT, FLOAT16, or BFLOAT16.
    • workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.

    • executor (aclOpExecutor**, output): operator executor, containing the operator computation process.

  • Returns:

    aclnnStatus: status code. For details, see .

[object Object]
[object Object]
  • Parameters:

    • workspace (void*, input): address of the workspace to be allocated on the device.

    • workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnNLLLoss2dBackwardGetWorkspaceSize.

    • executor (aclOpExecutor*, input): operator executor, containing the operator computation process.

    • stream (aclrtStream, input): stream for executing the task.

  • Returns:

    aclnnStatus: status code. For details, see .

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

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

[object Object]