Update ftml for Keras changes to optimizers

This commit is contained in:
Michael Oliver
2017-08-16 17:56:25 -07:00
committed by GitHub
parent 157aa46f5a
commit acb213b06a
+7 -5
View File
@@ -30,7 +30,8 @@ class FTML(Optimizer):
self.epsilon = epsilon
self.inital_decay = decay
def get_updates(self, params, constraints, loss):
@interfaces.legacy_get_updates_support
def get_updates(self, loss, params):
grads = self.get_gradients(loss, params)
self.updates = [K.update_add(self.iterations, 1)]
@@ -61,10 +62,11 @@ class FTML(Optimizer):
self.updates.append(K.update(d, d_t))
new_p = p_t
# apply constraints
if p in constraints:
c = constraints[p]
new_p = c(new_p)
# Apply constraints.
if getattr(p, 'constraint', None) is not None:
new_p = p.constraint(new_p)
self.updates.append(K.update(p, new_p))
return self.updates