MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / WriteReport

Method WriteReport

tensorflow/lite/testing/kernel_test/diff_analyzer.cc:86–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86TfLiteStatus DiffAnalyzer::WriteReport(const string& filename) {
87 if (filename.empty()) {
88 fprintf(stderr, "Empty output file name.");
89 return kTfLiteError;
90 }
91
92 std::ofstream output_file;
93 output_file.open(filename, std::fstream::out | std::fstream::trunc);
94 if (!output_file) {
95 fprintf(stderr, "Failed to open output file %s.", filename.c_str());
96 return kTfLiteError;
97 }
98
99 output_file << "Normalized L2 Error"
100 << ","
101 << "Normalized Max Diff"
102 << "\n";
103 for (int i = 0; i < base_tensors_.size(); i++) {
104 float l2_error =
105 CalculateNormalizedL2Norm(base_tensors_[i], test_tensors_[i]);
106 float max_diff =
107 CalculateNormalizedMaxDiff(base_tensors_[i], test_tensors_[i]);
108 output_file << l2_error << "," << max_diff << "\n";
109 }
110
111 output_file.close();
112 return kTfLiteOk;
113}
114} // namespace testing
115} // namespace tflite

Callers 2

TESTFunction · 0.80
mainFunction · 0.80

Calls 6

c_strMethod · 0.80
closeMethod · 0.65
emptyMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64