- Operator function: performs backpropagation of the remaining computation after matmul in the four gates of LSTMCell, and calculates the gradients of the input cx and bias b and the values of the four gates before activation (gates) in the forward output.
- Formula:
Variable definition
- Input gradients: (
[object Object]) and ([object Object]) - Forward cache: (activation values of each gate
[object Object]), ([object Object]), and ([object Object]) - Output gradients: (stored in
[object Object]) and ([object Object])
Phase 1: Intermediate gradient and status backpropagation
First, the contribution of the hidden state to the cell state is calculated, and the total gradient of the cell state at the current time point is obtained as follows: .
Phase 2: Gating component gradient (pre-activation)
According to the code logic, the gradient of each gate before entering the activation function is calculated as follows:
Phase 3: Parameter gradient (db)
1. Bias gradient (db): Sum up the values in the batch dimension ().
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:
- The aclnnThnnFusedLstmCellBackward is implemented in deterministic mode by default.
- Boundary value scenarios:
- If the input is Inf, the output is NAN.
- When the input is
[object Object], the output is[object Object].
The following example is for reference only. For details, see .