summaryrefslogtreecommitdiff
path: root/src/caffe/layers/accuracy_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/caffe/layers/accuracy_layer.cpp')
-rw-r--r--src/caffe/layers/accuracy_layer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/caffe/layers/accuracy_layer.cpp b/src/caffe/layers/accuracy_layer.cpp
index 392829e..b6d95b5 100644
--- 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] =