2016-07-25 4 views
1

감정을 예측하기 위해 문장을 입력으로 사용하는 네트워크를 만들고 싶습니다. 그래서 내 입력은 (문장의 수 x 단어의 수 x num)와 비슷하게 보입니다. 그런 다음 문장 벡터를 얻기 위해 합계 될 수있는 단어 벡터를 배우기 위해 이것을 삽입 레이어에 넣고 싶습니다. 케 라에서 이러한 유형의 아키텍처가 가능합니까? 또는 Tensorflow? Keras의 임베디드 레이어는 입력 (nb_samples, sequence_length) 만 받아들입니다. 가능한 해결 방법이 있습니까?keras 또는 tensorflow의 임베디드 레이어에 3D 텐서 입력?

답변

0

나는이 클래스는 Keras에 대한 해결 같아요

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,) 
관련 문제