Skip to content

Commit

Permalink
add FilterMap for the coord mapping used by (de)conv and pooling layers
Browse files Browse the repository at this point in the history
  • Loading branch information
longjon committed Dec 31, 2014
1 parent 9b44090 commit 8e459ef
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/caffe/util/coords.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ class DiagonalAffineMap {
vector<pair<Dtype, Dtype> > coefs_;
};

template <typename Dtype>
DiagonalAffineMap<Dtype> FilterMap(const int kernel_h, const int kernel_w,
const int stride_h, const int stride_w, const int pad_h, const int pad_w) {
vector<pair<Dtype, Dtype> > coefs;
coefs.push_back(make_pair(stride_h,
static_cast<Dtype>(kernel_h - 1) / 2 - pad_h));
coefs.push_back(make_pair(stride_w,
static_cast<Dtype>(kernel_w - 1) / 2 - pad_w));
return DiagonalAffineMap<Dtype>(coefs);
}

} // namespace caffe

#endif // CAFFE_UTIL_COORDS_H_

0 comments on commit 8e459ef

Please sign in to comment.