1 #ifndef CAFFE2_OPERATORS_MINMAX_OPS_H_ 2 #define CAFFE2_OPERATORS_MINMAX_OPS_H_ 4 #include "caffe2/core/common_omp.h" 5 #include "caffe2/core/context.h" 6 #include "caffe2/core/logging.h" 7 #include "caffe2/core/operator.h" 8 #include "caffe2/core/types.h" 9 #include "caffe2/utils/math.h" 13 template <
typename T,
class Context>
16 USE_OPERATOR_CONTEXT_FUNCTIONS;
19 bool RunOnDevice()
override {
20 auto& input0 = Input(0);
21 auto* output = Output(0);
23 output->ResizeLike(input0);
24 output->CopyFrom(input0, &context_);
26 if (InputSize() == 1) {
31 for (
int i = 1; i < InputSize(); ++i) {
35 "Description: Input #",
39 " should match output dimension: ",
43 return this->Compute();
46 virtual bool Compute() = 0;
49 template <
typename T,
class Context>
52 USE_OPERATOR_CONTEXT_FUNCTIONS;
55 virtual ~
MaxOp() noexcept {}
56 bool Compute()
override;
59 template <
typename T,
class Context>
62 USE_OPERATOR_CONTEXT_FUNCTIONS;
65 bool RunOnDevice()
override;
68 template <
typename T,
class Context>
76 template <
typename T,
class Context>
79 USE_OPERATOR_CONTEXT_FUNCTIONS;
82 virtual ~
MinOp() noexcept {}
83 bool Compute()
override;
86 template <
typename T,
class Context>
96 #endif // CAFFE2_OPERATORS_MINMAX_OPS_H_
Workspace is a class that holds all the related objects created during runtime: (1) all blobs...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...