Commit 43bcb2b8 authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

some fixes (#1525)

parent 394b74fa
...@@ -91,6 +91,7 @@ namespace ngraph ...@@ -91,6 +91,7 @@ namespace ngraph
private: private:
Function(const Function&) = delete; Function(const Function&) = delete;
Function(const Function&&) = delete; Function(const Function&&) = delete;
Function& operator=(const Function&) = delete;
static std::atomic<size_t> m_next_instance_id; static std::atomic<size_t> m_next_instance_id;
size_t m_instance_id; size_t m_instance_id;
......
...@@ -99,7 +99,7 @@ namespace ngraph ...@@ -99,7 +99,7 @@ namespace ngraph
{ {
size_t size = shape_size(m_shape) * m_element_type.size(); size_t size = shape_size(m_shape) * m_element_type.size();
m_data = ngraph::aligned_alloc(m_element_type.size(), size); m_data = ngraph::aligned_alloc(m_element_type.size(), size);
memcpy(m_data, data, size); std::memcpy(m_data, data, size);
auto vt = std::make_shared<TensorViewType>(type, shape); auto vt = std::make_shared<TensorViewType>(type, shape);
set_value_type_checked(vt); set_value_type_checked(vt);
} }
...@@ -242,6 +242,11 @@ namespace ngraph ...@@ -242,6 +242,11 @@ namespace ngraph
element::Type m_element_type; element::Type m_element_type;
Shape m_shape; Shape m_shape;
void* m_data; void* m_data;
private:
Constant(const Constant&) = delete;
Constant(Constant&&) = delete;
Constant operator=(const Constant*) = delete;
}; };
} }
} }
...@@ -44,6 +44,8 @@ namespace ngraph ...@@ -44,6 +44,8 @@ namespace ngraph
{ {
} }
ParameterVector& operator=(const ParameterVector& parameters) = default;
ParameterVector() {} ParameterVector() {}
}; };
} }
......
...@@ -50,8 +50,11 @@ shared_ptr<Node> op::Result::copy_with_new_args(const NodeVector& new_args) cons ...@@ -50,8 +50,11 @@ shared_ptr<Node> op::Result::copy_with_new_args(const NodeVector& new_args) cons
} }
auto res = make_shared<Result>(new_args.at(0)); auto res = make_shared<Result>(new_args.at(0));
if (res)
{
res->set_needs_copy(m_needs_copy); res->set_needs_copy(m_needs_copy);
res->set_needs_default_layout(m_needs_default_layout); res->set_needs_default_layout(m_needs_default_layout);
}
return res; return res;
} }
......
...@@ -24,6 +24,7 @@ using namespace ngraph; ...@@ -24,6 +24,7 @@ using namespace ngraph;
runtime::AlignedBuffer::AlignedBuffer() runtime::AlignedBuffer::AlignedBuffer()
: m_allocated_buffer(nullptr) : m_allocated_buffer(nullptr)
, m_aligned_buffer(nullptr) , m_aligned_buffer(nullptr)
, m_byte_size(0)
{ {
} }
......
...@@ -41,6 +41,10 @@ public: ...@@ -41,6 +41,10 @@ public:
void* get_ptr(size_t offset) const { return m_aligned_buffer + offset; } void* get_ptr(size_t offset) const { return m_aligned_buffer + offset; }
void* get_ptr() const { return m_aligned_buffer; } void* get_ptr() const { return m_aligned_buffer; }
private: private:
AlignedBuffer(const AlignedBuffer&) = delete;
AlignedBuffer(AlignedBuffer&&) = delete;
AlignedBuffer& operator=(const AlignedBuffer&) = delete;
char* m_allocated_buffer; char* m_allocated_buffer;
char* m_aligned_buffer; char* m_aligned_buffer;
size_t m_byte_size; size_t m_byte_size;
......
...@@ -63,6 +63,10 @@ namespace ngraph ...@@ -63,6 +63,10 @@ namespace ngraph
static constexpr int BufferAlignment = NGRAPH_CPU_ALIGNMENT; static constexpr int BufferAlignment = NGRAPH_CPU_ALIGNMENT;
private: private:
CPUTensorView(const CPUTensorView&) = delete;
CPUTensorView(CPUTensorView&&) = delete;
CPUTensorView& operator=(const CPUTensorView&) = delete;
char* buffer; char* buffer;
char* aligned_buffer; char* aligned_buffer;
size_t buffer_size; size_t buffer_size;
......
...@@ -50,6 +50,10 @@ namespace ngraph ...@@ -50,6 +50,10 @@ namespace ngraph
MKLDNNWorkspace(size_t size) { buf = reinterpret_cast<char*>(malloc(size)); } MKLDNNWorkspace(size_t size) { buf = reinterpret_cast<char*>(malloc(size)); }
~MKLDNNWorkspace() { free(buf); } ~MKLDNNWorkspace() { free(buf); }
char* buf; char* buf;
MKLDNNWorkspace(const MKLDNNWorkspace&) = delete;
MKLDNNWorkspace(MKLDNNWorkspace&&) = delete;
MKLDNNWorkspace& operator=(const MKLDNNWorkspace&) = delete;
}; };
class MKLDNNEmitter class MKLDNNEmitter
......
...@@ -74,6 +74,10 @@ public: ...@@ -74,6 +74,10 @@ public:
void read(void* p, size_t tensor_offset, size_t n) const override; void read(void* p, size_t tensor_offset, size_t n) const override;
private: private:
HostTensorView(const HostTensorView&) = delete;
HostTensorView(HostTensorView&&) = delete;
HostTensorView& operator=(const HostTensorView&) = delete;
char* m_allocated_buffer_pool; char* m_allocated_buffer_pool;
char* m_aligned_buffer_pool; char* m_aligned_buffer_pool;
size_t m_buffer_size; size_t m_buffer_size;
......
...@@ -81,12 +81,12 @@ bool element::Type::operator==(const element::Type& other) const ...@@ -81,12 +81,12 @@ bool element::Type::operator==(const element::Type& other) const
bool element::Type::operator<(const Type& other) const bool element::Type::operator<(const Type& other) const
{ {
size_t v1 = m_bitwidth << 2; size_t v1 = m_bitwidth << 2;
v1 |= (m_is_real ? 2 : 0); v1 |= static_cast<size_t>(m_is_real ? 2 : 0);
v1 |= (m_is_signed ? 1 : 0); v1 |= static_cast<size_t>(m_is_signed ? 1 : 0);
size_t v2 = other.m_bitwidth << 2; size_t v2 = other.m_bitwidth << 2;
v2 |= (other.m_is_real ? 2 : 0); v2 |= static_cast<size_t>(other.m_is_real ? 2 : 0);
v2 |= (other.m_is_signed ? 1 : 0); v2 |= static_cast<size_t>(other.m_is_signed ? 1 : 0);
return v1 < v2; return v1 < v2;
} }
......
...@@ -49,9 +49,10 @@ namespace ngraph ...@@ -49,9 +49,10 @@ namespace ngraph
std::string join(const T& v, const std::string& sep = ", ") std::string join(const T& v, const std::string& sep = ", ")
{ {
std::ostringstream ss; std::ostringstream ss;
size_t count = 0;
for (const auto& x : v) for (const auto& x : v)
{ {
if (&x != &*(v.begin())) if (count++ > 0)
{ {
ss << sep; ss << sep;
} }
......
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