buaacszj commented on issue #5559: CTC Loss Refactor
URL: 
https://github.com/apache/incubator-mxnet/issues/5559#issuecomment-327982128
 
 
   I am using two k40m GPUs.
   And the network is CNN+LSTM+CTC, batch size is 128.
   When alphabet_size is 15, the contrib CTC is fast enough and I didn't test 
warp-ctc. While if alphabet_size is more than 5000, it costs about 380-400 
seconds per batch. But warpctc only costs 5-6 seconds per batch.
   Here is the code for calling these two api.
   
   contrib CTC:
         ctc = mx.contrib.symbol.ctc_loss(data=fc1_transpose, label=labels, 
name='ctc_loss')
         ctc_loss = mx.sym.MakeLoss(ctc)
   
         softmax_class = mx.symbol.SoftmaxActivation(data=fc1)
         softmax_loss = mx.sym.MakeLoss(softmax_class)
         softmax_loss = mx.sym.BlockGrad(softmax_loss)
   
         group = mx.sym.Group([softmax_loss, ctc_loss])
   
   warpctc:
         fc1_forwarpctc = mx.symbol.reshape(data=fc1_transpose, shape=(-1, 
num_classes))
         labels = mx.sym.Reshape(data=labels, shape=(-1,))
         labels = mx.sym.Cast(data = labels, dtype = 'int32')
         ctc = mx.sym.WarpCTC(data=fc1_forwarpctc, label=labels, 
label_length=label_len, input_length=SEQ_LENGTH)
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to