1 #ifndef CAFFE2_OPERATORS_CLIP_OP_H_ 2 #define CAFFE2_OPERATORS_CLIP_OP_H_ 6 #include "caffe2/core/context.h" 7 #include "caffe2/core/logging.h" 8 #include "caffe2/core/operator.h" 9 #include "caffe2/utils/math.h" 13 template <
typename T,
class Context>
16 USE_OPERATOR_CONTEXT_FUNCTIONS;
17 template <
class... Args>
18 explicit ClipOp(Args&&... args)
20 min_(std::numeric_limits<T>::lowest()),
21 max_(std::numeric_limits<T>::max()) {
23 min_ =
static_cast<T>(this->
template GetSingleArgument<float>(
"min", 0));
26 max_ =
static_cast<T>(this->
template GetSingleArgument<float>(
"max", 0));
30 bool RunOnDevice()
override;
37 template <
typename T,
class Context>
40 USE_OPERATOR_CONTEXT_FUNCTIONS;
41 template <
class... Args>
44 min_(std::numeric_limits<T>::lowest()),
45 max_(std::numeric_limits<T>::max()) {
47 min_ =
static_cast<T>(this->
template GetSingleArgument<float>(
"min", 0));
50 max_ =
static_cast<T>(this->
template GetSingleArgument<float>(
"max", 0));
54 bool RunOnDevice()
override;
64 #endif // CAFFE2_OPERATORS_CLIP_OP_H_
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
bool HasArgument(const string &name) const
Checks if the operator has an argument of the given name.