From eadf9585ef60c331f72874a2ee32d2bd967be0d1 Mon Sep 17 00:00:00 2001 From: Ilya Churaev Date: Wed, 16 Sep 2020 09:26:49 +0300 Subject: [PATCH] Fixed KW warning and review issues --- ngraph/core/include/ngraph/node.hpp | 4 +++- .../ngraph/runtime/reference/gather.hpp | 4 ++++ ngraph/core/src/node.cpp | 20 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ngraph/core/include/ngraph/node.hpp b/ngraph/core/include/ngraph/node.hpp index 8a9c92aad564ea..31c2ca2e4cc0b7 100644 --- a/ngraph/core/include/ngraph/node.hpp +++ b/ngraph/core/include/ngraph/node.hpp @@ -155,9 +155,11 @@ namespace ngraph protected: /// \brief Construct an unitialized Node - Node() {} + Node() = default; /// \brief Copying a node Node(const Node&); + /// \brief Assignment operator + Node& operator=(const Node&); /// \brief Construct an unitialized Node /// \param output_size Number of outputs for this node diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/gather.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/gather.hpp index 4ad4aa91165fbf..3dbfecf836bf7e 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/gather.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/gather.hpp @@ -149,6 +149,8 @@ namespace ngraph auto out_outer_coord_iter = out_outer_transform.begin(); for (const Coordinate& params_outer_coord : params_outer_transform) { + if (out_outer_coord_iter == out_outer_transform.end()) + break; const T* params_prime = ¶ms[params_outer_transform.index(params_outer_coord)]; T* out_outer = &out[out_outer_transform.index(*out_outer_coord_iter)]; @@ -156,6 +158,8 @@ namespace ngraph auto out_inner_coord_iter = out_inner_transform.begin(); for (const Coordinate& indices_outer_coord : indices_outer_transform) { + if (out_inner_coord_iter == out_inner_transform.end()) + break; const U* indices_prime = &indices[indices_outer_transform.index(indices_outer_coord)]; T* out_prime = &out_outer[out_inner_transform.index(*out_inner_coord_iter)]; diff --git a/ngraph/core/src/node.cpp b/ngraph/core/src/node.cpp index dd66060207155c..487b410f35eb5a 100644 --- a/ngraph/core/src/node.cpp +++ b/ngraph/core/src/node.cpp @@ -55,6 +55,26 @@ Node::Node(const Node& node) } } +Node& Node::operator=(const Node& node) +{ + this->m_control_dependents = node.m_control_dependents; + this->m_control_dependencies = node.m_control_dependencies; + this->m_instance_id = m_next_instance_id.fetch_add(1); + this->m_friendly_name = node.m_friendly_name; + this->m_provenance_tags = node.m_provenance_tags; + this->m_provenance_group = node.m_provenance_group; + this->m_inputs = node.m_inputs; + this->m_op_annotations = node.m_op_annotations; + this->m_rt_info = node.m_rt_info; + // cannot do it without copying node.m_inputs first due to too limiting const qualifiers + for (auto& input : m_inputs) + { + input = descriptor::Input(this, input.get_index(), input.get_output()); + input.get_output().add_input(&input); + } + return *this; +} + Node::Node(size_t output_size) : Node() {