@@ -282,7 +282,7 @@ bool Net<Dtype>::StateMeetsRule(const NetState& state,
282
282
if (state.level () < rule.min_level ()) {
283
283
LOG (INFO) << " The NetState level (" << state.level ()
284
284
<< " ) is above the min_level (" << rule.min_level ()
285
- << " specified by a rule in layer " << layer_name;
285
+ << " ) specified by a rule in layer " << layer_name;
286
286
return false ;
287
287
}
288
288
}
@@ -291,24 +291,36 @@ bool Net<Dtype>::StateMeetsRule(const NetState& state,
291
291
if (state.level () > rule.max_level ()) {
292
292
LOG (INFO) << " The NetState level (" << state.level ()
293
293
<< " ) is above the max_level (" << rule.max_level ()
294
- << " specified by a rule in layer " << layer_name;
294
+ << " ) specified by a rule in layer " << layer_name;
295
295
return false ;
296
296
}
297
297
}
298
- // Check whether the rule is broken due to stage. If stage is specified,
299
- // the NetState must contain ALL of the rule's stages to meet it.
300
- if (rule.stage_size ()) {
301
- for (int i = 0 ; i < rule.stage_size (); ++i) {
302
- // Check that the NetState contains the rule's ith stage.
303
- bool has_stage = false ;
304
- for (int j = 0 ; !has_stage && j < state.stage_size (); ++j) {
305
- if (rule.stage (i) == state.stage (j)) { has_stage = true ; }
306
- }
307
- if (!has_stage) {
308
- LOG (INFO) << " The NetState did not contain stage '" << rule.stage (i)
309
- << " ' specified by a rule in layer " << layer_name;
310
- return false ;
311
- }
298
+ // Check whether the rule is broken due to stage. The NetState must
299
+ // contain ALL of the rule's stages to meet it.
300
+ for (int i = 0 ; i < rule.stage_size (); ++i) {
301
+ // Check that the NetState contains the rule's ith stage.
302
+ bool has_stage = false ;
303
+ for (int j = 0 ; !has_stage && j < state.stage_size (); ++j) {
304
+ if (rule.stage (i) == state.stage (j)) { has_stage = true ; }
305
+ }
306
+ if (!has_stage) {
307
+ LOG (INFO) << " The NetState did not contain stage '" << rule.stage (i)
308
+ << " ' specified by a rule in layer " << layer_name;
309
+ return false ;
310
+ }
311
+ }
312
+ // Check whether the rule is broken due to not_stage. The NetState must
313
+ // contain NONE of the rule's not_stages to meet it.
314
+ for (int i = 0 ; i < rule.not_stage_size (); ++i) {
315
+ // Check that the NetState contains the rule's ith not_stage.
316
+ bool has_stage = false ;
317
+ for (int j = 0 ; !has_stage && j < state.stage_size (); ++j) {
318
+ if (rule.not_stage (i) == state.stage (j)) { has_stage = true ; }
319
+ }
320
+ if (has_stage) {
321
+ LOG (INFO) << " The NetState contained a not_stage '" << rule.not_stage (i)
322
+ << " ' specified by a rule in layer " << layer_name;
323
+ return false ;
312
324
}
313
325
}
314
326
return true ;
0 commit comments