Caffe2 - C++ API
A deep learning, cross platform ML framework
math_ops.h
1 
17 #ifndef CAFFE2_OPERATORS_MATH_OP_H_
18 #define CAFFE2_OPERATORS_MATH_OP_H_
19 
20 #include "caffe2/core/common_omp.h"
21 #include "caffe2/core/context.h"
22 #include "caffe2/core/logging.h"
23 #include "caffe2/core/operator.h"
24 #include "caffe2/core/tensor.h"
25 #include "caffe2/operators/elementwise_op.h"
26 #include "caffe2/utils/math.h"
27 
28 namespace caffe2 {
29 
30 struct PowFunctor {
31  explicit PowFunctor(OperatorBase& op) {
32  exponent_ = op.GetSingleArgument<float>("exponent", 0);
33  }
34 
35  template <typename T, class Context>
36  inline void
37  operator()(const int n, const T* x, T* y, Context* device_context) {
38  math::Powx<float, Context>(n, x, exponent_, y, device_context);
39  }
40 
41  float exponent_;
42 };
43 }
44 
45 #endif
Copyright (c) 2016-present, Facebook, Inc.