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
2a94e4d9
Commit
2a94e4d9
authored
Oct 25, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added add_conv_bias_gradient()
parent
37e422dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
cudnn_dlibapi.cpp
dlib/dnn/cudnn_dlibapi.cpp
+24
-0
cudnn_dlibapi.h
dlib/dnn/cudnn_dlibapi.h
+19
-2
No files found.
dlib/dnn/cudnn_dlibapi.cpp
View file @
2a94e4d9
...
@@ -207,6 +207,30 @@ namespace dlib
...
@@ -207,6 +207,30 @@ namespace dlib
&
value
));
&
value
));
}
}
void
add_conv_bias_gradient
(
tensor
&
grad
,
const
tensor
&
gradient_input
)
{
DLIB_CASSERT
(
grad
.
num_samples
()
==
1
&&
grad
.
k
()
>=
1
&&
grad
.
nr
()
==
1
&&
grad
.
nc
()
==
1
&&
gradient_input
.
k
()
==
grad
.
k
()
&&
gradient_input
.
size
()
>
0
,
""
);
const
float
alpha
=
1
;
const
float
beta
=
1
;
check
(
cudnnConvolutionBackwardBias
(
context
(),
&
alpha
,
descriptor
(
gradient_input
),
gradient_input
.
device
(),
&
beta
,
descriptor
(
grad
),
grad
.
device
()));
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
...
...
dlib/dnn/cudnn_dlibapi.h
View file @
2a94e4d9
...
@@ -109,8 +109,25 @@ namespace dlib
...
@@ -109,8 +109,25 @@ namespace dlib
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// TODO
void
add_conv_bias_gradient
(
// add a call that maps to cudnnConvolutionBackwardBias()
tensor
&
grad
,
const
tensor
&
gradient_input
);
/*!
requires
- grad.num_samples() == 1
- grad.k() >= 1
- grad.nr() == 1
- grad.nc() == 1
- gradient_input.k() == grad.k()
- gradient_input.size() > 0
ensures
- let BIAS be a tensor with all dimensions equal to 1 except for k which is >= 1.
- let OUT be the output of add(1,OUT,1,BIAS)
- let f(gradient_input,BIAS) == dot(gradient_input,OUT)
- Then this function computes the gradient of f() with respect to BIAS and
adds it to grad.
!*/
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
...
...
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