forked from google/XNNPACK
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubgraph-size.c
110 lines (103 loc) · 2.26 KB
/
subgraph-size.c
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright 2020 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#include <stdlib.h>
#include "xnnpack.h"
// A dummy program that calls every Subgraph API function in XNNPACK, for size estimation.
int main(int argc, char** argv) {
int function_idx = 0;
if (argc >= 2) {
function_idx = atoi(argv[1]);
}
xnn_initialize(NULL /* allocator */);
switch (function_idx) {
case 0:
xnn_create_subgraph(0, 0, NULL);
break;
case 1:
xnn_delete_subgraph(NULL);
break;
case 2:
xnn_define_tensor_value(NULL, xnn_datatype_invalid, 0, NULL, NULL, 0, 0, NULL);
break;
case 3:
xnn_define_convolution_2d(
NULL,
0, 0, 0, 0,
0, 0,
0, 0,
0, 0,
0, 0, 0,
0.0f, 0.0f,
0, 0, 0, 0, 0);
break;
case 4:
xnn_define_depthwise_convolution_2d(
NULL,
0, 0, 0, 0,
0, 0,
0, 0,
0, 0,
0, 0,
0.0f, 0.0f,
0, 0, 0, 0, 0);
break;
case 5:
xnn_define_average_pooling_2d(
NULL,
0, 0, 0, 0,
0, 0,
0, 0,
0.0f, 0.0f,
0, 0, 0);
break;
case 6:
xnn_define_max_pooling_2d(
NULL,
0, 0, 0, 0,
0, 0,
0, 0,
0, 0,
0.0f, 0.0f,
0, 0, 0);
break;
case 7:
xnn_define_add2(NULL, 0.0f, 0.0f, 0, 0, 0, 0);
break;
case 8:
xnn_define_multiply2(NULL, 0.0f, 0.0f, 0, 0, 0, 0);
break;
case 9:
xnn_define_prelu(NULL, 0, 0, 0, 0);
break;
case 10:
xnn_define_clamp(NULL, 0.0f, 0.0f, 0, 0, 0);
break;
case 11:
xnn_define_hardswish(NULL, 0, 0, 0);
break;
case 12:
xnn_define_sigmoid(NULL, 0, 0, 0);
break;
case 13:
xnn_define_softmax(NULL, 0, 0, 0);
break;
case 14:
xnn_create_runtime_v2(NULL, NULL, 0, NULL);
break;
case 15:
xnn_setup_runtime(NULL, 0, NULL);
break;
case 16:
xnn_invoke_runtime(NULL);
break;
case 17:
xnn_delete_runtime(NULL);
break;
case 18:
xnn_define_depth_to_space(NULL, 0, 0, 0, 0);
break;
}
xnn_deinitialize();
}