I think this is an issue with the demo code and not pytorch:

  
      github.com
  
  
    meijieru/crnn.pytorch/blob/4850b736fc8186b98c864a0c95c032a887e7c537/utils.py#L80 6

    if raw:
        return ''.join([self.alphabet[i - 1] for i in t])
    else:
        char_list = []
        for i in range(length):
            if t[i] != 0 and (not (i > 0 and t[i - 1] == t[i])):
                char_list.append(self.alphabet[t[i] - 1])
        return ''.join(char_list)
else:
    # batch mode
    assert t.numel() == length.sum(), "texts with length: {} does not match declared length: {}".format(t.numel(), length.sum())
    texts = []
    index = 0
    for i in range(length.numel()):
        l = length[i]
        texts.append(
            self.decode(
                t[index:index + l], torch.IntTensor([l]), raw=raw))
        index += l
    return texts





  
  
    
    
  
  


I found this related issue, hopefully it helps. https://github.com/meijieru/crnn.pytorch/issues/62 10