def get_output_for(self, inputs, **kwargs):
input = inputs[0]
input_word = T.flatten(inputs[1])
word_dropout = inputs[2]
# Apply word embedding
sentence_rep = self.SemMem.get_output_for([input, word_dropout])
# Apply GRU Layer
gru_outs = self.GRU.get_output_for([sentence_rep])
# Extract candidate fact from GRU's output by input_word variable
# resolving input with adtional word
# e.g. John when to the hallway nil nil nil -> [GRU1, ... ,GRU8] -> GRU5
candidate_facts = T.reshape(
gru_outs[T.arange(gru_outs.shape[0],dtype='int32'), input_word-1],
(-1, input.shape[1], self.hid_state_size))
return candidate_facts
评论列表
文章目录