Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
001bca78
Commit
001bca78
authored
9 years ago
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved the add_layer forwarding constructor. Also added repeat_group()
variable decorator.
parent
0a1464b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
core.h
dlib/dnn/core.h
+41
-0
core_abstract.h
dlib/dnn/core_abstract.h
+25
-0
No files found.
dlib/dnn/core.h
View file @
001bca78
...
...
@@ -596,6 +596,16 @@ namespace dlib
};
template
<
typename
...
T
,
typename
...
U
>
struct
disable_forwarding_constr
<
std
::
tuple
<
T
...
>
,
U
...
>
{
const
static
bool
value
=
disable_forwarding_constr
<
typename
std
::
remove_reference
<
T
>::
type
...
>::
value
;
};
template
<
typename
T
,
typename
...
U
>
struct
disable_forwarding_constr
<
std
::
tuple
<
T
>
,
U
...
>
{
const
static
bool
value
=
disable_forwarding_constr
<
typename
std
::
remove_reference
<
T
>::
type
>::
value
;
};
template
<
typename
...
U
>
struct
disable_forwarding_constr
<
std
::
tuple
<>
,
U
...
>
{
const
static
bool
value
=
true
;
};
...
...
@@ -658,6 +668,10 @@ namespace dlib
T
&&
...
args
)
:
add_layer
(
layer_det
,
args
...)
{
}
add_layer
(
std
::
tuple
<>
)
:
add_layer
()
{}
template
<
typename
...
T
>
add_layer
(
std
::
tuple
<>
,
...
...
@@ -1374,6 +1388,23 @@ namespace dlib
};
}
template
<
typename
...
T
>
struct
decorator_repeat_group
{
decorator_repeat_group
(
T
&&
...
args
)
:
data
(
std
::
forward
<
T
>
(
args
)...)
{}
std
::
tuple
<
T
...
>
data
;
};
template
<
typename
...
T
>
decorator_repeat_group
<
T
...
>
repeat_group
(
T
&&
...
args
)
{
return
decorator_repeat_group
<
T
...
>
(
std
::
forward
<
T
>
(
args
)...);
}
template
<
size_t
num
,
template
<
typename
>
class
REPEATED_LAYER
,
...
...
@@ -1440,6 +1471,16 @@ namespace dlib
{
}
template
<
typename
...
T
,
typename
...
U
>
repeat
(
decorator_repeat_group
<
T
...
>&&
arg1
,
U
...
args2
)
:
details
(
num
,
arg1
.
data
),
subnetwork
(
std
::
move
(
args2
)...)
{
}
template
<
typename
T
,
typename
...
U
>
repeat
(
std
::
tuple
<>
,
...
...
This diff is collapsed.
Click to expand it.
dlib/dnn/core_abstract.h
View file @
001bca78
...
...
@@ -963,6 +963,17 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
...
T
>
decorator_repeat_group
<
T
...
>
repeat_group
(
T
&&
...
args
);
/*!
ensures
- Decorates a group of variables. This is essentially like std::make_tuple()
except it's only purpose is to group variables together so they can be passed
to the repeat object's constructor.
!*/
template
<
size_t
num
,
template
<
typename
>
class
REPEATED_LAYER
,
...
...
@@ -1020,6 +1031,20 @@ namespace dlib
SUBNET's constructor.
!*/
template
<
typename
...
T
,
typename
...
U
>
repeat
(
decorator_repeat_group
<
T
...
>&&
arg1
,
U
...
args2
);
/*!
ensures
- arg1 is used to initialize the num_repetitions() copies of REPEATED_LAYER inside
this object. That is, all the REPEATED_LAYER elements are initialized identically
by being given copies of an undecorated arg1.
- The rest of the arguments to the constructor, i.e. args2, are passed to
SUBNET's constructor.
!*/
size_t
num_repetitions
(
)
const
;
/*!
...
...
This diff is collapsed.
Click to expand it.
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