support AddSign and PowerSign in config
This commit is contained in:
parent
fe54002671
commit
615f43c550
1 changed files with 8 additions and 0 deletions
8
onn.py
8
onn.py
|
@ -1043,6 +1043,14 @@ def optim_from_config(config):
|
||||||
optim = Momentum(mu=b1, nesterov=config.nesterov)
|
optim = Momentum(mu=b1, nesterov=config.nesterov)
|
||||||
else:
|
else:
|
||||||
optim = Optimizer()
|
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:
|
else:
|
||||||
raise Exception('unknown optimizer', config.optim)
|
raise Exception('unknown optimizer', config.optim)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue