support AddSign and PowerSign in config

This commit is contained in:
Connor Olding 2017-09-25 06:09:36 +00:00
parent fe54002671
commit 615f43c550

8
onn.py
View file

@ -1043,6 +1043,14 @@ def optim_from_config(config):
optim = Momentum(mu=b1, nesterov=config.nesterov)
else:
optim = Optimizer()
elif config.optim == 'ps':
d1 = config.optim_decay1 if 'optim_decay1' in config else 9.5
b1 = np.exp(-1/d1)
optim = PowerSign(mu=b1)
elif config.optim == 'as':
d1 = config.optim_decay1 if 'optim_decay1' in config else 9.5
b1 = np.exp(-1/d1)
optim = AddSign(mu=b1)
else:
raise Exception('unknown optimizer', config.optim)