Skip to content

Commit cc7f7ab

Browse files
committed
fix the incorrect top data initialize to avoid garbage copy in multiple inference run
1 parent f048fc7 commit cc7f7ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/caffe/layers/space_to_batch_nd_layer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ void SpaceToBatchNDLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
6262
const vector<Blob<Dtype>*>& top) {
6363
const Dtype* bottom_data = bottom[0]->cpu_data();
6464
Dtype* top_data = top[0]->mutable_cpu_data();
65+
const int count = top[0]->count();
66+
caffe_set(count, Dtype(0), top_data);
6567
vector<int> bottom_shape = bottom[0]->shape();
6668
vector<int> top_shape = bottom_shape;
6769

0 commit comments

Comments
 (0)