"...resnet50_tensorflow.git" did not exist on "c4cbe63b0873543c158eef2ceee23fd5978909fd"
Commit b64cc63a authored by lukovnikov's avatar lukovnikov
Browse files

optimization schedule test update

parent d164867d
......@@ -51,11 +51,18 @@ class OptimizationTest(unittest.TestCase):
class WarmupCosineWithRestartsTest(unittest.TestCase):
def test_it(self):
m = WarmupCosineWithWarmupRestartsSchedule(warmup=0.05, t_total=1, cycles=3)
m = WarmupCosineWithWarmupRestartsSchedule(warmup=0.05, t_total=1, cycles=5)
x = np.arange(0, 1000) / 1000
y = [m.get_lr_(xe) for xe in x]
plt.plot(y)
plt.show()
plt.show(block=False)
y = np.asarray(y)
expected_zeros = y[[0, 200, 400, 600, 800]]
print(expected_zeros)
expected_ones = y[[50, 250, 450, 650, 850]]
print(expected_ones)
self.assertTrue(np.allclose(expected_ones, 1))
self.assertTrue(np.allclose(expected_zeros, 0))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment