1 #ifndef CAFFE2_OPERATORS_SUMMARIZE_OP_H_ 2 #define CAFFE2_OPERATORS_SUMMARIZE_OP_H_ 6 #include "caffe2/core/context.h" 7 #include "caffe2/core/operator.h" 8 #include "caffe2/utils/math.h" 12 constexpr
char kSummaryzeOpExtension[] =
".summary";
14 template <
typename T,
class Context>
19 to_file_(this->
template GetSingleArgument<int>(
"to_file", 0)) {
22 const string& target_folder = ws->
RootFolder();
27 string proper_name = def.input(0);
28 std::replace(proper_name.begin(), proper_name.end(),
'/',
'#');
29 log_file_.reset(
new std::ofstream(
30 target_folder +
"/" + proper_name + kSummaryzeOpExtension,
31 std::ofstream::out | std::ofstream::trunc));
34 "Failed to open summarize file for tensor ",
37 log_file_->rdstate());
44 USE_OPERATOR_CONTEXT_FUNCTIONS;
45 bool RunOnDevice()
override;
47 static constexpr
int MIN_IDX = 0;
48 static constexpr
int MAX_IDX = 1;
49 static constexpr
int MEAN_IDX = 2;
50 static constexpr
int STD_IDX = 3;
52 static constexpr
int NUM_STATS = 4;
56 std::unique_ptr<std::ofstream> log_file_;
61 #endif // CAFFE2_OPERATORS_SUMMARIZE_OP_H_ const string & RootFolder()
Return the root folder of the workspace.
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 ...