Description: Replaces the part that uses window attention to compute softmax in swinTransformer.
Formula:
Each operator has calls. First, aclnnMaskedSoftmaxWithRelPosBiasGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMaskedSoftmaxWithRelPosBias is called to perform computation.
Parameters
[object Object]- [object Object]Atlas inference products[object Object]: BFLOAT16 is not supported.
Returns
[object Object]
Deterministic compute:
- aclnnMaskedSoftmaxWithRelPosBias defaults to a deterministic implementation.
[object Object]Atlas inference products[object Object]: The last dimension S2 of the input parameter x must be 32-byte aligned.
Ensure that the size of the UB required by the shape passed to an operator is less than the total size of the UB provided by the AI processor. In the following example, minComputeSize is the total size of the UB required by the operator, and s2AlignedSize indicates the 32-byte alignment result of S2.
If attenMaskOptional exists:
[object Object]If attenMaskOptional does not exist:
[object Object][object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: If the data type is BFLOAT16, the formula is the same as that when FLOAT16 is used.
The following example is for reference only. For details, see .