I guess nn.CTCLoss might be the equivalent to ctc_batch_loss.
What does the Lambda function do? It seems you are passing a ctc_lambda_func to it and execute it with input data?
Note that you don’t have to define the computation graph beforehand in PyTorch and can just execute the code similar to numpy.
E.g. you can define modules and pass the tensors directly to them. Have a look at the tutorial section 3 for an introduction.