import tensorflow as tf

                with tf.variable_scope('conditional_1'):
                    output, state = update(state, input_)
            elif decoder.update_first:
                output, state = update(state, input_, None, ids)
            elif decoder.generate_first:
                output, state = tf.cond(tf.equal(time, 0),
                                        lambda: (output, state),
                                        lambda: update(state, input_, context, ids))

            context, new_weights = look(time, output, input_, pos=pos, prev_weights=prev_weights, context=context)

            if decoder.conditional_rnn:
                with tf.variable_scope('conditional_2'):
                    output, state = update(state, context)
            elif not decoder.generate_first:
                output, state = update(state, input_, context, ids)

            logits = generate(output, input_, context)

            pos = tf.expand_dims(pos, axis=1)
            state = tf.concat([state, context, pos, new_weights], axis=1)
            return state, logits

    def _time_step(time, input_, input_symbol, pos, state, output, outputs, states, weights, attns, prev_weights,
