我想建立一个以句子作为输入来预测情绪的网络。所以我的输入看起来像(numofsamples x num of questions x num of words)。然后我想把它放到一个嵌入层来学习单词向量,然后求和得到句子向量。这种类型的建筑在keras可能吗?还是Tensorflow?从文档中,Keras的嵌入层只接受输入(nb_样本,序列长度)。有什么办法吗?在
class AnyShapeEmbedding(Embedding):
'''
This Embedding works with inputs of any number of dimensions.
This can be accomplished by simply changing the output shape computation.
'''
#@overrides
def compute_output_shape(self, input_shape):
return input_shape + (self.output_dim,)
我想这个类解决了Keras:
相关问题 更多 >
编程相关推荐