import tensorflow as tf


    if encoder.position_bias and input_length is not None and time is not None:
        src_pos = tf.tile(tf.expand_dims(tf.range(time_steps), axis=0), [batch_size, 1])
        trg_pos = tf.tile(tf.reshape(time, [1, 1]), [batch_size, time_steps])
        src_len = tf.tile(tf.expand_dims(input_length, axis=1), [1, time_steps]) # - 1
        pos_feats = tf.to_float(tf.stack([src_pos, trg_pos, src_len], axis=2))
        pos_feats = tf.log(1 + pos_feats)

        y += dense(pos_feats, encoder.attn_size, use_bias=False, name='P_a')

    if encoder.attn_filters:
        filter_shape = [encoder.attn_filter_length * 2 + 1, 1, 1, encoder.attn_filters]
