Skip to content

Refactoring FunctionsComparator - extract node comparison part#4175

Merged
ilyachur merged 7 commits intoopenvinotoolkit:masterfrom
elszkowski:compare_function-compare_refactor_for_subgraph
Feb 16, 2021
Merged

Refactoring FunctionsComparator - extract node comparison part#4175
ilyachur merged 7 commits intoopenvinotoolkit:masterfrom
elszkowski:compare_function-compare_refactor_for_subgraph

Conversation

@elszkowski
Copy link
Copy Markdown

@elszkowski elszkowski commented Feb 3, 2021

This PR, Node comparison is extracted to separate method (Comparator::compare(Node*,Node*)).
Comparator is here introduce to cover all comparing jobs and manage compared nodes queue.
For comparing subgraph we have to create another nodes queue so we need call Comparator::recreate to create new Comparator with the same set of flags (what should be check inside comparison).

Related ticket number: 47693.

const std::shared_ptr<ngraph::Function>& f1, const std::shared_ptr<ngraph::Function>& f2);

Result compare(ngraph::Node* node1, ngraph::Node* node2) {
std::stringstream errors;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing stringstream to execution is required because for now we have less important errors gather in stringstream called err_log. If this policy (minor and major error) will remove src will be simpler.

"Number of inputs is different: " + to_str(node1->inputs().size()) + " for " +
name(node1) + " and " + to_str(node2->inputs().size()) + " for " + name(node2));
if (subgraph1 && subgraph2) {
auto result = recreate().compare(subgraph1->get_function(), subgraph2->get_function());
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be switch to CompareNodesAttributes and on Function adapter soon.

}
}

return Result::ok("Check if any minor error was log in to err_log");
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non obvious result. It came from minor and major error which might happen during whole Function traversing.

@elszkowski elszkowski marked this pull request as ready for review February 4, 2021 15:52
@elszkowski elszkowski requested review from a team, e-nugmanova and sdurawa February 4, 2021 15:52
@elszkowski elszkowski requested a review from ilyachur February 5, 2021 11:17
@jdanieck
Copy link
Copy Markdown
Contributor

jdanieck commented Feb 10, 2021

@ilyachur @GlebKazantaev @itikhono please have a look. I was told that this PR blocks progress on #4123.

@jdanieck jdanieck removed their request for review February 11, 2021 09:39
@GlebKazantaev GlebKazantaev removed their request for review February 15, 2021 11:56
Copy link
Copy Markdown
Contributor

@itikhono itikhono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ilyachur ilyachur merged commit a73e997 into openvinotoolkit:master Feb 16, 2021
@elszkowski elszkowski deleted the compare_function-compare_refactor_for_subgraph branch February 26, 2021 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants