1 #ifndef CAFFE2_OPERATORS_ACCUMULATE_OP_H_ 2 #define CAFFE2_OPERATORS_ACCUMULATE_OP_H_ 4 #include "caffe2/core/context.h" 5 #include "caffe2/core/operator.h" 6 #include "caffe2/utils/math.h" 10 template <
typename T,
class Context>
15 gamma_(static_cast<T>(
16 OperatorBase::template GetSingleArgument<float>(
"gamma", 1.0))) {}
17 USE_OPERATOR_CONTEXT_FUNCTIONS;
19 bool RunOnDevice()
override {
20 auto& input = Input(0);
21 auto* output = Output(0);
22 if (output->dims() != input.dims()) {
23 LOG(INFO) <<
"Reshaping and initializing output.";
24 output->ResizeLike(input);
25 math::Set<T, Context>(
26 output->size(), 0, output->template mutable_data<T>(), &context_);
28 math::Axpby<T, Context>(
31 input.template data<T>(),
33 output->template mutable_data<T>(),
44 #endif // CAFFE2_OPERATORS_ACCUMULATE_OP_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 ...