From 432cf33910f1717b01f90d2662b575ab8de8fb6d Mon Sep 17 00:00:00 2001 From: Joan Puigcerver Date: Fri, 9 Mar 2018 14:12:46 +0100 Subject: [PATCH] Fixed bug in total_length --- pytorch_binding/warpctc_pytorch/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_binding/warpctc_pytorch/__init__.py b/pytorch_binding/warpctc_pytorch/__init__.py index b5bd390..081197b 100644 --- a/pytorch_binding/warpctc_pytorch/__init__.py +++ b/pytorch_binding/warpctc_pytorch/__init__.py @@ -42,7 +42,7 @@ def forward(ctx, acts, labels, act_lens, label_lens, size_average=False, if length_average: # Compute the avg. log-probability per batch sample and frame. - total_length = torch.prod(act_lens) + total_length = torch.sum(act_lens) grads = grads / total_length costs = costs / total_length elif size_average: