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.
15 #include "include/include_all.cl"
19 const __global INPUT0_TYPE* input,
20 __global INPUT0_TYPE* output)
22 INPUT0_TYPE out_val = REDUCE_SEED;
25 for (uint in_b = 0; in_b < INPUT0_BATCH_NUM; ++in_b) {
27 const uint in_b = (uint) get_global_id(DIM_B);
31 for (uint in_f = 0; in_f < INPUT0_FEATURE_NUM; ++in_f) {
33 const uint in_f = (uint) get_global_id(DIM_F);
37 for (uint in_y = 0; in_y < INPUT0_SIZE_Y; ++in_y) {
39 const uint in_y = (uint) get_global_id(DIM_Y);
43 for (uint in_x = 0; in_x < INPUT0_SIZE_X; ++in_x) {
45 const uint in_x = (uint) get_global_id(DIM_X);
48 out_val = REDUCE_OPERATION(out_val, input[GET_DATA_INDEX(INPUT0, in_b, in_f, in_y, in_x)]);
63 output[GET_DATA_INDEX(OUTPUT, 0, get_global_id(0), get_global_id(1), get_global_id(2))] = out_val;