def testFtrlwithoutRegularization(self):
    for dtype in self.float_types:
        with self.test_session(), self.test_scope():
            var0 = resource_variable_ops.ResourceVariable([0.0, 0.0], dtype=dtype)
            var1 = resource_variable_ops.ResourceVariable([0.0, 0.0], dtype=dtype)
            grads0 = constant_op.constant([0.1, 0.2], dtype=dtype)
            grads1 = constant_op.constant([0.01, 0.02], dtype=dtype)
            opt = ftrl.FtrlOptimizer(3.0, initial_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0)
            ftrl_update = opt.apply_gradients(zip([grads0, grads1], [var0, var1]))
            variables.global_variables_initializer().run()
            self.assertAllClose([0.0, 0.0], var0.eval())
            self.assertAllClose([0.0, 0.0], var1.eval())
            for _ in range(3):
                ftrl_update.run()
            self.assertAllCloseAccordingToType(np.array([(- 2.60260963), (- 4.29698515)]), var0.eval())
            self.assertAllCloseAccordingToType(np.array([(- 0.28432083), (- 0.56694895)]), var1.eval())
def testFtrlwithoutRegularization(self):
    for dtype in self.float_types:
        with self.test_session(), self.test_scope():
            var0 = resource_variable_ops.ResourceVariable([0.0, 0.0], dtype=dtype)
            var1 = resource_variable_ops.ResourceVariable([0.0, 0.0], dtype=dtype)
            grads0 = constant_op.constant([0.1, 0.2], dtype=dtype)
            grads1 = constant_op.constant([0.01, 0.02], dtype=dtype)
            opt = ftrl.FtrlOptimizer(3.0, initial_accumulator_value=0.1, l1_regularization_strength=0.0, l2_regularization_strength=0.0)
            ftrl_update = opt.apply_gradients(zip([grads0, grads1], [var0, var1]))
            variables.global_variables_initializer().run()
            self.assertAllClose([0.0, 0.0], var0.eval())
            self.assertAllClose([0.0, 0.0], var1.eval())
            for _ in range(3):
                ftrl_update.run()
            self.assertAllCloseAccordingToType(np.array([(- 2.60260963), (- 4.29698515)]), var0.eval())
            self.assertAllCloseAccordingToType(np.array([(- 0.28432083), (- 0.56694895)]), var1.eval())