1 // Copyright (c) 2018 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"
17 KERNEL(embed_ref)(const __global UNIT_TYPE* input0,
18 __global UNIT_TYPE* output,
19 const __global UNIT_TYPE* weights
21 ,const __global UNIT_TYPE* biases
25 const uint x = (uint)get_global_id(0);
26 const uint y = (uint)get_global_id(1);
27 const uint b = (uint)get_global_id(2);
29 uint output_idx = (b*INPUT0_ELEMENTS_COUNT*NUM_OUTPUT_SIZE)+(uint)(x*NUM_OUTPUT_SIZE+y);
30 output[output_idx] = weights[(uint)(input0[(b*INPUT0_ELEMENTS_COUNT)+x]*NUM_OUTPUT_SIZE+y)];
32 output[output_idx] += biases[y];