onnxruntime/onnxruntime/test/onnx/TestResultStat.cc
RandySheriffH 4757933afe
Exclude test by onnx version tag (#1073)
* add version filter to failed tests

* exclude test from backend

* exclude shrink from opset 9

* fix compile err

* exclude certain version of constant shape

* enable flatten test

* fix compile err

* comment mvn test

* disable constantofshape test in x86

* disable x86 test

* get model version from imported opset

* test linux x86 case

* disable nonzero opset 10

* make mutex const

* test filter by commit id

* adjust substr offset

* Limit test platform

* remove change impacting TFModleInfo.h

* refactoring

* refactoring

* test x86 pipeline with filter

* add comment

* restrict version extraction on non-win

* restrict version extraction on non-win

* add tag

* exclude case from backend test

* remove dup

* remove dup

* make script runnable

* hard code adsolute path

* refactor log

* fix x86 compile err

* fix x86 compile err

* fix x86 compile err

* sync with latest tensorrt

* switch to regex

* fix cpu pipeline err

* test filter

* disable nonzero from all versions
2019-05-30 16:19:06 -07:00

59 lines
2.3 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include <cstdio>
#include <sstream>
#include <algorithm>
#include <vector>
#include "TestResultStat.h"
namespace {
void operator << (std::ostringstream& oss, const std::pair<std::string, std::string>& p) {
oss << p.first << " of " << p.second;
}
template <typename T1>
std::string containerToStr(const T1& input) {
std::ostringstream oss;
bool is_first = true;
std::vector<typename T1::value_type> vec(input.begin(), input.end());
std::sort(vec.begin(), vec.end());
for (const auto& s : vec) {
if (!is_first) oss << ", ";
oss << s;
is_first = false;
}
return oss.str();
}
} // namespace
std::string TestResultStat::ToString() {
std::string not_implemented_kernels_str = containerToStr(this->not_implemented_kernels);
std::string failed_kernels_str = containerToStr(this->failed_kernels);
int failed = static_cast<int>(this->total_test_case_count) - this->succeeded - this->skipped - this->not_implemented;
int other_reason_failed = failed - this->load_model_failed - this->result_differs - this->throwed_exception - this->invalid_graph;
std::ostringstream oss;
oss << "result: "
"\n\tModels: "
<< this->total_model_count
<< "\n\tTotal test cases: "
<< this->total_test_case_count
<< "\n\t\tSucceeded: " << this->succeeded
<< "\n\t\tNot implemented: " << this->not_implemented
<< "\n\t\tFailed: " << failed << "\n";
if (this->invalid_graph)
oss << "\t\t\tGraph is invalid:" << this->invalid_graph << "\n";
if (this->load_model_failed)
oss << "\t\t\tGot exception while loading model: " << this->load_model_failed << "\n";
if (this->throwed_exception)
oss << "\t\t\tGot exception while running: " << this->throwed_exception << "\n";
if (this->result_differs)
oss << "\t\t\tResult differs: " << this->result_differs << "\n";
if (other_reason_failed != 0) oss << "\t\t\tOther reason:" << other_reason_failed << "\n";
oss << "\tStats by Operator type:\n";
oss << "\t\tNot implemented(" << this->not_implemented_kernels.size() << "): " << not_implemented_kernels_str << "\n\t\tFailed:"
<< failed_kernels_str << "\n";
oss << "Failed Test Cases:" << containerToStr(failed_test_cases) << "\n";
return oss.str();
}