Unverified Commit d36a88ed authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Fix u1 allocation size (#4443)

parent d0d63c30
...@@ -52,8 +52,8 @@ op::Constant::Constant(const element::Type& type, ...@@ -52,8 +52,8 @@ op::Constant::Constant(const element::Type& type,
const std::vector<std::string>& values) const std::vector<std::string>& values)
: m_element_type(type) : m_element_type(type)
, m_shape(shape) , m_shape(shape)
, m_data( , m_data(new runtime::AlignedBuffer(ceil(shape_size(m_shape) * m_element_type.bitwidth() / 8.f),
new runtime::AlignedBuffer(shape_size(m_shape) * m_element_type.size(), host_alignment())) host_alignment()))
{ {
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
values.size() == shape_size(m_shape) || values.size() == 1, values.size() == shape_size(m_shape) || values.size() == 1,
...@@ -290,10 +290,10 @@ op::Constant::Constant(const element::Type& type, ...@@ -290,10 +290,10 @@ op::Constant::Constant(const element::Type& type,
op::Constant::Constant(const element::Type& type, const Shape& shape, const void* data) op::Constant::Constant(const element::Type& type, const Shape& shape, const void* data)
: m_element_type(type) : m_element_type(type)
, m_shape(shape) , m_shape(shape)
, m_data( , m_data(new runtime::AlignedBuffer(ceil(shape_size(m_shape) * m_element_type.bitwidth() / 8.f),
new runtime::AlignedBuffer(shape_size(m_shape) * m_element_type.size(), host_alignment())) host_alignment()))
{ {
size_t size = shape_size(m_shape) * m_element_type.size(); size_t size = ceil(shape_size(m_shape) * m_element_type.bitwidth() / 8.f);
std::memcpy(m_data->get_ptr(), data, size); std::memcpy(m_data->get_ptr(), data, size);
constructor_validate_and_infer_types(); constructor_validate_and_infer_types();
m_all_elements_bitwise_identical = are_all_data_elements_bitwise_identical(); m_all_elements_bitwise_identical = are_all_data_elements_bitwise_identical();
......
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