I am working  on a variant of the CTC loss. It is my understanding that one can compute the forward variables (in log space) and simply perform a logsumexp operation in the last two alpha variables of the sequence at the last timestep. This gives us the log-likelihood of the sequence under the model.
My current implementation is in pytorch and takes this as the loss and simply calls backward to get the gradients. I.e I don’t have a specific implementation for the backward pass.
Looking at the native cuda implementation here: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/cuda/LossCTC.cu#L9 6, the full forward-backward recursion used in the paper is performed.
The question is: Will the gradients in the above implementation be equivalent to performing the forward pass and then using autograd only (much) slower? Or is there something in the backward recursion that will produce different gradients. If so, what would that be?
Already talked with @tom about this but it wasn’t clear to me whether or not a pure pytorch implementation of the forward pass and then loss.backward() would suffice.