Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
362bec10
"docs/git@developer.sourcefind.cn:OpenDAS/apex.git" did not exist on "f09fb4f411533ec229ff3bf9ce8be72f0fff38e7"
Commit
362bec10
authored
Jun 07, 2017
by
Plumtus
Committed by
Davis E. King
Jun 06, 2017
Browse files
Reinitialize averagers when saved sync file was reloaded. (#629)
parent
d2b80bfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
dlib/dnn/trainer.h
dlib/dnn/trainer.h
+6
-1
No files found.
dlib/dnn/trainer.h
View file @
362bec10
...
...
@@ -713,7 +713,7 @@ namespace dlib
// We can't do this outside the loop because the tensors that get
// averaged need to be allocated to their devices before we call set()
// so that the averagers can determine how best to average them.
if
(
averagers
.
size
()
==
0
)
if
(
averagers
.
size
()
==
0
||
sync_file_reloaded
)
{
averagers
=
std
::
vector
<
tt
::
multi_device_tensor_averager
>
(
net_type
::
num_computational_layers
);
// setup the averagers to point to the tensors in the networks.
...
...
@@ -736,6 +736,8 @@ namespace dlib
if
(
temp
[
0
]
->
size
()
!=
0
)
averagers
[
i
].
set
(
temp
);
}
sync_file_reloaded
=
false
;
}
...
...
@@ -855,6 +857,7 @@ namespace dlib
prob_loss_increasing_thresh_max_value
=
0.99999
;
prob_loss_increasing_thresh
=
prob_loss_increasing_thresh_default_value
;
updated_net_since_last_sync
=
false
;
sync_file_reloaded
=
false
;
start
();
}
...
...
@@ -979,6 +982,7 @@ namespace dlib
{
std
::
ifstream
fin
(
sync_filename
,
std
::
ios
::
binary
);
deserialize
(
*
this
,
fin
);
sync_file_reloaded
=
true
;
if
(
verbose
)
std
::
cout
<<
"Loss has been increasing, reloading saved state from "
<<
sync_filename
<<
std
::
endl
;
}
...
...
@@ -1230,6 +1234,7 @@ namespace dlib
double
prob_loss_increasing_thresh
;
std
::
atomic
<
bool
>
updated_net_since_last_sync
;
bool
sync_file_reloaded
;
};
// ----------------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment