Skip to content

Commit

Permalink
Fix input validation on learning rate policies
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDBlack committed May 1, 2016
1 parent f96a171 commit f81c5d9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,11 @@ else if (Double.isNaN(layer.getRmsDecay()))
}

private void learningRateValidation(String layerName){
if(learningRatePolicy != LearningRatePolicy.None && Double.isNaN(lrPolicyDecayRate)) {
throw new IllegalStateException(layerName + " learning rate policy decay rate (lrPolicyDecayRate) must be set to use learningRatePolicy.");
if(learningRatePolicy != LearningRatePolicy.None && Double.isNaN(lrPolicyDecayRate) ) {
//LR policy, if used, should have a decay rate. 2 exceptions: Map for schedule, and Poly + power param
if(!(learningRatePolicy == LearningRatePolicy.Schedule && learningRateSchedule != null) &&
!(learningRatePolicy == LearningRatePolicy.Poly && !Double.isNaN(lrPolicyPower)))
throw new IllegalStateException(layerName + " learning rate policy decay rate (lrPolicyDecayRate) must be set to use learningRatePolicy.");
}
switch (learningRatePolicy) {
case Inverse:
Expand Down

0 comments on commit f81c5d9

Please sign in to comment.