Description: In the training scenario, the inputs
[object Object],[object Object],[object Object],[object Object], and[object Object]are required to implement[object Object]backward computation. The backward computation extracts the[object Object]sequence from[object Object]based on[object Object]in forward computation to reduce the MatMul computation workload.Formula: The formula for
[object Object]backward computation is as follows:
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.
Parameters
[object Object]Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter validation. The following error codes may be returned.
[object Object]
Deterministic computation:
[object Object]defaults to non-deterministic implementation. You can call[object Object]to enable deterministic computation.
When this API is used together with PyTorch, ensure that the CANN package versions match the PyTorch package versions.
[object Object]can be TND or BSND.The following uses the BSND layout as an example to describe the restrictions on the data shape. Where:
[object Object](Batchsize): The value ranges from 1 to 1024.[object Object](Head-Num): The value is[object Object].[object Object](Group): The value is[object Object].[object Object](Seq-LengthQ): The value ranges from 1 to 128K.[object Object](Seq-LengthK): The value ranges from topK to 128K.[object Object](Head-Dim): The value is[object Object].[object Object]: The value is[object Object].
The following is an example of aclnn single-operator calling. For details about the compilation and execution process, see .