index c6020e378e4b2d24a175ccd48a6f7bfd2a157a2f..ee874932d8fd7e2802aab38d234eccddbda01b34 100644 (file)
#include "caffeine/layer.hpp"
#include "caffeine/util/im2col.hpp"
#include "caffeine/vision_layers.hpp"
+#include "caffeine/common.hpp"
namespace caffeine {
}
}
+template <typename Dtype>
+void Im2colLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
+ vector<Blob<Dtype>*>* top) {
+ const Dtype* bottom_data = bottom[0]->gpu_data();
+ Dtype* top_data = (*top)[0]->mutable_gpu_data();
+ for (int n = 0; n < bottom[0]->num(); ++n) {
+ im2col_gpu(bottom_data + bottom[0]->offset(n), CHANNELS_, HEIGHT_,
+ WIDTH_, KSIZE_, STRIDE_, top_data + (*top)[0]->offset(n));
+ }
+}
+
template <typename Dtype>
Dtype Im2colLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
const bool propagate_down, vector<Blob<Dtype>*>* bottom) {