def decode(step, step_output, step_attn):
    decoder_outputs.append(step_output)
    if self.use_attention:
        ret_dict[DecoderRNN.KEY_ATTN_SCORE].append(step_attn)
    symbols = decoder_outputs[(- 1)].topk(1)[1]
    sequence_symbols.append(symbols)
    eos_batches = symbols.data.eq(self.eos_id)
    if (eos_batches.dim() > 0):
        eos_batches = eos_batches.cpu().view((- 1)).numpy()
        update_idx = (((lengths > step) & eos_batches) != 0)
        lengths[update_idx] = len(sequence_symbols)
    return symbols
def decode(step, step_output, step_attn):
    decoder_outputs.append(step_output)
    if self.use_attention:
        ret_dict[DecoderRNN.KEY_ATTN_SCORE].append(step_attn)
    symbols = decoder_outputs[(- 1)].topk(1)[1]
    sequence_symbols.append(symbols)
    eos_batches = symbols.data.eq(self.eos_id)
    if (eos_batches.dim() > 0):
        eos_batches = eos_batches.cpu().view((- 1)).numpy()
        update_idx = (((lengths > step) & eos_batches) != 0)
        lengths[update_idx] = len(sequence_symbols)
    return symbols