https://github.com/uvipen/Hierarchical-attention-networks-pytorch/blob/b1ea9e0b7bc294364f213e42507a6fe9d502a044/src/word_att_model.py#L39