From 3f8fa54bd07f2c7649fc17aa5d92d448f98502b4 Mon Sep 17 00:00:00 2001 From: liuqi Date: Wed, 8 Nov 2017 13:52:18 +0800 Subject: [PATCH] Add todo at mapping guard and format some code. --- mace/kernels/opencl/cl/space_to_batch.cl | 8 +++++--- mace/ops/batch_to_space.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mace/kernels/opencl/cl/space_to_batch.cl b/mace/kernels/opencl/cl/space_to_batch.cl index 24a07712..921a3bf8 100644 --- a/mace/kernels/opencl/cl/space_to_batch.cl +++ b/mace/kernels/opencl/cl/space_to_batch.cl @@ -1,6 +1,6 @@ -void kernel space_to_batch(global float* space_data_ptr, - global const int* block_shape_ptr, - global const int* paddings_ptr, +void kernel space_to_batch(global float *space_data_ptr, + global const int *block_shape_ptr, + global const int *paddings_ptr, private const int space_batch, private const int space_channel, private const int space_height, @@ -28,10 +28,12 @@ void kernel space_to_batch(global float* space_data_ptr, batch_pixel_height_idx * block_height; int space_pixel_width_idx = (remaining_batch_idx % block_width) + batch_pixel_width_idx * block_width; + const int batch_data_offset = batch_idx * (space_channel * batch_height * batch_width) + (batch_channel_idx * batch_height * batch_width) + batch_pixel_height_idx * batch_width + batch_pixel_width_idx; + space_pixel_height_idx -= padding_height_start; space_pixel_width_idx -= padding_width_start; const int space_data_offset = space_idx * (space_channel * space_height * space_width) + diff --git a/mace/ops/batch_to_space.h b/mace/ops/batch_to_space.h index d1080f37..14b64445 100644 --- a/mace/ops/batch_to_space.h +++ b/mace/ops/batch_to_space.h @@ -22,6 +22,7 @@ static void BatchToSpaceHelper(const Tensor *input_tensor, const index_t block_dims = block_shape_tensor->dim(0); MACE_CHECK(block_dims == cropped_tensor->dim(0) && 2 == cropped_tensor->dim(1)); + // TODO change tensor to attribute if needed based on the benchmark Tensor::MappingGuard block_shape_tensor_mapper(block_shape_tensor); Tensor::MappingGuard cropped_tensor_mapper(cropped_tensor); const int *block_shape_ptr = block_shape_tensor->data(); -- GitLab