1 #ifndef CAFFE2_OPERATORS_SCALE_OP_H_ 2 #define CAFFE2_OPERATORS_SCALE_OP_H_ 4 #include "caffe2/core/context.h" 5 #include "caffe2/core/operator.h" 6 #include "caffe2/utils/math.h" 10 template <
class Context>
13 USE_OPERATOR_CONTEXT_FUNCTIONS;
14 template <
class... Args>
15 explicit ScaleOp(Args&&... args)
17 scale_(this->
template GetSingleArgument<float>(
"scale", 1.0)) {}
20 bool DoRunWithType() {
23 auto* Y = Output(0, X.sizes(), at::dtype<T>());
24 math::Scale<float, T, Context>(
28 Y->template mutable_data<T>(),
33 bool RunOnDevice()
override {
43 #endif // CAFFE2_OPERATORS_SCALE_OP_H_ const Tensor & Input(int idx, DeviceType type=Context::GetDeviceType())
Retrieve a non-owning reference to the input at position 'idx' for this operator. ...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...