optimizer.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:IQA_BIECON_release 作者: jongyookim 项目源码 文件源码
def get_updates_rmsprop(self, cost, params, rho=0.9, eps=1e-8):
        lr = self.lr
        print(' - RMSprop: lr = %.2e' % (lr.get_value(borrow=True)))
        one = T.constant(1.)

        grads = T.grad(cost=cost, wrt=params)

        updates = []
        for p, g in zip(params, grads):
            value = p.get_value(borrow=True)
            accu = theano.shared(np.zeros(value.shape, dtype=value.dtype),
                                 broadcastable=p.broadcastable)
            accu_new = rho * accu + (one - rho) * g ** 2
            gradient_scaling = T.sqrt(accu_new + eps)
            g = g / gradient_scaling

            updates.append((accu, accu_new))
            updates.append((p, p - lr * g))

        return updates
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号