projects
/
platform
/
upstream
/
caffe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e93b5e2
)
Added count==0 safeguard to CPU accuracy calculation
author
Noiredd
<snowball91b@gmail.com>
Wed, 29 Nov 2017 10:48:29 +0000
(11:48 +0100)
committer
Noiredd
<snowball91b@gmail.com>
Wed, 29 Nov 2017 10:48:29 +0000
(11:48 +0100)
src/caffe/layers/accuracy_layer.cpp
patch
|
blob
|
history
diff --git
a/src/caffe/layers/accuracy_layer.cpp
b/src/caffe/layers/accuracy_layer.cpp
index
392829e
..
b6d95b5
100644
(file)
--- a/
src/caffe/layers/accuracy_layer.cpp
+++ b/
src/caffe/layers/accuracy_layer.cpp
@@
-86,7
+86,7
@@
void AccuracyLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
}
// LOG(INFO) << "Accuracy: " << accuracy;
- top[0]->mutable_cpu_data()[0] =
accuracy / count
;
+ top[0]->mutable_cpu_data()[0] =
(count == 0) ? 0 : (accuracy / count)
;
if (top.size() > 1) {
for (int i = 0; i < top[1]->count(); ++i) {
top[1]->mutable_cpu_data()[i] =