def _mask(hypothesis, hypothesis_length, premise, premise_length):
p_mask = tf.sequence_mask(premise_length, tf.shape(premise)[1], dtype=tf.float32)
h_mask = tf.sequence_mask(hypothesis_length, tf.shape(hypothesis)[1], dtype=tf.float32)
premise *= tf.expand_dims(p_mask, 2)
hypothesis *= tf.expand_dims(h_mask, 2)
return hypothesis, premise
评论列表
文章目录