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