Marat Dukhan | 20c3b92 | 2020-03-10 03:45:06 -0700 | [diff] [blame] | 1 | // Copyright 2020 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 <math.h> |
| 7 | #include <stdlib.h> |
| 8 | |
| 9 | #include <xnnpack.h> |
| 10 | |
| 11 | |
| 12 | // A dummy program that calls every Subgraph API function in XNNPACK, for size estimation. |
| 13 | int main(int argc, char** argv) { |
| 14 | int function_idx = 0; |
| 15 | if (argc >= 2) { |
| 16 | function_idx = atoi(argv[1]); |
| 17 | } |
| 18 | |
| 19 | xnn_initialize(NULL /* allocator */); |
| 20 | |
| 21 | switch (function_idx) { |
| 22 | case 0: |
| 23 | xnn_create_subgraph(0, 0, NULL); |
| 24 | break; |
| 25 | case 1: |
| 26 | xnn_delete_subgraph(NULL); |
| 27 | break; |
| 28 | case 2: |
| 29 | xnn_define_tensor_value(NULL, xnn_datatype_invalid, 0, NULL, NULL, 0, 0, NULL); |
| 30 | break; |
| 31 | case 3: |
| 32 | xnn_define_convolution_2d( |
| 33 | NULL, |
| 34 | 0, 0, 0, 0, |
| 35 | 0, 0, |
| 36 | 0, 0, |
| 37 | 0, 0, |
| 38 | 0, 0, 0, |
| 39 | 0.0f, 0.0f, |
| 40 | 0, 0, 0, 0, 0); |
| 41 | break; |
| 42 | case 4: |
| 43 | xnn_define_depthwise_convolution_2d( |
| 44 | NULL, |
| 45 | 0, 0, 0, 0, |
| 46 | 0, 0, |
| 47 | 0, 0, |
| 48 | 0, 0, |
| 49 | 0, 0, |
| 50 | 0.0f, 0.0f, |
| 51 | 0, 0, 0, 0, 0); |
| 52 | break; |
| 53 | case 5: |
| 54 | xnn_define_average_pooling_2d( |
| 55 | NULL, |
| 56 | 0, 0, 0, 0, |
| 57 | 0, 0, |
| 58 | 0, 0, |
| 59 | 0.0f, 0.0f, |
| 60 | 0, 0, 0); |
| 61 | break; |
| 62 | case 6: |
| 63 | xnn_define_max_pooling_2d( |
| 64 | NULL, |
| 65 | 0, 0, 0, 0, |
| 66 | 0, 0, |
| 67 | 0, 0, |
| 68 | 0, 0, |
| 69 | 0.0f, 0.0f, |
| 70 | 0, 0, 0); |
| 71 | break; |
| 72 | case 7: |
| 73 | xnn_define_add2(NULL, 0.0f, 0.0f, 0, 0, 0, 0); |
| 74 | break; |
| 75 | case 8: |
| 76 | xnn_define_multiply2(NULL, 0.0f, 0.0f, 0, 0, 0, 0); |
| 77 | break; |
| 78 | case 9: |
| 79 | xnn_define_prelu(NULL, 0, 0, 0, 0); |
| 80 | break; |
| 81 | case 10: |
| 82 | xnn_define_clamp(NULL, 0.0f, 0.0f, 0, 0, 0); |
| 83 | break; |
| 84 | case 11: |
| 85 | xnn_define_hardswish(NULL, 0, 0, 0); |
| 86 | break; |
| 87 | case 12: |
| 88 | xnn_define_sigmoid(NULL, 0, 0, 0); |
| 89 | break; |
| 90 | case 13: |
| 91 | xnn_define_softmax(NULL, 0, 0, 0); |
| 92 | break; |
| 93 | case 14: |
| 94 | xnn_create_runtime_v2(NULL, NULL, 0, NULL); |
| 95 | break; |
| 96 | case 15: |
| 97 | xnn_setup_runtime(NULL, 0, NULL); |
| 98 | break; |
| 99 | case 16: |
| 100 | xnn_invoke_runtime(NULL); |
| 101 | break; |
| 102 | case 17: |
| 103 | xnn_delete_runtime(NULL); |
| 104 | break; |
| 105 | } |
| 106 | |
| 107 | xnn_deinitialize(); |
| 108 | } |