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
ca4f95ed
Commit
ca4f95ed
authored
Oct 08, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the fc layer output 1x1 images with many feature maps.
parent
50143615
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
layers.h
dlib/dnn/layers.h
+1
-7
layers_abstract.h
dlib/dnn/layers_abstract.h
+1
-1
No files found.
dlib/dnn/layers.h
View file @
ca4f95ed
...
@@ -77,15 +77,13 @@ namespace dlib
...
@@ -77,15 +77,13 @@ namespace dlib
num_inputs
=
sub
.
get_output
().
nr
()
*
sub
.
get_output
().
nc
()
*
sub
.
get_output
().
k
();
num_inputs
=
sub
.
get_output
().
nr
()
*
sub
.
get_output
().
nc
()
*
sub
.
get_output
().
k
();
params
.
set_size
(
num_inputs
,
num_outputs
);
params
.
set_size
(
num_inputs
,
num_outputs
);
std
::
cout
<<
"fc_::setup() "
<<
params
.
size
()
<<
std
::
endl
;
randomize_parameters
(
params
,
num_inputs
+
num_outputs
,
rnd
);
randomize_parameters
(
params
,
num_inputs
+
num_outputs
,
rnd
);
}
}
template
<
typename
SUBNET
>
template
<
typename
SUBNET
>
void
forward
(
const
SUBNET
&
sub
,
resizable_tensor
&
output
)
void
forward
(
const
SUBNET
&
sub
,
resizable_tensor
&
output
)
{
{
output
.
set_size
(
sub
.
get_output
().
num_samples
(),
num_outputs
);
output
.
set_size
(
sub
.
get_output
().
num_samples
(),
1
,
1
,
num_outputs
);
output
=
mat
(
sub
.
get_output
())
*
mat
(
params
);
output
=
mat
(
sub
.
get_output
())
*
mat
(
params
);
}
}
...
@@ -93,10 +91,6 @@ namespace dlib
...
@@ -93,10 +91,6 @@ namespace dlib
template
<
typename
SUBNET
>
template
<
typename
SUBNET
>
void
backward
(
const
tensor
&
gradient_input
,
SUBNET
&
sub
,
tensor
&
params_grad
)
void
backward
(
const
tensor
&
gradient_input
,
SUBNET
&
sub
,
tensor
&
params_grad
)
{
{
// d1*W*p1 + d2*W*p2
// total gradient = [d1*W; d2*W; d3*W; ...] == D*W
// compute the gradient of the parameters.
// compute the gradient of the parameters.
params_grad
+=
trans
(
mat
(
sub
.
get_output
()))
*
mat
(
gradient_input
);
params_grad
+=
trans
(
mat
(
sub
.
get_output
()))
*
mat
(
gradient_input
);
...
...
dlib/dnn/layers_abstract.h
View file @
ca4f95ed
...
@@ -252,7 +252,7 @@ namespace dlib
...
@@ -252,7 +252,7 @@ namespace dlib
- This layer outputs column vectors that contain get_num_outputs()
- This layer outputs column vectors that contain get_num_outputs()
elements. That is, the output tensor T from forward() will be such that:
elements. That is, the output tensor T from forward() will be such that:
- T.num_samples() == however many samples were given to forward().
- T.num_samples() == however many samples were given to forward().
- T.
nr
() == get_num_outputs()
- T.
k
() == get_num_outputs()
- The rest of the dimensions of T will be 1.
- The rest of the dimensions of T will be 1.
!*/
!*/
...
...
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