Commit 99004bec authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

Check for partial read/write (#4033)

parent 438f7f5f
......@@ -99,9 +99,9 @@ void runtime::HostTensor::write(const void* source, size_t n)
{
runtime::event::Duration d1("write", "HostTensor");
if (n > m_buffer_size)
if (n != m_buffer_size)
{
throw out_of_range("write access past end of tensor");
throw out_of_range("partial tensor write not supported");
}
char* target = get_data_ptr();
memcpy(target, source, n);
......@@ -110,9 +110,9 @@ void runtime::HostTensor::write(const void* source, size_t n)
void runtime::HostTensor::read(void* target, size_t n) const
{
runtime::event::Duration d1("read", "HostTensor");
if (n > m_buffer_size)
if (n != m_buffer_size)
{
throw out_of_range("read access past end of tensor");
throw out_of_range("partial tensor read access not supported");
}
const char* source = get_data_ptr();
memcpy(target, source, n);
......
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