forked from projectceladon/nn_gpu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpu_executor.h
executable file
·40 lines (32 loc) · 1.02 KB
/
gpu_executor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef ANDROID_HARDWARE_NEURALNETWORKS_V1_0_GPU_EXECUTOR_H
#define ANDROID_HARDWARE_NEURALNETWORKS_V1_0_GPU_EXECUTOR_H
#include "base_executor.h"
NAME_SPACE_BEGIN
enum PaddingScheme
{
kPaddingUnknown = 0,
kPaddingSame = 1,
kPaddingValid = 2,
};
inline void calculateExplicitPadding(int32_t in_size, int32_t stride,
int32_t filter_size, int32_t padding_implicit,
int32_t* padding_head, int32_t* padding_tail) {
*padding_head = 0;
*padding_tail = 0;
if (padding_implicit == kPaddingSame) {
int32_t out_size = (in_size + stride - 1) / stride;
int32_t tmp = (out_size - 1) * stride + filter_size;
if (tmp > in_size) {
*padding_head = (tmp - in_size) / 2;
*padding_tail = (tmp - in_size) - *padding_head;
}
}
}
class GpuExecutor : public BaseExecutor
{
public:
GpuExecutor(const Model& model) : BaseExecutor(model) {}
~GpuExecutor() override {}
};
NAME_SPACE_STOP
#endif