Skip to content

Commit

Permalink
Merge pull request BVLC#2016 from shelhamer/share-col-buffer
Browse files Browse the repository at this point in the history
Share convolution buffers to reduce memory usage
  • Loading branch information
jmerkow committed Jun 27, 2017
2 parents 4efdf7e + 839b050 commit 308f1b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/caffe/layers/base_conv_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ class BaseConvolutionLayer : public Layer<Dtype> {
int col_offset_;
int output_offset_;

Blob<Dtype> col_buffer_;
// N.B. sharing the col buffer reduces memory but interferes with
// ND conv and parallelism
static Blob<Dtype> col_buffer_;
Blob<Dtype> bias_multiplier_;
};

Expand Down
3 changes: 3 additions & 0 deletions src/caffe/layers/base_conv_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace caffe {

template <typename Dtype>
Blob<Dtype> BaseConvolutionLayer<Dtype>::col_buffer_;

template <typename Dtype>
void BaseConvolutionLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
Expand Down

0 comments on commit 308f1b8

Please sign in to comment.