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
c79f64f5
Commit
c79f64f5
authored
Mar 29, 2020
by
Davis King
Browse files
make update_parameters() a little more uniform
parent
fd014534
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
dlib/dnn/core.h
dlib/dnn/core.h
+37
-1
dlib/dnn/core_abstract.h
dlib/dnn/core_abstract.h
+14
-0
No files found.
dlib/dnn/core.h
View file @
c79f64f5
...
@@ -1003,7 +1003,7 @@ namespace dlib
...
@@ -1003,7 +1003,7 @@ namespace dlib
template
<
typename
solver_type
>
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
{
subnetwork
->
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
}
const
tensor
&
get_parameter_gradient
(
const
tensor
&
get_parameter_gradient
(
...
@@ -1369,6 +1369,12 @@ namespace dlib
...
@@ -1369,6 +1369,12 @@ namespace dlib
}
}
}
}
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
const
tensor
&
get_parameter_gradient
(
const
tensor
&
get_parameter_gradient
(
)
const
{
return
params_grad
;
}
)
const
{
return
params_grad
;
}
...
@@ -1609,6 +1615,12 @@ namespace dlib
...
@@ -1609,6 +1615,12 @@ namespace dlib
subnetwork
.
update_parameters
(
solvers
,
learning_rate
);
subnetwork
.
update_parameters
(
solvers
,
learning_rate
);
}
}
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
const
tensor
&
get_parameter_gradient
(
const
tensor
&
get_parameter_gradient
(
)
const
{
return
params_grad
;
}
)
const
{
return
params_grad
;
}
...
@@ -1905,6 +1917,12 @@ namespace dlib
...
@@ -1905,6 +1917,12 @@ namespace dlib
subnetwork
.
update_parameters
(
solvers
.
pop
(
comp_layers_in_each_group
*
details
.
size
()),
learning_rate
);
subnetwork
.
update_parameters
(
solvers
.
pop
(
comp_layers_in_each_group
*
details
.
size
()),
learning_rate
);
}
}
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
const
subnet_type
&
subnet
()
const
{
return
subnetwork
;
}
const
subnet_type
&
subnet
()
const
{
return
subnetwork
;
}
subnet_type
&
subnet
()
{
return
subnetwork
;
}
subnet_type
&
subnet
()
{
return
subnetwork
;
}
...
@@ -2135,6 +2153,12 @@ namespace dlib
...
@@ -2135,6 +2153,12 @@ namespace dlib
// nothing to do
// nothing to do
}
}
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
const
subnet_type
&
subnet
()
const
{
return
input_layer
;
}
const
subnet_type
&
subnet
()
const
{
return
input_layer
;
}
subnet_type
&
subnet
()
{
return
input_layer
;
}
subnet_type
&
subnet
()
{
return
input_layer
;
}
...
@@ -2550,6 +2574,12 @@ namespace dlib
...
@@ -2550,6 +2574,12 @@ namespace dlib
subnetwork
.
update_parameters
(
solvers
,
learning_rate
);
subnetwork
.
update_parameters
(
solvers
,
learning_rate
);
}
}
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
const
subnet_type
&
subnet
()
const
{
return
subnetwork
;
}
const
subnet_type
&
subnet
()
const
{
return
subnetwork
;
}
subnet_type
&
subnet
()
{
return
subnetwork
;
}
subnet_type
&
subnet
()
{
return
subnetwork
;
}
const
loss_details_type
&
loss_details
()
const
{
return
loss
;
}
const
loss_details_type
&
loss_details
()
const
{
return
loss
;
}
...
@@ -2940,6 +2970,12 @@ namespace dlib
...
@@ -2940,6 +2970,12 @@ namespace dlib
subnetwork
.
update_parameters
(
solvers
,
learning_rate
);
subnetwork
.
update_parameters
(
solvers
,
learning_rate
);
}
}
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
const
tensor
&
get_parameter_gradient
(
const
tensor
&
get_parameter_gradient
(
)
const
{
return
params_grad
;
}
)
const
{
return
params_grad
;
}
...
...
dlib/dnn/core_abstract.h
View file @
c79f64f5
...
@@ -639,6 +639,13 @@ namespace dlib
...
@@ -639,6 +639,13 @@ namespace dlib
- The solvers use the given learning rate.
- The solvers use the given learning rate.
!*/
!*/
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
/*!
Convenience method for calling update_parameters()
!*/
void
clean
(
void
clean
(
);
);
/*!
/*!
...
@@ -1155,6 +1162,13 @@ namespace dlib
...
@@ -1155,6 +1162,13 @@ namespace dlib
- The solvers use the given learning rate.
- The solvers use the given learning rate.
!*/
!*/
template
<
typename
solver_type
>
void
update_parameters
(
std
::
vector
<
solver_type
>&
solvers
,
double
learning_rate
)
{
update_parameters
(
make_sstack
(
solvers
),
learning_rate
);
}
/*!
Convenience method for calling update_parameters()
!*/
// -------------
// -------------
void
clean
(
void
clean
(
...
...
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