Commit c153ea8a authored by gcwenger's avatar gcwenger Committed by Robert Kimball

Graph comparison testing quiet unless problem is detected (#2258)

* Graph comparison testing quiet unless problem is detected.

* Fixed file formatting

* Renamed ss => msg
parent 5d80f203
This diff is collapsed.
...@@ -284,16 +284,20 @@ void random_init(ngraph::runtime::Tensor* tv, std::default_random_engine& engine ...@@ -284,16 +284,20 @@ void random_init(ngraph::runtime::Tensor* tv, std::default_random_engine& engine
} }
template <> template <>
void print_results(std::vector<char>& ref_data, std::vector<char>& actual_data, size_t max_results) string
get_results_str(std::vector<char>& ref_data, std::vector<char>& actual_data, size_t max_results)
{ {
stringstream ss;
size_t num_results = std::min(static_cast<size_t>(max_results), ref_data.size()); size_t num_results = std::min(static_cast<size_t>(max_results), ref_data.size());
std::cout << "First " << num_results << " results"; ss << "First " << num_results << " results";
for (size_t i = 0; i < num_results; ++i) for (size_t i = 0; i < num_results; ++i)
{ {
std::cout << "\n" ss << "\n"
<< std::setw(4) << i << " ref: " << std::setw(16) << std::left << std::setw(4) << i << " ref: " << std::setw(16) << std::left
<< static_cast<int>(ref_data[i]) << " actual: " << std::setw(16) << std::left << static_cast<int>(ref_data[i]) << " actual: " << std::setw(16) << std::left
<< static_cast<int>(actual_data[i]); << static_cast<int>(actual_data[i]);
} }
std::cout << std::endl; ss << "\n";
return ss.str();
} }
...@@ -169,18 +169,24 @@ std::vector<std::vector<T1>> execute(const std::shared_ptr<ngraph::Function>& fu ...@@ -169,18 +169,24 @@ std::vector<std::vector<T1>> execute(const std::shared_ptr<ngraph::Function>& fu
} }
template <typename T> template <typename T>
void print_results(std::vector<T>& ref_data, std::vector<T>& actual_data, size_t max_results = 16) std::string
get_results_str(std::vector<T>& ref_data, std::vector<T>& actual_data, size_t max_results = 16)
{ {
std::stringstream ss;
size_t num_results = std::min(static_cast<size_t>(max_results), ref_data.size()); size_t num_results = std::min(static_cast<size_t>(max_results), ref_data.size());
std::cout << "First " << num_results << " results"; ss << "First " << num_results << " results";
for (size_t i = 0; i < num_results; ++i) for (size_t i = 0; i < num_results; ++i)
{ {
std::cout << "\n" ss << "\n"
<< std::setw(4) << i << " ref: " << std::setw(16) << std::left << ref_data[i] << std::setw(4) << i << " ref: " << std::setw(16) << std::left << ref_data[i]
<< " actual: " << std::setw(16) << std::left << actual_data[i]; << " actual: " << std::setw(16) << std::left << actual_data[i];
} }
std::cout << std::endl; ss << "\n";
return ss.str();
} }
template <> template <>
void print_results(std::vector<char>& ref_data, std::vector<char>& actual_data, size_t max_results); std::string get_results_str(std::vector<char>& ref_data,
std::vector<char>& actual_data,
size_t max_results);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment