Skip to content

Commit 2922279

Browse files
hakanardoAnthonyBarbier
authored andcommitted
Bugfix for NumPyBinLoader with SubTensor output. (#345)
* Bugfix for NumPyBinLoader with SubTensor output. When a SubTensor is used as output from a NumPyBinLoader, data should not be written to the begining of the buffer. Change-Id: I6ed4b24710ac09b41ca92c7e21f24d44a3ed2881 * Reduce the buffer size with the same amount Change-Id: Id260f58209ce2fbee877f7d6f4afbe95c6c74036 * SubTensor's has to be accessed through execution windows
1 parent adb2f53 commit 2922279

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

utils/GraphUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "utils/GraphUtils.h"
2626
#include "utils/Utils.h"
27+
#include "arm_compute/runtime/SubTensor.h"
2728

2829
#ifdef ARM_COMPUTE_CL
2930
#include "arm_compute/core/CL/OpenCL.h"
@@ -206,7 +207,7 @@ void RandomAccessor::fill(ITensor &tensor, D &&distribution)
206207
{
207208
std::mt19937 gen(_seed);
208209

209-
if(tensor.info()->padding().empty())
210+
if(tensor.info()->padding().empty() && !dynamic_cast<SubTensor*>(&tensor))
210211
{
211212
for(size_t offset = 0; offset < tensor.info()->total_size(); offset += tensor.info()->element_size())
212213
{
@@ -349,7 +350,7 @@ bool NumPyBinLoader::access_tensor(ITensor &tensor)
349350
}
350351

351352
// Read data
352-
if(tensor.info()->padding().empty())
353+
if(tensor.info()->padding().empty() && !dynamic_cast<SubTensor*>(&tensor))
353354
{
354355
// If tensor has no padding read directly from stream.
355356
stream.read(reinterpret_cast<char *>(tensor.buffer()), tensor.info()->total_size());

0 commit comments

Comments
 (0)