1 // Copyright 2019 Google LLC
2 //
3 // This source code is licensed under the BSD-style license found in the
4 // LICENSE file in the root directory of this source tree.
5
6 #include <assert.h>
7
8 #include <xnnpack/pad.h>
9
10
xnn_x32_unpool_ukernel__scalar(size_t p,size_t c,uint32_t f,const uint32_t * input,const uint32_t * index,uint32_t ** output)11 void xnn_x32_unpool_ukernel__scalar(
12 size_t p,
13 size_t c,
14 uint32_t f,
15 const uint32_t* input,
16 const uint32_t* index,
17 uint32_t** output)
18 {
19 // Pre-initialize outputs with constant.
20 uint32_t** os = output;
21 do {
22 uint32_t* o = *os++;
23 size_t k = c;
24 do {
25 *o++ = f;
26 } while (--k != 0);
27 } while (--p != 0);
28
29 // Copy indexed elements to output.
30 size_t offset = 0;
31 do {
32 const uint32_t i = *index++;
33 *((uint32_t*) ((uintptr_t) output[i] + offset)) = *input++;
34 offset += sizeof(uint32_t);
35 } while (--c != 0);
36 }
37