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
25ab9396
Commit
25ab9396
authored
Jun 11, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tag_id and made skip and add_prev layers print their id numbers when
written to an output stream.
parent
e4e58ee1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
core.h
dlib/dnn/core.h
+11
-2
core_abstract.h
dlib/dnn/core_abstract.h
+12
-0
layers.h
dlib/dnn/layers.h
+3
-1
No files found.
dlib/dnn/core.h
View file @
25ab9396
...
...
@@ -414,7 +414,7 @@ namespace dlib
{
if
(
!
have_same_dimensions
(
data_output
,
sub
.
get_output
()))
data_output
.
copy_size
(
sub
.
get_output
());
layer
.
forward_inplace
(
sub
.
get_output
(),
data_output
);
layer
.
forward_inplace
(
sub
.
get_output
(),
static_cast
<
tensor
&>
(
data_output
)
);
}
...
...
@@ -1378,6 +1378,12 @@ namespace dlib
template
<
unsigned
long
ID
,
typename
SUBNET
,
typename
enabled
=
void
>
class
add_tag_layer
;
template
<
template
<
typename
SUBNET
>
class
tag
>
struct
tag_id
{
const
static
unsigned
long
id
=
tag
<
impl
::
repeat_input_layer
>::
id
;
};
template
<
unsigned
long
ID
,
typename
SUBNET
>
class
add_tag_layer
<
ID
,
SUBNET
,
typename
std
::
enable_if
<
is_nonloss_layer_type
<
SUBNET
>::
value
>::
type
>
...
...
@@ -1388,6 +1394,7 @@ namespace dlib
const
static
size_t
num_layers
=
subnet_type
::
num_layers
+
1
;
const
static
size_t
num_computational_layers
=
subnet_type
::
num_computational_layers
;
const
static
unsigned
int
sample_expansion_factor
=
subnet_type
::
sample_expansion_factor
;
const
static
unsigned
long
id
=
ID
;
static_assert
(
sample_expansion_factor
>=
1
,
"The input layer can't produce fewer output tensors than there are inputs."
);
...
...
@@ -1854,6 +1861,7 @@ namespace dlib
const
static
size_t
num_computational_layers
=
0
;
const
static
size_t
num_layers
=
2
;
const
static
unsigned
int
sample_expansion_factor
=
subnet_type
::
sample_expansion_factor
;
const
static
unsigned
long
id
=
ID
;
static_assert
(
sample_expansion_factor
>=
1
,
"The input layer can't produce fewer output tensors than there are inputs."
);
...
...
@@ -2526,6 +2534,7 @@ namespace dlib
const
static
size_t
num_layers
=
subnet_type
::
num_layers
+
1
;
const
static
size_t
num_computational_layers
=
subnet_type
::
num_computational_layers
;
const
static
unsigned
int
sample_expansion_factor
=
subnet_type
::
sample_expansion_factor
;
const
static
unsigned
long
id
=
tag_id
<
TAG_TYPE
>::
id
;
static_assert
(
sample_expansion_factor
>=
1
,
"The input layer can't produce fewer output tensors than there are inputs."
);
...
...
@@ -2655,7 +2664,7 @@ namespace dlib
void
print
(
std
::
ostream
&
out
,
unsigned
long
idx
,
int
&
min_length
)
const
{
out
<<
"layer<"
<<
idx
<<
">
\t
"
<<
impl
::
tensor_to_str
(
private_get_output
(),
min_length
)
<<
"skip
\n
"
;
out
<<
"layer<"
<<
idx
<<
">
\t
"
<<
impl
::
tensor_to_str
(
private_get_output
(),
min_length
)
<<
"skip
"
<<
id
<<
"
\n
"
;
subnet
().
print
(
out
,
idx
+
1
,
min_length
);
}
...
...
dlib/dnn/core_abstract.h
View file @
25ab9396
...
...
@@ -1222,6 +1222,18 @@ namespace dlib
template
<
typename
SUBNET
>
using
tag9
=
add_tag_layer
<
9
,
SUBNET
>
;
template
<
typename
SUBNET
>
using
tag10
=
add_tag_layer
<
10
,
SUBNET
>
;
template
<
template
<
typename
SUBNET
>
class
tag
>
struct
tag_id
{
/*!
WHAT THIS OBJECT REPRESENTS
This is a tool for finding the numeric ID of a tag layer. For example,
tag_id<tag3>::id == 3.
!*/
const
static
unsigned
long
id
;
};
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/dnn/layers.h
View file @
25ab9396
...
...
@@ -1435,6 +1435,8 @@ namespace dlib
class
add_prev_
{
public
:
const
static
unsigned
long
id
=
tag_id
<
tag
>::
id
;
add_prev_
()
{
}
...
...
@@ -1483,7 +1485,7 @@ namespace dlib
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
add_prev_
&
item
)
{
out
<<
"add_prev"
;
out
<<
"add_prev"
<<
id
;
return
out
;
}
...
...
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