1 #ifndef CAFFE_OPERATORS_REPLACE_NAN_OP_H_ 2 #define CAFFE_OPERATORS_REPLACE_NAN_OP_H_ 4 #include "caffe2/core/context.h" 5 #include "caffe2/core/logging.h" 6 #include "caffe2/core/operator.h" 7 #include "caffe2/utils/math.h" 11 template <
class Context>
14 USE_OPERATOR_CONTEXT_FUNCTIONS;
18 bool RunOnDevice()
override {
23 void ReplaceNaN(
const T& value,
const TIndex size,
const T* X, T* Y);
26 bool DoRunWithType() {
27 T value = OperatorBase::GetSingleArgument<T>(
"value", 0);
29 auto& input = Input(0);
30 auto* output = Output(0);
31 output->ResizeLike(input);
33 const T* input_data = input.template data<T>();
34 T* output_data = output->template mutable_data<T>();
36 ReplaceNaN<T>(value, input.size(), input_data, output_data);
44 #endif // CAFFE_OPERATORS_REPLACE_NAN_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 ...