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
2a94e4d9
"examples/tensorflow/vscode:/vscode.git/clone" did not exist on "4be4b134247cf79617480e5f4646dfa07bd96a4e"
Commit
2a94e4d9
authored
Oct 25, 2015
by
Davis King
Browse files
Added add_conv_bias_gradient()
parent
37e422dc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
dlib/dnn/cudnn_dlibapi.cpp
dlib/dnn/cudnn_dlibapi.cpp
+24
-0
dlib/dnn/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