1 // Copyright (c) 2019 Intel Corporation
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
16 #include "include/include_all.cl"
18 KERNEL(depth_to_space_ref)(const __global UNIT_TYPE* input, __global UNIT_TYPE* output)
20 const uint batch = get_global_id(0);
21 const uint feature = get_global_id(1);
22 const uint y = get_global_id(2) / OUTPUT_SIZE_X;
23 const uint x = get_global_id(2) % OUTPUT_SIZE_X;
25 const uint input_y = y / BLOCK_SIZE;
26 const uint offset_y = y % BLOCK_SIZE;
28 const uint input_x = x / BLOCK_SIZE;
29 const uint offset_x = (x % BLOCK_SIZE);
30 const uint offset_feature = (offset_y * BLOCK_SIZE + offset_x) * OUTPUT_FEATURE_NUM;
32 const uint output_index = OUTPUT_OFFSET + (batch * OUTPUT_BATCH_PITCH) + (feature * OUTPUT_FEATURE_PITCH) + (y * OUTPUT_Y_PITCH) + x;
33 const uint input_feature = feature + offset_feature;
34 const uint input_index = INPUT0_OFFSET + (batch * INPUT0_BATCH_PITCH) + (input_feature * INPUT0_FEATURE_PITCH) + (input_y * INPUT0_Y_PITCH) + input_x;
35 output[output_index] = input[input_index];