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 <stddef.h>
8#include <stdint.h>
9
10#include <xnnpack/common.h>
11#include <xnnpack/log.h>
12#include <xnnpack/node-type.h>
13
14
15// This function is defined inline when logging is disabled
16#if XNN_LOG_LEVEL > 0
17const char* xnn_node_type_to_string(enum xnn_node_type type) {
18 switch (type) {
19 case xnn_node_type_invalid:
20 return "Invalid";
21 case xnn_node_type_abs:
22 return "Abs";
23 case xnn_node_type_add2:
24 return "Add2";
25 case xnn_node_type_argmax_pooling_2d:
26 return "ArgMax Pooling 2D";
27 case xnn_node_type_average_pooling_2d:
28 return "Average Pooling 2D";
29 case xnn_node_type_bankers_rounding:
30 return "Bankers Rounding";
31 case xnn_node_type_ceiling:
32 return "Ceiling";
33 case xnn_node_type_clamp:
34 return "Clamp";
35 case xnn_node_type_concatenate2:
36 return "Concatenate2";
37 case xnn_node_type_concatenate3:
38 return "Concatenate3";
39 case xnn_node_type_concatenate4:
40 return "Concatenate4";
41 case xnn_node_type_convert:
42 return "Convert";
43 case xnn_node_type_convolution_2d:
44 return "Convolution 2D";
45 case xnn_node_type_copy:
46 return "Copy";
47 case xnn_node_type_deconvolution_2d:
48 return "Deconvolution 2D";
49 case xnn_node_type_depth_to_space:
50 return "Depth To Space";
51 case xnn_node_type_depthwise_convolution_2d:
52 return "Depthwise Convolution 2D";
53 case xnn_node_type_divide:
54 return "Divide";
55 case xnn_node_type_elu:
56 return "ELU";
57 case xnn_node_type_even_split2:
58 return "Even Split2";
59 case xnn_node_type_even_split3:
60 return "Even Split3";
61 case xnn_node_type_even_split4:
62 return "Even Split4";
63 case xnn_node_type_floor:
64 return "Floor";
65 case xnn_node_type_fully_connected:
66 return "Fully Connected";
67 case xnn_node_type_global_average_pooling_1d:
68 return "Global Average Pooling 1D";
69 case xnn_node_type_global_average_pooling_2d:
70 return "Global Average Pooling 2D";
71 case xnn_node_type_hardswish:
72 return "HardSwish";
73 case xnn_node_type_leaky_relu:
74 return "Leaky ReLU";
75 case xnn_node_type_max_pooling_2d:
76 return "Max Pooling 2D";
77 case xnn_node_type_maximum2:
78 return "Maximum2";
79 case xnn_node_type_minimum2:
80 return "Minimum2";
81 case xnn_node_type_multiply2:
82 return "Multiply2";
83 case xnn_node_type_negate:
84 return "Negate";
85 case xnn_node_type_prelu:
86 return "PReLU";
87 case xnn_node_type_sigmoid:
88 return "Sigmoid";
89 case xnn_node_type_softmax:
90 return "Softmax";
91 case xnn_node_type_square:
92 return "Square";
93 case xnn_node_type_square_root:
94 return "Square Root";
95 case xnn_node_type_squared_difference:
96 return "Squared Difference";
97 case xnn_node_type_static_constant_pad:
98 return "Static Constant Pad";
99 case xnn_node_type_static_reshape:
100 return "Static Reshape";
101 case xnn_node_type_static_resize_bilinear_2d:
102 return "Static Resize Bilinear 2D";
103 case xnn_node_type_static_transpose:
104 return "Static Transpose";
105 case xnn_node_type_subtract:
106 return "Subtract";
107 case xnn_node_type_unpooling_2d:
108 return "Unpooling 2D";
109 }
110 XNN_UNREACHABLE;
111 return NULL;
112}
113#endif // XNN_LOG_LEVEL > 0
114