Ejemplo n.º 1
0
 def optim(self, learning_rate):
     w, b = self.w, self.b
     # print("fc layer, optim learning_rate", learning_rate)
     w.data, w.m, w.v, w.t = adam(w.data,
                                  w.grad,
                                  learning_rate=learning_rate,
                                  m=w.m,
                                  v=w.v,
                                  t=w.t)
     b.data, b.m, b.v, b.t = adam(b.data,
                                  b.grad,
                                  learning_rate=learning_rate,
                                  m=b.m,
                                  v=b.v,
                                  t=b.t)
Ejemplo n.º 2
0
 def sgd_fun_adam_avg(obj_fun, grad_fun, x0, max_iters, callback, lr_fun):
     return opt.adam(obj_fun,
                     grad_fun,
                     x0,
                     max_iters,
                     callback,
                     lr_fun,
                     avgdecay=0.99)
Ejemplo n.º 3
0
 def sgd_fun_adam_avg(obj_fun, grad_fun, x0, max_iters, callback, lr_fun):
                 return opt.adam(obj_fun, grad_fun, x0, max_iters, callback,
                 lr_fun,  avgdecay=0.99)