Image captioning assignment bug

As our eminent teaching assistant noted, there is an error in the reduce_sum in the UniformAttention class.

 

Incorrect line:

context_vector = tf.reduce_sum(tf.expand_dims(attention_weights,axis=-1)*

feature_vectors, axis=-1)
 

Correct line :

context_vector = tf.reduce_sum(tf.expand_dims(attention_weights, axis=-1)* feature_vectors, axis=1)
 

We should sum over the 49 spatial dimensions (axis=1), not over the 256-dimensional feature dimension (axis=-1)

 

Publisert 17. sep. 2019 19:37 - Sist endret 17. sep. 2019 19:37