base_optimizer.py 449 字节
Newer Older
X
xixiaoyao 已提交
1 2 3 4 5 6 7 8 9 10

class BaseOptimizer():

    def __init__(self, loss_var, lr, lr_schedualer=None):
        self._prog = None
        self._lr_schedualer = lr_schedualer

    def build(self, grad_clip=None):
        pass

W
wangxiao1021 已提交
11
    def _set_prog(self, prog, init_prog):
X
xixiaoyao 已提交
12
        self._prog = prog
W
wangxiao1021 已提交
13
        self._init_prog = prog
X
xixiaoyao 已提交
14 15 16 17 18 19 20
        if self._lr_schedualer is not None:
            self._lr_schedualer._set_prog(prog)

    def get_cur_learning_rate(self):
        pass