def join_branches(self, feats_A, feats_B):
feats_A = tf.truediv(
feats_A, tf.sqrt(tf.reduce_sum(tf.square(feats_A), 1, keep_dims=True)))
feats_B = tf.truediv(
feats_B, tf.sqrt(tf.reduce_sum(tf.square(feats_B), 1, keep_dims=True)))
if self.config.join_branches == "concat":
pair_feats = tf.concat(1, [feats_A, feats_B])
elif self.config.join_branches == "abs_diff":
pair_feats = tf.abs(feats_A - feats_B)
return pair_feats
评论列表
文章目录