Beispiel #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]
        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]
Beispiel #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
 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