1 #ifndef CAFFE2_OPERATORS_NORMALIZE_L1_OP_H_ 2 #define CAFFE2_OPERATORS_NORMALIZE_L1_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>
13 USE_OPERATOR_CONTEXT_FUNCTIONS;
16 bool RunOnDevice()
override {
17 const auto& x = Input(0);
19 const auto* xData = x.template data<T>();
21 auto* yData = y->template mutable_data<T>();
23 const auto canonical_axis = x.canonical_axis_index(
24 OperatorBase::GetSingleArgument<int>(
"axis", -1));
25 const int m = x.dim32(canonical_axis);
26 const int n = x.size() / m;
27 const int sf = x.size_from_dim(canonical_axis + 1);
28 DoNormalize(xData, yData, m, n, sf);
34 DoNormalize(
const T* xData, T* yData,
const int m,
const int n,
const int sf);
39 #endif // CAFFE2_OPERATORS_NORMALIZE_L1_OP_H_ A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...