Scan.L_op computes the gradient of a Scan operation by constructing a new backward Scan that runs in reverse, propagating gradients through time. The method:
- Differentiates the inner function symbolically to get per-step gradients
- Adds accumulation terms for recurrent states
- Constructs a new backward Scan with reversed sequences and mit-mot states (initialized with output gradients, accumulate total gradients after evaluation)
- Re-orders the backward Scan's outputs to match the expected gradient layout