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
0a832e42
Commit
0a832e42
authored
Dec 12, 2015
by
Davis King
Browse files
Fixed bug in softmax gradient computation.
parent
4aa0e3be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
dlib/dnn/cpu_dlib.cpp
dlib/dnn/cpu_dlib.cpp
+1
-2
No files found.
dlib/dnn/cpu_dlib.cpp
View file @
0a832e42
...
@@ -694,7 +694,6 @@ namespace dlib
...
@@ -694,7 +694,6 @@ namespace dlib
const
long
num
=
grad
.
nr
()
*
grad
.
nc
();
const
long
num
=
grad
.
nr
()
*
grad
.
nc
();
// Now normalize each channel so they sum to 1.
for
(
long
n
=
0
;
n
<
grad
.
num_samples
();
++
n
)
for
(
long
n
=
0
;
n
<
grad
.
num_samples
();
++
n
)
{
{
const
auto
d2
=
d
+
num
*
grad
.
k
()
*
n
;
const
auto
d2
=
d
+
num
*
grad
.
k
()
*
n
;
...
@@ -710,7 +709,7 @@ namespace dlib
...
@@ -710,7 +709,7 @@ namespace dlib
float
temp
=
0
;
float
temp
=
0
;
for
(
long
k
=
0
;
k
<
grad
.
k
();
++
k
)
for
(
long
k
=
0
;
k
<
grad
.
k
();
++
k
)
temp
+=
-
d
2
[
k
*
num
]
*
in3
[
k
*
num
];
temp
+=
-
d
3
[
k
*
num
]
*
in3
[
k
*
num
];
for
(
long
k
=
0
;
k
<
grad
.
k
();
++
k
)
for
(
long
k
=
0
;
k
<
grad
.
k
();
++
k
)
g3
[
k
*
num
]
=
d3
[
k
*
num
]
*
(
temp
+
in3
[
k
*
num
]);
g3
[
k
*
num
]
=
d3
[
k
*
num
]
*
(
temp
+
in3
[
k
*
num
]);
}
}
...
...
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