namespace caffe {
-template<typename Dtype>
-bool int_Dtype_pair_greater(std::pair<int, Dtype> a,
- std::pair<int, Dtype> b) {
- return a.second > b.second || (a.second == b.second && a.first > b.first);
-}
-
/* ArgmaxLayer
Compute the index of the max value across all (channels x height x width).
[In the future, can take specific dimension.]
#include <algorithm>
#include <cfloat>
#include <queue>
+#include <utility>
#include <vector>
#include "caffe/layer.hpp"
}
}
+template<typename Dtype>
+bool int_Dtype_pair_greater(std::pair<int, Dtype> a,
+ std::pair<int, Dtype> b) {
+ return a.second > b.second;
+}
+
template <typename Dtype>
Dtype ArgMaxLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top) {
for (int i = 0; i < num; ++i) {
std::vector<std::pair<int, Dtype> > bottom_data_vector;
for (int j = 0; j < dim; ++j) {
- bottom_data_vector.push_back(std::make_pair(j, bottom_data[i * dim + j]));
+ bottom_data_vector.push_back(
+ std::make_pair(j, bottom_data[i * dim + j]));
}
std::partial_sort(
bottom_data_vector.begin(), bottom_data_vector.begin() + top_k_,