diff --git a/mace/kernels/opencl/buffer_to_image.cc b/mace/kernels/opencl/buffer_to_image.cc index 126fda7773f3613161d186a445f94b467ddf120c..6d8f3ef1b5e7f0833b31af78a62af21bc188aa7b 100644 --- a/mace/kernels/opencl/buffer_to_image.cc +++ b/mace/kernels/opencl/buffer_to_image.cc @@ -22,8 +22,7 @@ void BufferToImageFunctor::operator()( image->ResizeImage(buffer->shape(), image_shape); } } else { - Image *image_buf = dynamic_cast(image->UnderlyingBuffer()); - image_shape = image_buf->image_shape(); + CalImage2DShape(image->shape(), type, &image_shape); buffer->Resize(image->shape()); }