Skip to content

Commit

Permalink
[LPT] IR comparison #2
Browse files Browse the repository at this point in the history
  • Loading branch information
eshoguli committed Jun 18, 2021
1 parent 02b9635 commit 43e9775
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
12 changes: 12 additions & 0 deletions inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@

#include "transformations/serialize.hpp"

#include <sys/types.h>
#include <unistd.h>


using namespace MKLDNNPlugin;
using namespace InferenceEngine;

Expand Down Expand Up @@ -361,12 +365,20 @@ static void Transformation(CNNNetwork& clonedNetwork, const Config& conf) {
//ngraph::pass::VisualizeTree("c:\\Projects\\temp\\cpu.transformed").run_on_function(nGraphFunc);

{
#ifdef WIN32
const auto processId = GetCurrentProcessId();
ngraph::pass::Serialize serializer(
"c:\\Projects\\temp\\cpu.transformed." + std::to_string(processId) + ".xml",
"c:\\Projects\\temp\\cpu.transformed." + std::to_string(processId) + ".bin");
#else
const auto processId = getpid();
ngraph::pass::Serialize serializer(
"/localdisk/eshoguli/temp/cpu.transformed." + std::to_string(processId) + ".xml",
"/localdisk/eshoguli/temp/cpu.transformed." + std::to_string(processId) + ".bin");
#endif
serializer.run_on_function(nGraphFunc);
}
std::cout << "LPT was DONE" << std::endl;
}

ngraph::pass::Manager postLPTPassManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ Comparator::Result Comparator::compare(
auto type_info2 = node2->get_type_info();

if (!compareTypeInfo(type_info1, type_info2)) {
return Result::error(node1->get_friendly_name() + " (" + typeInfoToStr(type_info1) + ") != " + node2->get_friendly_name() + " (" + typeInfoToStr(type_info2) + ")");
return Result::error(node1->get_friendly_name() + " (" + typeInfoToStr(type_info1) + ") != " +
node2->get_friendly_name() + " (" + typeInfoToStr(type_info2) + ")");
}

auto subgraph1 = dynamic_cast<ngraph::op::util::SubGraphOp*>(node1);
Expand Down Expand Up @@ -722,8 +723,8 @@ void Comparator::compare_inputs(ngraph::Node* node1, ngraph::Node* node2, std::o

void Comparator::compare_outputs(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log) {
for (int i = 0; i < node1->outputs().size(); ++i) {
const auto& tensor1 = node1->output(i).get_tensor();
const auto& tensor2 = node2->output(i).get_tensor();
//const auto& tensor1 = node1->output(i).get_tensor();
//const auto& tensor2 = node2->output(i).get_tensor();

//if (tensor1.get_names() != tensor2.get_names()) {
// err_log << "Output tensors names " << tensor_names(tensor1) << " and "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ template<typename Node>
std::string description(const Node& n) {
return n->get_friendly_name() + " (" + (n->get_type_name()) + ")";
}

}
namespace attributes {

Expand Down
1 change: 1 addition & 0 deletions ngraph/core/include/ngraph/enum_names.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

#pragma once
#pragma GCC diagnostic ignored "-Wreturn-type"

#include <algorithm>
#include <string>
Expand Down
5 changes: 2 additions & 3 deletions ngraph/core/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ size_t Node::get_default_output_index() const
size_t Node::no_default_index() const
{
NODE_VALIDATION_CHECK(this, false, "Default output not supported");
throw std::exception((std::string("Default output not supported: ") + get_type_name() + ": " +
get_friendly_name())
.c_str());
std::logic_error e(std::string("Default output not supported: ") + get_type_name() + ": " + get_friendly_name());
throw std::exception(e);
}

std::shared_ptr<Node>
Expand Down

0 comments on commit 43e9775

Please sign in to comment.