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 Jan 11, 2015
1 parent a8665bc commit 65e5a18
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 65e5a18

Please sign in to comment.