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
9482271e
Commit
9482271e
authored
Apr 07, 2016
by
Davis King
Browse files
Made it so you can skip giving layer detail objects to a network's constructor
if they should be default constructed.
parent
3f542861
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
dlib/dnn/core.h
dlib/dnn/core.h
+19
-0
dlib/dnn/core_abstract.h
dlib/dnn/core_abstract.h
+13
-0
No files found.
dlib/dnn/core.h
View file @
9482271e
...
@@ -589,6 +589,25 @@ namespace dlib
...
@@ -589,6 +589,25 @@ namespace dlib
subnetwork
->
disable_output_and_gradient_getters
();
subnetwork
->
disable_output_and_gradient_getters
();
}
}
template
<
typename
T
,
typename
...
U
>
struct
details_constructable_from
:
public
std
::
is_constructible
<
LAYER_DETAILS
,
T
>
{};
template
<
typename
...
T
,
typename
=
typename
std
::
enable_if
<!
details_constructable_from
<
T
...>
::
value
>::
type
>
add_layer
(
T
&&
...
args
)
:
subnetwork
(
new
subnet_type
(
std
::
forward
<
T
>
(
args
)...)),
this_layer_setup_called
(
false
),
gradient_input_is_stale
(
true
),
get_output_and_gradient_input_disabled
(
false
)
{
if
(
this_layer_operates_inplace
())
subnetwork
->
disable_output_and_gradient_getters
();
}
template
<
typename
...
T
>
template
<
typename
...
T
>
add_layer
(
add_layer
(
LAYER_DETAILS
&&
layer_det
,
LAYER_DETAILS
&&
layer_det
,
...
...
dlib/dnn/core_abstract.h
View file @
9482271e
...
@@ -235,6 +235,19 @@ namespace dlib
...
@@ -235,6 +235,19 @@ namespace dlib
- #subnet() == subnet_type(args)
- #subnet() == subnet_type(args)
!*/
!*/
template
<
typename
...
T
>
add_layer
(
T
&&
...
args
);
/*!
ensures
- This version of the constructor is only called if layer_details_type
can't be constructed from the first thing in args. In this case, the
args are simply passed on to the sub layers in their entirety.
- #layer_details() == layer_details_type()
- #subnet() == subnet_type(args)
!*/
template
<
typename
...
T
>
template
<
typename
...
T
>
add_layer
(
add_layer
(
layer_details_type
&&
layer_det
,
layer_details_type
&&
layer_det
,
...
...
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