So in batch case how would you ensure that decoder terminates when EOS token is an output of current time step?
Since in loop case we can know the output at each time step and stop when EOS is output as below:
            topv, topi = decoder_output.topk(1)
            decoder_input = topi.squeeze().detach() 
            if decoder_input.item() == EOS_token:
                break