original_docstring: put ground truth texts into sparse tensor for ctc_loss
docstring: put ground truth texts into sparse tensor for ctc_loss
docstring_tokens: put ground truth texts into sparse tensor for ctc_loss
code: def toSparse(self, texts):
          """put ground truth texts into sparse tensor for ctc_loss"""
          indices = []
          values = []
          shape = [len(texts), 0]  # last entry must be max(labelList[i])
  
          # go over all texts
          for (batchElement, text) in enumerate(texts):
              # convert to string of label (i.e. class-ids)
              labelStr = [self.charList.index(c) for c in text]
              # sparse tensor must have size of max. label-string
              if len(labelStr) > shape[1]:
                  shape[1] = len(labelStr)
              # put each label into sparse tensor
              for (i, label) in enumerate(labelStr):
                  indices.append([batchElement, i])
                  values.append(label)
  
          return (indices, values, shape)
code_tokens: def toSparse ( self , texts ) : indices = [ ] values = [ ] shape = [ len ( texts ) , 0 ] for ( batchElement , text ) in enumerate ( texts ) : labelStr = [ self . charList . index ( c ) for c in text ] if len ( labelStr ) > shape [ 1 ] : shape [ 1 ] = len ( labelStr ) for ( i , label ) in enumerate ( labelStr ) : indices . append ( [ batchElement , i ] ) values . append ( label ) return ( indices , values , shape )
short_docstring: put ground truth texts into sparse tensor for ctc_loss
short_docstring_tokens: put ground truth texts into sparse tensor for ctc_loss
comment: """put ground truth texts into sparse tensor for ctc_loss"""$SEP$# last entry must be max(labelList[i])$SEP$# go over all texts$SEP$# convert to string of label (i.e. class-ids)$SEP$# sparse tensor must have size of max. label-string$SEP$# put each label into sparse tensor