Fixed RTTI issues for ngraph::Variant (#1258)
authorIlya Lavrenov <ilya.lavrenov@intel.com>
Thu, 9 Jul 2020 03:13:20 +0000 (06:13 +0300)
committerGitHub <noreply@github.com>
Thu, 9 Jul 2020 03:13:20 +0000 (06:13 +0300)
inference-engine/src/inference_engine/ie_parameter.cpp
inference-engine/src/transformations/include/transformations/rt_info/fused_names_attribute.hpp
inference-engine/src/transformations/include/transformations/rt_info/primitives_priority_attribute.hpp
inference-engine/src/transformations/src/transformations/rt_info/fused_names_attribute.cpp
inference-engine/src/transformations/src/transformations/rt_info/primitives_priority_attribute.cpp
ngraph/src/ngraph/variant.cpp
ngraph/src/ngraph/variant.hpp
ngraph/test/op.cpp

index 8a9b4aa..93c54c7 100644 (file)
@@ -9,6 +9,11 @@
 
 namespace ngraph {
 
+template <typename T>
+VariantImpl<T>::~VariantImpl() { }
+
+template class INFERENCE_ENGINE_API_CLASS(VariantImpl<InferenceEngine::Parameter>);
+
 template <>
 class INFERENCE_ENGINE_API_CLASS(VariantWrapper<InferenceEngine::Parameter>) : public VariantImpl<InferenceEngine::Parameter> {
 public:
index cea8247..69d63ab 100644 (file)
@@ -61,6 +61,8 @@ public:
     std::vector<std::string> getVectorNames() const;
 };
 
+extern template class TRANSFORMATIONS_API VariantImpl<FusedNames>;
+
 template<>
 class TRANSFORMATIONS_API VariantWrapper<FusedNames> : public VariantImpl<FusedNames> {
 public:
index b5df594..24e6c46 100644 (file)
@@ -46,6 +46,8 @@ public:
     std::string getPrimitivesPriority() const;
 };
 
+extern template class TRANSFORMATIONS_API VariantImpl<PrimitivesPriority>;
+
 template<>
 class TRANSFORMATIONS_API VariantWrapper<PrimitivesPriority> : public VariantImpl<PrimitivesPriority> {
 public:
index e625d4c..eef8b4b 100644 (file)
 
 namespace ngraph {
 
+template <typename T>
+VariantImpl<T>::~VariantImpl() { }
+
+template class ngraph::VariantImpl<FusedNames>;
+
 constexpr VariantTypeInfo VariantWrapper<FusedNames>::type_info;
 
 std::string FusedNames::getNames() const {
index 1f8b63b..03b7e4f 100644 (file)
 
 namespace ngraph {
 
+template <typename T>
+VariantImpl<T>::~VariantImpl() { }
+
+template class ngraph::VariantImpl<PrimitivesPriority>;
+
 constexpr VariantTypeInfo VariantWrapper<PrimitivesPriority>::type_info;
 
 std::string PrimitivesPriority::getPrimitivesPriority() const {
index 83e7cb1..e2a8255 100644 (file)
@@ -21,3 +21,25 @@ using namespace ngraph;
 // Define variant for std::string
 constexpr VariantTypeInfo VariantWrapper<std::string>::type_info;
 constexpr VariantTypeInfo VariantWrapper<int64_t>::type_info;
+
+Variant::~Variant()
+{
+}
+
+std::shared_ptr<ngraph::Variant> Variant::init(const std::shared_ptr<ngraph::Node>& node)
+{
+    return nullptr;
+}
+
+std::shared_ptr<ngraph::Variant> Variant::merge(const ngraph::NodeVector& nodes)
+{
+    return nullptr;
+}
+
+template <typename T>
+VariantImpl<T>::~VariantImpl()
+{
+}
+
+template class ngraph::VariantImpl<std::string>;
+template class ngraph::VariantImpl<int64_t>;
index f56a64f..2da6217 100644 (file)
@@ -26,21 +26,14 @@ namespace ngraph
 {
     using VariantTypeInfo = DiscreteTypeInfo;
 
-    class Variant
+    class NGRAPH_API Variant
     {
     public:
-        virtual ~Variant() {}
+        virtual ~Variant();
         virtual const VariantTypeInfo& get_type_info() const = 0;
 
-        virtual std::shared_ptr<ngraph::Variant> init(const std::shared_ptr<ngraph::Node>& node)
-        {
-            return nullptr;
-        }
-
-        virtual std::shared_ptr<ngraph::Variant> merge(const ngraph::NodeVector& nodes)
-        {
-            return nullptr;
-        }
+        virtual std::shared_ptr<ngraph::Variant> init(const std::shared_ptr<ngraph::Node>& node);
+        virtual std::shared_ptr<ngraph::Variant> merge(const ngraph::NodeVector& nodes);
     };
 
     template <typename VT>
@@ -53,6 +46,9 @@ namespace ngraph
             : m_value(value)
         {
         }
+
+        ~VariantImpl() override;
+
         const value_type& get() const { return m_value; }
         value_type& get() { return m_value; }
         void set(const value_type& value) { m_value = value; }
@@ -60,6 +56,9 @@ namespace ngraph
         value_type m_value;
     };
 
+    extern template class NGRAPH_API VariantImpl<std::string>;
+    extern template class NGRAPH_API VariantImpl<int64_t>;
+
     template <typename VT>
     class VariantWrapper
     {
index 91f6328..b5e0df4 100644 (file)
@@ -69,6 +69,11 @@ struct Ship
 
 namespace ngraph
 {
+    template <typename T>
+    VariantImpl<T>::~VariantImpl()
+    {
+    }
+
     template <>
     class VariantWrapper<Ship> : public VariantImpl<Ship>
     {