-
Notifications
You must be signed in to change notification settings - Fork 0
/
scheduler.py
53 lines (47 loc) · 1.53 KB
/
scheduler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import tensorflow as tf
# class CustomScheduleC10(tf.keras.optimizers.schedules.LearningRateSchedule):
# def __init__(self, initial_learning_rate):
# self.initial_learning_rate = initial_learning_rate
#
# def __call__(self, step):
# if step > 25040: #31280:
# lr = 0.001
# elif step > 12520: #15640:
# lr = 0.01
# else:
# lr = 0.1
# return lr
class CustomScheduleC10(tf.keras.optimizers.schedules.LearningRateSchedule):
def __init__(self, initial_learning_rate):
self.initial_learning_rate = initial_learning_rate
def __call__(self, step):
if step > 31280:
lr = 0.001
if step > 15640:
lr = 0.01
else:
lr = 0.1
return lr
# class CustomScheduleC100(tf.keras.optimizers.schedules.LearningRateSchedule):
# def __init__(self, initial_learning_rate):
# self.initial_learning_rate = initial_learning_rate
#
# def __call__(self, step):
# if step > 37560: #46920:
# lr = 0.001
# elif step > 25040: #31280:
# lr = 0.01
# else:
# lr = 0.1
# return lr
class CustomScheduleC100(tf.keras.optimizers.schedules.LearningRateSchedule):
def __init__(self, initial_learning_rate):
self.initial_learning_rate = initial_learning_rate
def __call__(self, step):
if step > 46920:
lr = 0.001
elif step > 31280:
lr = 0.01
else:
lr = 0.1
return lr