Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_length_with_higher_cycle_mult(self):
policy = OptimizerPolicy(sgdr_phases(10, 1, cycle_mult=2))
self.assertEqual(len(list(policy.all_steps())), 10)
policy = OptimizerPolicy(sgdr_phases(10, 2, cycle_mult=2))
self.assertEqual(len(list(policy.all_steps())), 30)
policy = OptimizerPolicy(sgdr_phases(10, 3, cycle_mult=2))
self.assertEqual(len(list(policy.all_steps())), 70)
policy = OptimizerPolicy(sgdr_phases(10, 1, cycle_mult=3))
self.assertEqual(len(list(policy.all_steps())), 10)
policy = OptimizerPolicy(sgdr_phases(10, 2, cycle_mult=3))
self.assertEqual(len(list(policy.all_steps())), 40)
def test_length_with_higher_cycle_mult(self):
policy = OptimizerPolicy(sgdr_phases(10, 1, cycle_mult=2))
self.assertEqual(len(list(policy.all_steps())), 10)
policy = OptimizerPolicy(sgdr_phases(10, 2, cycle_mult=2))
self.assertEqual(len(list(policy.all_steps())), 30)
policy = OptimizerPolicy(sgdr_phases(10, 3, cycle_mult=2))
self.assertEqual(len(list(policy.all_steps())), 70)
policy = OptimizerPolicy(sgdr_phases(10, 1, cycle_mult=3))
self.assertEqual(len(list(policy.all_steps())), 10)
policy = OptimizerPolicy(sgdr_phases(10, 2, cycle_mult=3))
self.assertEqual(len(list(policy.all_steps())), 40)
def test_length_with_cycle_mult_one(self):
policy = OptimizerPolicy(sgdr_phases(10, 1, cycle_mult=1))
self.assertEqual(len(list(policy.all_steps())), 10)
policy = OptimizerPolicy(sgdr_phases(10, 2, cycle_mult=1))
self.assertEqual(len(list(policy.all_steps())), 20)
policy = OptimizerPolicy(sgdr_phases(10, 10, cycle_mult=1))
self.assertEqual(len(list(policy.all_steps())), 100)
def test_length_with_cycle_mult_one(self):
policy = OptimizerPolicy(sgdr_phases(10, 1, cycle_mult=1))
self.assertEqual(len(list(policy.all_steps())), 10)
policy = OptimizerPolicy(sgdr_phases(10, 2, cycle_mult=1))
self.assertEqual(len(list(policy.all_steps())), 20)
policy = OptimizerPolicy(sgdr_phases(10, 10, cycle_mult=1))
self.assertEqual(len(list(policy.all_steps())), 100)