DLS C5 WEEK2 A2 function sentence to avg

I am a little bit confused about why we should extract and store “any_word”. In my view ,we can just store an word_to_vec_map[any_word]'s shape[0] to initialize the avg vector.

Hi Simon_Zhong,

In principle you are right. But extracting and storing any_word helps some learners to understand how to get the correct shape for the average word vector. So I would say this is done for educational purposes and to help in debugging.

Thank you! My confusion is clear up now.