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
9f2f6146
Commit
9f2f6146
authored
Apr 27, 2016
by
Davis King
Browse files
merged
parents
dfd9543c
339ac50d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
dlib/dnn/layers.h
dlib/dnn/layers.h
+2
-2
dlib/dnn/trainer.h
dlib/dnn/trainer.h
+3
-1
No files found.
dlib/dnn/layers.h
View file @
9f2f6146
...
@@ -80,7 +80,7 @@ namespace dlib
...
@@ -80,7 +80,7 @@ namespace dlib
// allocate params for the filters and also for the filter bias values.
// allocate params for the filters and also for the filter bias values.
params
.
set_size
(
num_inputs
*
_num_filters
+
_num_filters
);
params
.
set_size
(
num_inputs
*
_num_filters
+
_num_filters
);
dlib
::
rand
rnd
(
"con_"
+
cast_to_string
(
num_outputs
+
num_inputs
));
dlib
::
rand
rnd
(
std
::
rand
(
));
randomize_parameters
(
params
,
num_inputs
+
num_outputs
,
rnd
);
randomize_parameters
(
params
,
num_inputs
+
num_outputs
,
rnd
);
filters
=
alias_tensor
(
_num_filters
,
sub
.
get_output
().
k
(),
_nr
,
_nc
);
filters
=
alias_tensor
(
_num_filters
,
sub
.
get_output
().
k
(),
_nr
,
_nc
);
...
@@ -663,7 +663,7 @@ namespace dlib
...
@@ -663,7 +663,7 @@ namespace dlib
else
else
params
.
set_size
(
num_inputs
,
num_outputs
);
params
.
set_size
(
num_inputs
,
num_outputs
);
dlib
::
rand
rnd
(
"fc_"
+
cast_to_string
(
num_outputs
));
dlib
::
rand
rnd
(
std
::
rand
(
));
randomize_parameters
(
params
,
num_inputs
+
num_outputs
,
rnd
);
randomize_parameters
(
params
,
num_inputs
+
num_outputs
,
rnd
);
weights
=
alias_tensor
(
num_inputs
,
num_outputs
);
weights
=
alias_tensor
(
num_inputs
,
num_outputs
);
...
...
dlib/dnn/trainer.h
View file @
9f2f6146
...
@@ -513,8 +513,10 @@ namespace dlib
...
@@ -513,8 +513,10 @@ namespace dlib
for
(
size_t
i
=
0
;
i
<
devices
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
devices
.
size
();
++
i
)
losses
[
i
]
=
std
::
async
(
std
::
launch
::
async
,[
&
,
i
](){
return
compute_parameter_gradients
(
i
,
next_job
,
pick_which_run_update
);
});
losses
[
i
]
=
std
::
async
(
std
::
launch
::
async
,[
&
,
i
](){
return
compute_parameter_gradients
(
i
,
next_job
,
pick_which_run_update
);
});
// aggregate loss values from all the network computations.
// aggregate loss values from all the network computations.
double
theloss
=
0
;
for
(
auto
&&
loss
:
losses
)
for
(
auto
&&
loss
:
losses
)
record_loss
(
loss
.
get
());
theloss
+=
loss
.
get
();
record_loss
(
theloss
/
losses
.
size
());
// Now, if there is more than one active device we need to synchronize the
// Now, if there is more than one active device we need to synchronize the
// gradient updates between devices. So we do that now.
// gradient updates between devices. So we do that now.
...
...
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