cos_sim前面的FC用relu做激活函数,确定这样的网络是符合预期的么?
Created by: Archimondecy
models-develop/PaddleNLP/models/matching/bow.py 中的网络设计,cos_sim前的FC用了relu做激活函数,把所有的节点都变成非负值,这样计算cos_sim不合理吧。 # embedding layer emb_layer = layers.EmbeddingLayer(self.dict_size, self.emb_dim, "emb") left_emb = emb_layer.ops(left) right_emb = emb_layer.ops(right) # Presentation context pool_layer = layers.SequencePoolLayer("sum") left_pool = pool_layer.ops(left_emb) right_pool = pool_layer.ops(right_emb) softsign_layer = layers.SoftsignLayer() left_soft = softsign_layer.ops(left_pool) right_soft = softsign_layer.ops(right_pool) # matching layer if self.task_mode == "pairwise": bow_layer = layers.FCLayer(self.bow_dim, "relu", "fc") left_bow = bow_layer.ops(left_soft) right_bow = bow_layer.ops(right_soft) cos_sim_layer = layers.CosSimLayer() pred = cos_sim_layer.ops(left_bow, right_bow) return left_bow, pred