From 268a90fc159ceef4c949dd0595e216fc12ee5fd7 Mon Sep 17 00:00:00 2001 From: liutuo Date: Tue, 17 Apr 2018 10:10:56 +0800 Subject: [PATCH] fix DepthToSpace bug --- .gitignore | 2 ++ mace/kernels/opencl/depth_to_space_opencl.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 27ab66f9..060f9f20 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ mace/codegen/tuning/ mace/codegen/version/ build/ docs/_build/ + +\.project/ diff --git a/mace/kernels/opencl/depth_to_space_opencl.cc b/mace/kernels/opencl/depth_to_space_opencl.cc index bd7e723d..829d1bf3 100644 --- a/mace/kernels/opencl/depth_to_space_opencl.cc +++ b/mace/kernels/opencl/depth_to_space_opencl.cc @@ -29,6 +29,8 @@ void DepthToSpaceOpFunctor::operator()( output_height = input_height * block_size_; output_width = input_width * block_size_; output_depth = input_depth / (block_size_ * block_size_); + MACE_CHECK(output_depth % 4 == 0, "output channel not support:") + << output_depth; kernel_name = "depth_to_space"; gws[0] = static_cast(RoundUpDiv4(output_depth)); @@ -40,6 +42,8 @@ void DepthToSpaceOpFunctor::operator()( output_height = input_height / block_size_; output_width = input_width / block_size_; output_depth = input_depth * block_size_ * block_size_; + MACE_CHECK(input_depth % 4 == 0, "input channel not support:") + << input_depth; kernel_name = "space_to_depth"; gws[0] = static_cast(RoundUpDiv4(input_depth)); -- GitLab