- Description: Implements backpropagation of
[object Object]. This API is an extension of , with the[object Object]attribute added and the[object Object]type specified. - Formula:[object Object]
(1) If
[object Object]is available and[object Object]is 0:
(2) If [object Object] is available and [object Object] is 1:
[object Object] has two dimensions, [object Object] indicates the size of the last dimension of [object Object], while [object Object] indicates the size of dimension 0 of [object Object]. That is, [object Object] has [object Object] numbers, and [object Object] indicates the size of the jth dimension. After computation, [object Object] is 2-dimensional, with the shape (G, H).[object Object]
(3) If [object Object] is unavailable:
[object Object] has three dimensions. [object Object], [object Object], and [object Object] indicate the sizes of dimensions 0 to 2 of [object Object]. After computation, [object Object] is 2-dimensional, with the shape (G, H).
- Example:[object Object]
(1) If
[object Object]is available and[object Object]is 0:[object Object] The shape of[object Object]is (1000, 30), and the shape of[object Object]is (400, 600, 1000).[object Object]is divided into three groups, and the accumulated number of rows in each group is 400, 200, and 400 respectively. After computation, the shape of[object Object]is (3, 30).[object Object] (2) If[object Object]is available and[object Object]is 1:[object Object] The shape of[object Object]is (1000, 30), and the shape of[object Object]is (400, 210, 390).[object Object]is divided into three groups, and the accumulated number of rows in each group is 400, 210, and 390 respectively. After computation, the shape of[object Object]is (3, 30).[object Object] (3) If[object Object]is unavailable:[object Object] The shape of[object Object]is (10, 100, 30).[object Object]is divided into 10 groups. The accumulated number of rows in each group is 100. After computation, the shape of[object Object]is (10, 30).
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 process. Then, [object Object] is called to perform computation.
[object Object][object Object]
Parameters:
[object Object](aclTensor*, computation input): required parameter, backpropagation gradient,[object Object]in the formula, aclTensor on the device. The data type can be FLOAT, FLOAT16, or BFLOAT16. If[object Object]is available, the shape can only be 2-dimensional. If[object Object]is not available, the shape can only be 3-dimensional. are supported. The can be ND.[object Object](aclTensor*, computation input): optional parameter, end position of each group,[object Object]in the formula, aclTensor on the device. The data type can be INT32 or INT64. The shape supports only one dimension. are supported. The can be ND.[object Object](int64_t, computation input):[object Object]type. The options are as follows:[object Object]indicates that the value of[object Object]is the end index of each group.[object Object]indicates that the value of[object Object]is the size of each group.
[object Object](aclTensor*, output): gradient of bias, out in the formula, aclTensor on the device. The data type can be FLOAT, FLOAT16, or BFLOAT16. The data type must be the same as that of[object Object]. The shape supports only two dimensions. are supported. The supports ND.[object Object](uint64_t*, output): size of the workspace to be allocated on the device.[object Object](aclOpExecutor**, output): operator executor, containing the operator computation process.
Returns:
Parameters:
[object Object](void*, input): address of the workspace to be allocated on the device.[object Object](uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API[object Object].[object Object](aclOpExecutor*, input): operator executor, containing the operator computation process.[object Object](aclrtStream, input): stream for executing the task.
Returns:
- Deterministic computing:
[object Object]defaults to a deterministic implementation.
[object Object]supports a maximum of 2048 numbers.
- If
[object Object]is available, ensure that the tensor values are not greater than the maximum INT32 value and are not negative numbers.
- If
- If
[object Object]is available and[object Object]is[object Object], ensure that the tensor values are sorted in ascending order and the last value is equal to the size of the 0th dimension of[object Object]. - If
[object Object]is available and[object Object]is 1, ensure that the sum of tensor values is equal to the size of the 0th dimension of[object Object].
The following example is for reference only. For details, see .