我正在尝试实现RNN。这是我的代码:
def attention_layer(inputs, layer):
attention = layer(inputs)
attention = Dense(1, use_bias=False)(attention)
attention = Flatten()(attention)
attention = Activation('softmax')(attention)
attention = RepeatVector(params['rnn_dim']*2)(attention)
attention = Permute ([ 2 , 1 ]) (attention)
# apply the attention
sent_representation = merge([inputs, attention], mode='mul')
sent_representation = Lambda(lambda xin: K.sum(xin, axis=1)
(sent_representation))
# print sent_representation.get_shape()
return sent_representation
问题:
当我尝试将其合并时发生错误:
'模块'对象不可调用
有人可以帮我定义一下吗?