• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/subgraph.h>
13 
14 
15 // This function is defined inline when logging is disabled
16 #if XNN_LOG_LEVEL > 0
xnn_operator_type_to_string(enum xnn_operator_type type)17 const char* xnn_operator_type_to_string(enum xnn_operator_type type) {
18   switch (type) {
19     case xnn_operator_type_invalid:
20       return "Invalid";
21     case xnn_operator_type_abs_nc_f32:
22       return "Abs (NC, F32)";
23     case xnn_operator_type_add_nd_f16:
24       return "Add (ND, F16)";
25     case xnn_operator_type_add_nd_f32:
26       return "Add (ND, F32)";
27     case xnn_operator_type_add_nd_qs8:
28       return "Add (ND, QS8)";
29     case xnn_operator_type_argmax_pooling_nhwc_f32:
30       return "ArgMax Pooling (NHWC, F32)";
31     case xnn_operator_type_average_pooling_nhwc_f32:
32       return "Average Pooling (NHWC, F32)";
33     case xnn_operator_type_average_pooling_nhwc_qu8:
34       return "Average Pooling (NHWC, QU8)";
35     case xnn_operator_type_bankers_rounding_nc_f32:
36       return "Bankers Rounding (NC, F32)";
37     case xnn_operator_type_ceiling_nc_f32:
38       return "Ceiling (NC, F32)";
39     case xnn_operator_type_channel_shuffle_nc_x32:
40       return "Channel Shuffle (NC, X32)";
41     case xnn_operator_type_channel_shuffle_nc_x8:
42       return "Channel Shuffle (NC, X8)";
43     case xnn_operator_type_clamp_nc_f32:
44       return "Clamp (NC, F32)";
45     case xnn_operator_type_clamp_nc_u8:
46       return "Clamp (NC, U8)";
47     case xnn_operator_type_constant_pad_nd_x32:
48       return "Constant Pad (ND, X32)";
49     case xnn_operator_type_convolution_nhwc_f16:
50       return "Convolution (NHWC, F16)";
51     case xnn_operator_type_convolution_nhwc_f32:
52       return "Convolution (NHWC, F32)";
53     case xnn_operator_type_convolution_nhwc_qs8:
54       return "Convolution (NHWC, QS8)";
55     case xnn_operator_type_convolution_nhwc_qu8:
56       return "Convolution (NHWC, QU8)";
57     case xnn_operator_type_convolution_nchw_f32:
58       return "Convolution (NCHW, F32)";
59     case xnn_operator_type_copy_nc_x32:
60       return "Copy (NC, X32)";
61     case xnn_operator_type_deconvolution_nhwc_f32:
62       return "Deconvolution (NHWC, F32)";
63     case xnn_operator_type_deconvolution_nhwc_qu8:
64       return "Deconvolution (NHWC, QU8)";
65     case xnn_operator_type_depth_to_space_nchw2nhwc_x32:
66       return "Depth To Space (NCHW2NHWC, X32)";
67     case xnn_operator_type_depth_to_space_nhwc_x32:
68       return "Depth To Space (NHWC, X32)";
69     case xnn_operator_type_divide_nd_f32:
70       return "Divide (ND, F32)";
71     case xnn_operator_type_elu_nc_f32:
72       return "ELU (NC, F32)";
73     case xnn_operator_type_floor_nc_f32:
74       return "Floor (NC, F32)";
75     case xnn_operator_type_fully_connected_nc_f32:
76       return "Fully Connected (NC, F32)";
77     case xnn_operator_type_fully_connected_nc_qu8:
78       return "Fully Connected (NC, QU8)";
79     case xnn_operator_type_global_average_pooling_nwc_f16:
80       return "Global Average Pooling (NWC, F16)";
81     case xnn_operator_type_global_average_pooling_nwc_f32:
82       return "Global Average Pooling (NWC, F32)";
83     case xnn_operator_type_global_average_pooling_nwc_qs8:
84       return "Global Average Pooling (NWC, QS8)";
85     case xnn_operator_type_global_average_pooling_nwc_qu8:
86       return "Global Average Pooling (NWC, QU8)";
87     case xnn_operator_type_global_average_pooling_ncw_f32:
88       return "Global Average Pooling (NCW, F32)";
89     case xnn_operator_type_hardswish_nc_f16:
90       return "HardSwish (NC, F16)";
91     case xnn_operator_type_hardswish_nc_f32:
92       return "HardSwish (NC, F32)";
93     case xnn_operator_type_leaky_relu_nc_f32:
94       return "Leaky ReLU (NC, F32)";
95     case xnn_operator_type_leaky_relu_nc_qu8:
96       return "Leaky ReLU (NC, QU8)";
97     case xnn_operator_type_max_pooling_nhwc_f32:
98       return "Max Pooling (NHWC, F32)";
99     case xnn_operator_type_max_pooling_nhwc_u8:
100       return "Max Pooling (NHWC, U8)";
101     case xnn_operator_type_maximum_nd_f32:
102       return "Maximum (ND, F32)";
103     case xnn_operator_type_minimum_nd_f32:
104       return "Minimum (ND, F32)";
105     case xnn_operator_type_multiply_nd_f16:
106       return "Multiply (ND, F16)";
107     case xnn_operator_type_multiply_nd_f32:
108       return "Multiply (ND, F32)";
109     case xnn_operator_type_negate_nc_f32:
110       return "Negate (NC, F32)";
111     case xnn_operator_type_prelu_nc_f32:
112       return "PReLU (NC, F32)";
113     case xnn_operator_type_resize_bilinear_nhwc_f32:
114       return "Resize Bilinear (NHWC, F32)";
115     case xnn_operator_type_resize_bilinear_nchw_f32:
116       return "Resize Bilinear (NCHW, F32)";
117     case xnn_operator_type_sigmoid_nc_f32:
118       return "Sigmoid (NC, F32)";
119     case xnn_operator_type_sigmoid_nc_qu8:
120       return "Sigmoid (NC, QU8)";
121     case xnn_operator_type_softmax_nc_f32:
122       return "Softmax (NC, F32)";
123     case xnn_operator_type_softmax_nc_qu8:
124       return "Softmax (NC, QU8)";
125     case xnn_operator_type_square_nc_f32:
126       return "Square (NC, F32)";
127     case xnn_operator_type_square_root_nc_f32:
128       return "Square Root (NC, F32)";
129     case xnn_operator_type_squared_difference_nd_f32:
130       return "Squared Difference (NC, F32)";
131     case xnn_operator_type_subtract_nd_f32:
132       return "Subtract (ND, F32)";
133     case xnn_operator_type_truncation_nc_f32:
134       return "Truncation (NC, F32)";
135     case xnn_operator_type_unpooling_nhwc_x32:
136       return "Unpooling (NHWC, X32)";
137   }
138   XNN_UNREACHABLE;
139   return NULL;
140 }
141 #endif  // XNN_LOG_LEVEL > 0
142