预测的时延较大
Created by: lexy0093
网络结构: label = fluid.layers.data(name='label', shape=[1], dtype='int64', lod_level=0) index = fluid.layers.data(name='index', shape=[1], dtype='int64', lod_level=1) feature = fluid.layers.data(name='feature', shape=[1], dtype='float32', lod_level=1)
droped = fluid.layers.dropout(x=feature, dropout_prob=self.dropout_prob)
emb = fluid.layers.embedding(input=index, size=[self.vocab_dim, self.emb_dim], is_sparse=True)
stk = fluid.layers.expand(feature, expand_times = [1, 256])
mm = fluid.layers.elementwise_mul(x=emb, y=stk)
mm_fc = fluid.layers.sequence_pool(input=mm, pool_type='sum')
fc1 = fluid.layers.relu(x=mm_fc)
fc2 = fluid.layers.fc(input=fc1, size=self.hid_dim, act='relu')
pred = fluid.layers.fc(input=[fc1, fc2], size=self.class_dim, act='softmax')
目前分析来看 expand使用时延较多,不知道有没有替代方案或者是优化建议