Show, Attend and Tell adds a regularizer that encourages the attention to cover the whole image over the caption. Summed over the words, each location's attention should be about one, which is a doubly stochastic constraint.
Implement doubly_stochastic_penalty(alpha), the squared deviation of each location's total attention from one.
Sum the attention matrix over the words for each location, subtract from one, square, and sum.
No results yet
Run your code to check it against the examples, or submit to run every test.