'Compute the attention term for the network unit.'

def attention(self, last_layer, attention_tensor):

    h_tensor = attention_tensor
    focus_tensor = tf.nn.tanh((tf.matmul(h_tensor, self._component.get_variable('attention_weights_pm_0'), name='h_x_pm') + self._component.get_variable('attention_bias_0')))
    context_tensor = tf.nn.tanh((tf.matmul(last_layer, self._component.get_variable('attention_weights_hm_0'), name='l_x_hm') + self._component.get_variable('attention_bias_1')))
    z_vec = tf.reduce_sum(tf.multiply(focus_tensor, context_tensor), 1)
    p_vec = tf.nn.softmax(tf.reshape(z_vec, [1, (-1)]))
    r_vec = tf.expand_dims(tf.reduce_sum(tf.multiply(h_tensor, tf.reshape(p_vec, [(-1), 1]), name='time_together2'), 0), 0)
    return tf.matmul(r_vec, self._component.get_variable('attention_weights_pu'), name='time_together3')
