#include <vector>

#include "caffe/layer.hpp"
#include "caffe/util/math_functions.hpp"
#include "caffe/vision_layers.hpp"

namespace caffe {

template <typename Dtype>
void FlattenLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
      vector<Blob<Dtype>*>* top) {
  (*top)[0]->ShareData(*bottom[0]);
}

template <typename Dtype>
void FlattenLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
      const vector<bool>& propagate_down, vector<Blob<Dtype>*>* bottom) {
  (*bottom)[0]->ShareDiff(*top[0]);
  /*const Dtype* top_diff = top[0]->cpu_diff();
  LOG(INFO) << this->layer_param_.name() << " " << "top diff:";
  for (int i=0;i<10;i++)
  {
  	LOG(INFO) << top_diff[i];
  }*/
}

INSTANTIATE_CLASS(FlattenLayer);

}  // namespace caffe
