diff --git a/mace/core/runtime/opencl/scratch_image.cc b/mace/core/runtime/opencl/scratch_image.cc index df1881c637424a386a1b8efae349638e30f18ce1..fc1ef0888aa8ef1581a5b5eda061fa403fc51548 100644 --- a/mace/core/runtime/opencl/scratch_image.cc +++ b/mace/core/runtime/opencl/scratch_image.cc @@ -32,8 +32,8 @@ Image *ScratchImageManager::Spawn( int image_count = static_cast(reference_count_.size()); for (int i = 0; i < image_count; ++i) { int count = reference_count_[i]; - if (count == 0 && images_.at(count)->dtype() == dt) { - auto image_shape = images_.at(count)->shape(); + if (count == 0 && images_.at(i)->dtype() == dt) { + auto image_shape = images_.at(i)->shape(); if (image_shape[0] >= shape[0] && image_shape[1] >= shape[1]) { found_image_idx = i; break;