コード例 #1
0
 def body(t, outputs_):
     kX_sliced = emb_knowledge_ids[:, t, :, :]
     X_topic = bilstm_do[:, t, :]
     outputs_ = outputs_.write(
         t,
         attention_knowledge(kX_sliced,
                             X_topic,
                             2 * lstm_size,
                             return_alphas=False)
     )  #[ [samples, kge], [samples, kge], ...] =>[sent_len, samples, kge]
     return t + 1, outputs_
コード例 #2
0
 def body(t, outputs_):
     kX_sliced = concept_embedded_layer[:,
                                        t, :, :]  # [samples, token at t, concepts, concept_embs]
     X_topic = sent_embedded[:, t, :]
     outputs_ = outputs_.write(
         t,
         attention_knowledge(kX_sliced,
                             X_topic,
                             2 * lstm_size,
                             return_alphas=False)
     )  #[ [samples, kge], [samples, kge], ...] =>[sent_len, samples, kge]
     return t + 1, outputs_