#include <algorithm>
#include <functional>
#include <utility>
#include <vector>
#include <fstream>

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

namespace caffe {

template <typename Dtype>
void GSV2KNNAccuracyLayer<Dtype>::LayerSetUp(
  const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
  //top_k_ = this->layer_param_.knn_accuracy_param().top_k();
}

template <typename Dtype>
void GSV2KNNAccuracyLayer<Dtype>::Reshape(
  const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
  CHECK_EQ(bottom[0]->channels(), bottom[1]->channels())
      << "The data and label should have the same dimension.";
  CHECK_EQ(bottom[1]->height(), 1);
  CHECK_EQ(bottom[1]->width(), 1);
  (*top)[0]->Reshape(1, 1, 1, 1);
}

template <typename Dtype>
void GSV2KNNAccuracyLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
    vector<Blob<Dtype>*>* top) {
  //file.close();
  //LOG(INFO) << "Accuracy: " << accuracy/num;
  (*top)[0]->mutable_cpu_data()[0] = 0;
  // Accuracy layer should not be used as a loss function.
}

INSTANTIATE_CLASS(GSV2KNNAccuracyLayer);

}  // namespace caffe
