def get_updates(self, params, constraints, grads):
accumulators = [shared_zeros(p.get_value().shape) for p in params]
delta_accumulators = [shared_zeros(p.get_value().shape) for p in params]
self.updates = []
for p, g, a, d_a, c in zip(params, grads, accumulators,
delta_accumulators, constraints):
new_a = self.rho * a + (1 - self.rho) * g ** 2 // update accumulator
self.updates.append((a, new_a))
// use the new accumulator and the *old* delta_accumulator
update = g * T.sqrt(d_a + self.epsilon) / T.sqrt(new_a +
self.epsilon)
new_p = p - self.lr * update
self.updates.append((p, c(new_p))) // apply constraints
// update delta_accumulator
new_d_a = self.rho * d_a + (1 - self.rho) * update ** 2
self.updates.append((d_a, new_d_a))
return new_p
def get_config(self):
After Change
def get_updates(self, params, constraints, grads):
accumulators = [np.zeros_like(p) for p in params]
delta_accumulators = [np.zeros_like(p) for p in params]
new_weights = []
for p, g, a, d_a, c in zip(params, grads, accumulators,