Exemplo n.º 1
0
        def step(self, x, states):
            h, [h, c] = super(AttentionLSTM, self).step(x, states)
            attention = states[4]

            m = K.tanh(K.dot(h, self.U_a) + attention + self.b_a)
            s = K.exp(K.dot(m, self.U_s) + self.b_s)
            h = h * s
            return h, [h, c]
Exemplo n.º 2
0
        def step(self, x, states):
            h, [h, c] = super(AttentionLSTM, self).step(x, states)
            attention = states[4]

            m = K.tanh(K.dot(h, self.U_a) + attention + self.b_a)
            s = K.exp(K.dot(m, self.U_s) + self.b_s)
            h = h * s
            return h, [h, c]
Exemplo n.º 3
0
 def get_constants(self, x):
     constants = super(AttentionLSTM, self).get_constants(x)
     constants.append(K.dot(self.attentionvec, self.U_m) + self.b_m)
     return constants
Exemplo n.º 4
0
 def get_constants(self, x):
     constants = super(AttentionLSTM, self).get_constants(x)
     constants.append(K.dot(self.attentionvec, self.U_m) + self.b_m)
     return constants