optim/onn/optimizer_base.py
2018-01-22 19:40:36 +00:00

18 lines
313 B
Python

import numpy as np
from .float import *
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)