#ifndef CAFFE2_OPERATORS_ACCURACY_OP_H_ #define CAFFE2_OPERATORS_ACCURACY_OP_H_ #include "caffe2/core/context.h" #include "caffe2/core/operator.h" namespace caffe2 { template class AccuracyOp final : public Operator { public: USE_OPERATOR_CONTEXT_FUNCTIONS; template explicit AccuracyOp(Args&&... args) : Operator(std::forward(args)...), top_k_(this->template GetSingleArgument("top_k", 1)) {} bool RunOnDevice() override; protected: int top_k_; INPUT_TAGS(PREDICTION, LABEL); }; } // namespace caffe2 #endif // CAFFE2_OPERATORS_ACCURACY_OP_H_