optim/onn/optimizer_base.py
Connor Olding 7161f983ab fix __name__ being incorrect due to extra __all__
this fixes tracebacks and checks for __main__,
among other things.
2018-03-17 14:09:15 +01:00

18 lines
314 B
Python

import numpy as np
from .float import _f
class Optimizer:
def __init__(self, lr=0.1):
self.lr = _f(lr) # learning rate
self.reset()
def reset(self):
pass
def compute(self, dW, W):
return -self.lr * dW
def update(self, dW, W):
W += self.compute(dW, W)