Add constant subgrpahs handling in extractor (#5079)

* Initial summary dumper implementation

* Handle Tensoriterator body + add parser script

* Bump tox from 3.20.1 to 3.21.2 in /ngraph/python (#32)

Bumps [tox](https://github.com/tox-dev/tox) from 3.20.1 to 3.21.2.
- [Release notes](https://github.com/tox-dev/tox/releases)
- [Changelog](https://github.com/tox-dev/tox/blob/master/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/tox/compare/3.20.1...3.21.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove extra main files

* Fix constant subgraphs on operation ports handling

* Rollback accident change of GPU device name in test_constants.hpp

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Mikhail Treskin 2021-04-02 12:58:45 +03:00 committed by GitHub
parent d7a2d13152
commit 89b876b592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
#include "matchers/single_op.hpp"
#include "ngraph/ops.hpp"
#include "ngraph/validation_util.hpp"
#include <cstdlib>
using namespace SubgraphsDumper;
@ -121,17 +122,17 @@ bool SingleOpMatcher::match_ports(const std::shared_ptr<ngraph::Node> &node, con
if (std::any_of(begin(ignored_ports), end(ignored_ports), [=](size_t p){return p == port_id;})) {
continue;
}
const auto &cur_node_input = node->input_value(port_id).get_node_shared_ptr();
const auto &ref_node_input = ref->input_value(port_id).get_node_shared_ptr();
const auto &cur_node_input = node->input_value(port_id);
const auto &ref_node_input = ref->input_value(port_id);
const auto &cur_const_input = std::dynamic_pointer_cast<ngraph::op::Constant>(cur_node_input);
const auto &ref_const_input = std::dynamic_pointer_cast<ngraph::op::Constant>(ref_node_input);
const auto &cur_const_input = ngraph::get_constant_from_source(cur_node_input);
const auto &ref_const_input = ngraph::get_constant_from_source(ref_node_input);
// Check that both OP an reference port inputs are constant and have same data
if (cur_const_input && ref_const_input &&
!compare_constants_data(cur_const_input, ref_const_input)) {
return false;
// Check that input nodes on the port both not constants
// Check that input nodes on the port both not constants
} else if ((cur_const_input && !ref_const_input) || (!cur_const_input && ref_const_input)) {
return false;
}