From 7866f724ec8646754d680bfa5d541ef48eca28ca Mon Sep 17 00:00:00 2001 From: liuqi Date: Wed, 1 Aug 2018 10:50:27 +0800 Subject: [PATCH] Update tensor reshape check when buffer type is image. --- mace/core/tensor.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mace/core/tensor.h b/mace/core/tensor.h index a0ce271b..aef57969 100644 --- a/mace/core/tensor.h +++ b/mace/core/tensor.h @@ -217,7 +217,11 @@ class Tensor { inline void Reshape(const std::vector &shape) { shape_ = shape; - MACE_CHECK(raw_size() <= buffer_->size()); + if (has_opencl_image()) { + MACE_CHECK(raw_size() <= 4 * buffer_->size()); + } else { + MACE_CHECK(raw_size() <= buffer_->size()); + } } inline MaceStatus Resize(const std::vector &shape) { -- GitLab