Keras model import - updater lr fix (#84)

* Keras model import - updater lr fix

Signed-off-by: eraly <susan.eraly@gmail.com>

* Keras model import - updater lr fix, cleanup

Signed-off-by: eraly <susan.eraly@gmail.com>
master
Susan Eraly 2019-07-25 20:37:52 -07:00 committed by AlexDBlack
parent fa98b83295
commit b57f1d52cc
1 changed files with 6 additions and 6 deletions

View File

@ -75,7 +75,7 @@ public class KerasOptimizerUtils {
dl4jOptimizer = new Adam.Builder() dl4jOptimizer = new Adam.Builder()
.beta1(beta1).beta2(beta2) .beta1(beta1).beta2(beta2)
.epsilon(epsilon).learningRate(lr) .epsilon(epsilon).learningRate(lr)
.learningRateSchedule(new InverseSchedule(ScheduleType.ITERATION, 1, decay, 1)) .learningRateSchedule(decay == 0 ? null : new InverseSchedule(ScheduleType.ITERATION, lr, decay, 1))
.build(); .build();
break; break;
} }
@ -96,7 +96,7 @@ public class KerasOptimizerUtils {
dl4jOptimizer = new AdaGrad.Builder() dl4jOptimizer = new AdaGrad.Builder()
.epsilon(epsilon).learningRate(lr) .epsilon(epsilon).learningRate(lr)
.learningRateSchedule(new InverseSchedule(ScheduleType.ITERATION, 1, decay, 1)) .learningRateSchedule(decay == 0 ? null : new InverseSchedule(ScheduleType.ITERATION, lr, decay, 1))
.build(); .build();
break; break;
} }
@ -119,8 +119,8 @@ public class KerasOptimizerUtils {
dl4jOptimizer = new Nadam.Builder() dl4jOptimizer = new Nadam.Builder()
.beta1(beta1).beta2(beta2) .beta1(beta1).beta2(beta2)
.epsilon(epsilon).learningRate(lr) .epsilon(epsilon).learningRate(lr)
.learningRateSchedule(new InverseSchedule(ScheduleType.ITERATION, 1, .learningRateSchedule(scheduleDecay == 0 ? null : new InverseSchedule(ScheduleType.ITERATION, lr,
scheduleDecay, 1)) scheduleDecay, 1))
.build(); .build();
break; break;
} }
@ -132,7 +132,7 @@ public class KerasOptimizerUtils {
dl4jOptimizer = new Nesterovs.Builder() dl4jOptimizer = new Nesterovs.Builder()
.momentum(momentum).learningRate(lr) .momentum(momentum).learningRate(lr)
.learningRateSchedule(new InverseSchedule(ScheduleType.ITERATION, 1, decay, 1)) .learningRateSchedule(decay == 0 ? null : new InverseSchedule(ScheduleType.ITERATION, lr, decay, 1))
.build(); .build();
break; break;
} }
@ -144,7 +144,7 @@ public class KerasOptimizerUtils {
dl4jOptimizer = new RmsProp.Builder() dl4jOptimizer = new RmsProp.Builder()
.epsilon(epsilon).rmsDecay(rho).learningRate(lr) .epsilon(epsilon).rmsDecay(rho).learningRate(lr)
.learningRateSchedule(new InverseSchedule(ScheduleType.ITERATION, 1, decay, 1)) .learningRateSchedule(decay == 0 ? null : new InverseSchedule(ScheduleType.ITERATION, lr, decay, 1))
.build(); .build();
break; break;
} }