API function: Calculates the variable step-size Recurrent Gated Delta Rule (RGDR).
Formula:
RGDR is an operator designed for recurrent neural networks (RNNs) and serves as a key component in linear attention mechanisms. At each time step , the network processes the current inputs query , key , and value along with the previous hidden state to produce the attention output and new hidden state . The gating mechanism controls what proportion of new information enters the hidden state and what proportion of existing information is discarded.
In the preceding information, , , , , , ,
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]indicates the batch size. Let be the length of the ith sequence, then represents the cumulative sequence length. indicates the number of key heads, indicates the number of value heads, indicates the dimension of the key vector, and indicates the dimension of the value vector.
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 computing:
[object Object]defaults to a deterministic implementation.
- The input shape size must meet the following constraints: , , , , .
The following example is for reference only. For details, see .