Description: Rearrange the data of size
[object Object]based on[object Object]for key and value, then compute the backward output of attention in the training scenario.Formula: Based on the passed
[object Object], select[object Object]pieces of data of size[object Object]from[object Object]and[object Object]for reordering. The formula is as follows:
Phase 1: Compute and based on the matrix multiplication derivative rules:
[object Object] [object Object]Phase 2: Compute :
[object Object] [object Object]Phase 3: Compute and :
[object Object]Each operator has calls. First call [object Object] to obtain the required workspace size for computation and the executor that includes the operator's computation process. Then call [object Object] to perform the computation.
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]
Deterministic computation:
[object Object]defaults to a non-deterministic implementation. Enabling deterministic computation via[object Object]is not supported.
Common constraints
- Handling scenarios where input parameters are empty:
- If the query is an empty Tensor: return directly.
- Handling scenarios where input parameters are empty:
Mask
[object Object]Specification constraints
[object Object]
The following uses the [object Object]Atlas A2 training products/Atlas A2 inference products[object Object] as an example. For details, see .