Got input size error in nn.CTCLoss

When I trying to use ctcloss:

ctc = torch.nn.CTCLoss()
ctc(logits,targets,input_lengths,target_lengths)

I got error log:
RuntimeError: Expected tensor to have size 70816 at dimension 0, but got size 2213 for argument #2 ‘targets’ (while checking arguments for ctc_loss_gpu)

And the shape of my four argument are:
torch.Size([1629, 32, 47]) torch.Size([2213])
torch.Size([32]) torch.Size([32])

I think i have catenated the targets, why I met with this problem?

What is target_lengths.sum()? It would need to be 2213 for the inputs to be valid.

Best regards

Thomas