Ejemplo n.º 1
0
    def testAdamVectorInverseTimeDecaySchedule(self):
        def loss(x, _):
            return np.dot(x, x)

        x0 = np.ones(2)
        num_iters = 100
        step_schedule = minmax.inverse_time_decay(0.1, 3, 2.)
        self._CheckOptimizer(minmax.adam, loss, x0, num_iters, step_schedule)
Ejemplo n.º 2
0
    def testMomentumVectorInverseTimeDecayStaircaseSchedule(self):
        def loss(x, _):
            return np.dot(x, x)

        x0 = np.ones(2)
        num_iters = 100
        step_sched = minmax.inverse_time_decay(0.1, 3, 2., staircase=True)
        mass = 0.9
        self._CheckOptimizer(minmax.momentum, loss, x0, num_iters, step_sched,
                             mass)