Commit 036eafe0 authored by Yixing Lao's avatar Yixing Lao

fix failing build of operator overloading

parent c7cc170c
...@@ -15,28 +15,33 @@ ...@@ -15,28 +15,33 @@
#include "descriptor/tensor.hpp" #include "descriptor/tensor.hpp"
#include "node.hpp" #include "node.hpp"
using namespace ngraph; namespace ngraph
using namespace descriptor;
Tensor::Tensor(const element::Type& element_type, PrimaryTensorView* primary_tensor_view,
const Node* parent, size_t value_index)
: m_element_type(element_type)
, m_primary_tensor_view(primary_tensor_view)
, m_is_output{false}
, m_is_input{parent->is_parameter()}
, m_is_persistent{false}
, m_name{parent->get_node_id()+"_"+std::to_string(value_index)}
, m_next_view_id{0}
{ {
} namespace descriptor
{
Tensor::Tensor(const element::Type& element_type,
PrimaryTensorView* primary_tensor_view,
const Node* parent,
size_t value_index)
: m_element_type(element_type)
, m_primary_tensor_view(primary_tensor_view)
, m_is_output{false}
, m_is_input{parent->is_parameter()}
, m_is_persistent{false}
, m_name{parent->get_node_id() + "_" + std::to_string(value_index)}
, m_next_view_id{0}
{
}
std::string Tensor::get_next_view_name() std::string Tensor::get_next_view_name()
{ {
return m_name + "_TV" + std::to_string(m_next_view_id++); return m_name + "_TV" + std::to_string(m_next_view_id++);
} }
std::ostream& ngraph::descriptor::operator<<(std::ostream& out, const Tensor& tensor) std::ostream& operator<<(std::ostream& out, const Tensor& tensor)
{ {
out << "Tensor(" << tensor.get_name() << ")"; out << "Tensor(" << tensor.get_name() << ")";
return out; return out;
}
}
} }
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#pragma once #pragma once
#include <iostream>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <iostream>
namespace ngraph namespace ngraph
{ {
...@@ -40,19 +40,18 @@ namespace ngraph ...@@ -40,19 +40,18 @@ namespace ngraph
Tensor(const Tensor&) = delete; Tensor(const Tensor&) = delete;
Tensor& operator=(const Tensor&) = delete; Tensor& operator=(const Tensor&) = delete;
Tensor(const element::Type& element_type, PrimaryTensorView* tensor_view, Tensor(const element::Type& element_type,
const Node* parent, size_t value_index); PrimaryTensorView* tensor_view,
const Node* parent,
size_t value_index);
std::string get_next_view_name(); std::string get_next_view_name();
public: public:
bool is_output() const { return m_is_output; } bool is_output() const { return m_is_output; }
bool is_input() const { return m_is_input; } bool is_input() const { return m_is_input; }
bool is_persistent() const { return m_is_persistent; } bool is_persistent() const { return m_is_persistent; }
const std::string& get_name() const { return m_name; } const std::string& get_name() const { return m_name; }
friend std::ostream& operator<<(std::ostream&, const Tensor&);
protected: protected:
const element::Type& m_element_type; const element::Type& m_element_type;
PrimaryTensorView* m_primary_tensor_view; PrimaryTensorView* m_primary_tensor_view;
...@@ -62,5 +61,7 @@ namespace ngraph ...@@ -62,5 +61,7 @@ namespace ngraph
std::string m_name; std::string m_name;
size_t m_next_view_id; size_t m_next_view_id;
}; };
std::ostream& operator<<(std::ostream&, const Tensor&);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment