1 #ifndef CAFFE2_OPERATORS_TOP_K_H_ 2 #define CAFFE2_OPERATORS_TOP_K_H_ 4 #include "caffe2/core/logging.h" 5 #include "caffe2/core/operator.h" 6 #include "caffe2/utils/math.h" 10 template <
typename T,
class Context>
13 USE_OPERATOR_CONTEXT_FUNCTIONS;
15 template <
class... Args>
16 explicit TopKOp(Args&&... args)
18 OP_SINGLE_ARG(
int,
"k", k_, -1),
19 OP_SINGLE_ARG(
int,
"axis", axis_, -1) {
20 CAFFE_ENFORCE(k_ >= 1,
"k argument must be >= 1");
25 bool RunOnDevice()
override;
32 template <
typename T,
class Context>
35 USE_OPERATOR_CONTEXT_FUNCTIONS;
37 template <
class... Args>
40 OP_SINGLE_ARG(
int,
"axis", axis_, -1) {}
44 bool RunOnDevice()
override;
52 #endif // CAFFE2_OPERATORS_TOP_K_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...