mirror of https://github.com/davisking/dlib.git
Revert "Revert some of the earlier change"
This reverts commit 6c852124ef
.
This commit is contained in:
parent
125ae0a142
commit
2610f728f0
|
@ -1099,15 +1099,18 @@ namespace dlib
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we haven't seen much data yet then just say false. Or, alternatively, if
|
// if we haven't seen much data yet then just say false.
|
||||||
// it's been too long since the last sync then don't reload either.
|
if (gradient_updates_since_last_sync < 30)
|
||||||
if (gradient_updates_since_last_sync < 30 || previous_loss_values.size() < 2*gradient_updates_since_last_sync)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Now look at the data since a little before the last disk sync. We will
|
// Now look at the data since a little before the last disk sync. We will
|
||||||
// check if the loss is getting better or worse.
|
// check if the loss is getting better or worse.
|
||||||
running_gradient g;
|
running_gradient g;
|
||||||
for (size_t i = previous_loss_values.size() - 2*gradient_updates_since_last_sync; i < previous_loss_values.size(); ++i)
|
const size_t first_index
|
||||||
|
= previous_loss_values.size() < 2 * gradient_updates_since_last_sync
|
||||||
|
? 0
|
||||||
|
: previous_loss_values.size() - 2 * gradient_updates_since_last_sync;
|
||||||
|
for (size_t i = first_index; i < previous_loss_values.size(); ++i)
|
||||||
g.add(previous_loss_values[i]);
|
g.add(previous_loss_values[i]);
|
||||||
|
|
||||||
// if the loss is very likely to be increasing then return true
|
// if the loss is very likely to be increasing then return true
|
||||||
|
|
Loading…
Reference in New Issue