def sentence_concat(self, tfidf, lda, reuse=False):
with tf.variable_scope('sentence_concat', reuse=reuse) as scope:
wd = tf.contrib.layers.l2_regularizer(self.weight_decay)
tfidf_fc1 = tf.contrib.layers.fully_connected(tfidf, 2048, weights_regularizer=wd, scope='tfidf_fc1')
lda_fc1 = tf.contrib.layers.fully_connected(lda, 64, scope='lda_fc1')
feat_concat = tf.concat([tfidf_fc1, lda_fc1], axis=1)
#drop_fc1 = tf.nn.dropout(feat_concat, self.keep_prob, name='drop_fc1')
sentence_fc2 = tf.contrib.layers.fully_connected(feat_concat, 512,activation_fn=None, weights_regularizer=wd, scope='s_fc2')
sentence_fc2_bn = tf.contrib.layers.batch_norm(sentence_fc2, center=True, scale=True, is_training=self.is_training,
reuse=reuse, decay=0.999, updates_collections=None,
scope='s_fc2_bn')
embed = sentence_fc2_bn/tf.norm(sentence_fc2_bn, axis= -1, keep_dims=True)
self.endpoint['tfidf_fc1'] = tfidf_fc1
self.endpoint['lda_fc1'] = lda_fc1
self.endpoint['concat_embed'] = embed
return embed
BidirectionNet_tfidf.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录