• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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 <gtest/gtest.h>
7 
8 #include "binary-elementwise-operator-tester.h"
9 
10 constexpr size_t kDim1 = 2;
11 constexpr size_t kDim2 = 3;
12 constexpr size_t kDim3 = 4;
13 constexpr size_t kDim4 = 5;
14 constexpr size_t kDim5 = 6;
15 constexpr size_t kDim6 = 7;
16 
17 
18 TEST(DIVIDE_ND_F32, 0d_x_0d) {
19   BinaryElementwiseOperatorTester()
20     .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
21     .TestF32();
22 }
23 
24 TEST(DIVIDE_ND_F32, 1d_x_0d) {
25   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
26     const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
27     const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
28     BinaryElementwiseOperatorTester()
29       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
30       .input1_shape({input1_dim1})
31       .TestF32();
32   }
33 }
34 
35 TEST(DIVIDE_ND_F32, 0d_x_1d) {
36   for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
37     const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
38     const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
39     BinaryElementwiseOperatorTester()
40       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
41       .input2_shape({input2_dim1})
42       .TestF32();
43   }
44 }
45 
46 TEST(DIVIDE_ND_F32, 1d_x_1d) {
47   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
48     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
49       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
50       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
51       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
52       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
53       BinaryElementwiseOperatorTester()
54         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
55         .input1_shape({input1_dim1})
56         .input2_shape({input2_dim1})
57         .TestF32();
58     }
59   }
60 }
61 
62 TEST(DIVIDE_ND_F32, 0d_x_2d) {
63   for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
64     const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
65     const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
66     const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
67     const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
68     BinaryElementwiseOperatorTester()
69       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
70       .input2_shape({input2_dim2, input2_dim1})
71       .TestF32();
72   }
73 }
74 
75 TEST(DIVIDE_ND_F32, 1d_x_2d) {
76   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
77     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
78       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
79       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
80       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
81       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
82       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
83       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
84       BinaryElementwiseOperatorTester()
85         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
86         .input1_shape({input1_dim1})
87         .input2_shape({input2_dim2, input2_dim1})
88         .TestF32();
89     }
90   }
91 }
92 
93 TEST(DIVIDE_ND_F32, 2d_x_0d) {
94   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
95     const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
96     const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
97     const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
98     const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
99     BinaryElementwiseOperatorTester()
100       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
101       .input1_shape({input1_dim2, input1_dim1})
102       .TestF32();
103   }
104 }
105 
106 TEST(DIVIDE_ND_F32, 2d_x_1d) {
107   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
108     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
109       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
110       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
111       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
112       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
113       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
114       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
115       BinaryElementwiseOperatorTester()
116         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
117         .input1_shape({input1_dim2, input1_dim1})
118         .input2_shape({input2_dim1})
119         .TestF32();
120     }
121   }
122 }
123 
124 TEST(DIVIDE_ND_F32, 2d_x_2d) {
125   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
126     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
127       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
128       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
129       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
130       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
131       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
132       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
133       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
134       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
135       BinaryElementwiseOperatorTester()
136         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
137         .input1_shape({input1_dim2, input1_dim1})
138         .input2_shape({input2_dim2, input2_dim1})
139         .TestF32();
140     }
141   }
142 }
143 
144 TEST(DIVIDE_ND_F32, 0d_x_3d) {
145   for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
146     const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
147     const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
148     const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
149     const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
150     const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
151     const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
152     BinaryElementwiseOperatorTester()
153       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
154       .input2_shape({input2_dim3, input2_dim2, input2_dim1})
155       .TestF32();
156   }
157 }
158 
159 TEST(DIVIDE_ND_F32, 1d_x_3d) {
160   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
161     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
162       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
163       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
164       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
165       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
166       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
167       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
168       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
169       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
170       BinaryElementwiseOperatorTester()
171         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
172         .input1_shape({input1_dim1})
173         .input2_shape({input2_dim3, input2_dim2, input2_dim1})
174         .TestF32();
175     }
176   }
177 }
178 
179 TEST(DIVIDE_ND_F32, 2d_x_3d) {
180   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
181     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
182       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
183       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
184       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
185       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
186       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
187       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
188       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
189       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
190       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
191       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
192       BinaryElementwiseOperatorTester()
193         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
194         .input1_shape({input1_dim2, input1_dim1})
195         .input2_shape({input2_dim3, input2_dim2, input2_dim1})
196         .TestF32();
197     }
198   }
199 }
200 
201 TEST(DIVIDE_ND_F32, 3d_x_0d) {
202   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
203     const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
204     const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
205     const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
206     const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
207     const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
208     const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
209     BinaryElementwiseOperatorTester()
210       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
211       .input1_shape({input1_dim3, input1_dim2, input1_dim1})
212       .TestF32();
213   }
214 }
215 
216 TEST(DIVIDE_ND_F32, 3d_x_1d) {
217   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
218     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
219       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
220       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
221       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
222       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
223       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
224       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
225       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
226       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
227       BinaryElementwiseOperatorTester()
228         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
229         .input1_shape({input1_dim3, input1_dim2, input1_dim1})
230         .input2_shape({input2_dim1})
231         .TestF32();
232     }
233   }
234 }
235 
236 TEST(DIVIDE_ND_F32, 3d_x_2d) {
237   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
238     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
239       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
240       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
241       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
242       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
243       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
244       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
245       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
246       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
247       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
248       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
249       BinaryElementwiseOperatorTester()
250         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
251         .input1_shape({input1_dim3, input1_dim2, input1_dim1})
252         .input2_shape({input2_dim2, input2_dim1})
253         .TestF32();
254     }
255   }
256 }
257 
258 TEST(DIVIDE_ND_F32, 3d_x_3d) {
259   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
260     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
261       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
262       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
263       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
264       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
265       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
266       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
267       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
268       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
269       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
270       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
271       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
272       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
273       BinaryElementwiseOperatorTester()
274         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
275         .input1_shape({input1_dim3, input1_dim2, input1_dim1})
276         .input2_shape({input2_dim3, input2_dim2, input2_dim1})
277         .TestF32();
278     }
279   }
280 }
281 
282 TEST(DIVIDE_ND_F32, 0d_x_4d) {
283   for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
284     const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
285     const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
286     const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
287     const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
288     const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
289     const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
290     const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
291     const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
292     BinaryElementwiseOperatorTester()
293       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
294       .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
295       .TestF32();
296   }
297 }
298 
299 TEST(DIVIDE_ND_F32, 1d_x_4d) {
300   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
301     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
302       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
303       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
304       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
305       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
306       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
307       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
308       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
309       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
310       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
311       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
312       BinaryElementwiseOperatorTester()
313         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
314         .input1_shape({input1_dim1})
315         .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
316         .TestF32();
317     }
318   }
319 }
320 
321 TEST(DIVIDE_ND_F32, 2d_x_4d) {
322   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
323     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
324       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
325       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
326       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
327       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
328       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
329       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
330       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
331       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
332       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
333       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
334       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
335       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
336       BinaryElementwiseOperatorTester()
337         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
338         .input1_shape({input1_dim2, input1_dim1})
339         .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
340         .TestF32();
341     }
342   }
343 }
344 
345 TEST(DIVIDE_ND_F32, 3d_x_4d) {
346   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
347     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
348       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
349       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
350       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
351       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
352       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
353       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
354       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
355       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
356       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
357       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
358       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
359       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
360       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
361       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
362       BinaryElementwiseOperatorTester()
363         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
364         .input1_shape({input1_dim3, input1_dim2, input1_dim1})
365         .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
366         .TestF32();
367     }
368   }
369 }
370 
371 TEST(DIVIDE_ND_F32, 4d_x_0d) {
372   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
373     const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
374     const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
375     const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
376     const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
377     const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
378     const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
379     const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
380     const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
381     BinaryElementwiseOperatorTester()
382       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
383       .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
384       .TestF32();
385   }
386 }
387 
388 TEST(DIVIDE_ND_F32, 4d_x_1d) {
389   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
390     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
391       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
392       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
393       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
394       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
395       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
396       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
397       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
398       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
399       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
400       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
401       BinaryElementwiseOperatorTester()
402         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
403         .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
404         .input2_shape({input2_dim1})
405         .TestF32();
406     }
407   }
408 }
409 
410 TEST(DIVIDE_ND_F32, 4d_x_2d) {
411   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
412     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
413       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
414       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
415       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
416       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
417       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
418       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
419       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
420       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
421       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
422       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
423       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
424       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
425       BinaryElementwiseOperatorTester()
426         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
427         .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
428         .input2_shape({input2_dim2, input2_dim1})
429         .TestF32();
430     }
431   }
432 }
433 
434 TEST(DIVIDE_ND_F32, 4d_x_3d) {
435   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
436     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
437       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
438       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
439       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
440       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
441       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
442       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
443       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
444       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
445       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
446       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
447       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
448       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
449       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
450       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
451       BinaryElementwiseOperatorTester()
452         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
453         .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
454         .input2_shape({input2_dim3, input2_dim2, input2_dim1})
455         .TestF32();
456     }
457   }
458 }
459 
460 TEST(DIVIDE_ND_F32, 4d_x_4d) {
461   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
462     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
463       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
464       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
465       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
466       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
467       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
468       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
469       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
470       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
471       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
472       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
473       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
474       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
475       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
476       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
477       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
478       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
479       BinaryElementwiseOperatorTester()
480         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
481         .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
482         .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
483         .TestF32();
484     }
485   }
486 }
487 
488 TEST(DIVIDE_ND_F32, 0d_x_5d) {
489   for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
490     const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
491     const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
492     const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
493     const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
494     const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
495     const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
496     const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
497     const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
498     const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
499     const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
500     BinaryElementwiseOperatorTester()
501       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
502       .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
503       .TestF32();
504   }
505 }
506 
507 TEST(DIVIDE_ND_F32, 1d_x_5d) {
508   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
509     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
510       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
511       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
512       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
513       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
514       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
515       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
516       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
517       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
518       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
519       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
520       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
521       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
522       BinaryElementwiseOperatorTester()
523         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
524         .input1_shape({input1_dim1})
525         .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
526         .TestF32();
527     }
528   }
529 }
530 
531 TEST(DIVIDE_ND_F32, 2d_x_5d) {
532   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
533     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
534       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
535       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
536       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
537       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
538       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
539       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
540       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
541       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
542       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
543       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
544       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
545       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
546       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
547       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
548       BinaryElementwiseOperatorTester()
549         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
550         .input1_shape({input1_dim2, input1_dim1})
551         .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
552         .TestF32();
553     }
554   }
555 }
556 
557 TEST(DIVIDE_ND_F32, 3d_x_5d) {
558   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
559     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
560       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
561       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
562       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
563       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
564       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
565       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
566       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
567       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
568       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
569       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
570       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
571       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
572       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
573       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
574       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
575       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
576       BinaryElementwiseOperatorTester()
577         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
578         .input1_shape({input1_dim3, input1_dim2, input1_dim1})
579         .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
580         .TestF32();
581     }
582   }
583 }
584 
585 TEST(DIVIDE_ND_F32, 4d_x_5d) {
586   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
587     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
588       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
589       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
590       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
591       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
592       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
593       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
594       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
595       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
596       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
597       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
598       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
599       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
600       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
601       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
602       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
603       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
604       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
605       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
606       BinaryElementwiseOperatorTester()
607         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
608         .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
609         .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
610         .TestF32();
611     }
612   }
613 }
614 
615 TEST(DIVIDE_ND_F32, 5d_x_0d) {
616   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
617     const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
618     const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
619     const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
620     const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
621     const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
622     const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
623     const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
624     const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
625     const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
626     const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
627     BinaryElementwiseOperatorTester()
628       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
629       .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
630       .TestF32();
631   }
632 }
633 
634 TEST(DIVIDE_ND_F32, 5d_x_1d) {
635   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
636     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
637       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
638       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
639       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
640       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
641       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
642       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
643       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
644       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
645       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
646       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
647       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
648       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
649       BinaryElementwiseOperatorTester()
650         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
651         .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
652         .input2_shape({input2_dim1})
653         .TestF32();
654     }
655   }
656 }
657 
658 TEST(DIVIDE_ND_F32, 5d_x_2d) {
659   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
660     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
661       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
662       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
663       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
664       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
665       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
666       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
667       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
668       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
669       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
670       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
671       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
672       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
673       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
674       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
675       BinaryElementwiseOperatorTester()
676         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
677         .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
678         .input2_shape({input2_dim2, input2_dim1})
679         .TestF32();
680     }
681   }
682 }
683 
684 TEST(DIVIDE_ND_F32, 5d_x_3d) {
685   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
686     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
687       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
688       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
689       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
690       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
691       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
692       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
693       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
694       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
695       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
696       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
697       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
698       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
699       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
700       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
701       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
702       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
703       BinaryElementwiseOperatorTester()
704         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
705         .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
706         .input2_shape({input2_dim3, input2_dim2, input2_dim1})
707         .TestF32();
708     }
709   }
710 }
711 
712 TEST(DIVIDE_ND_F32, 5d_x_4d) {
713   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
714     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
715       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
716       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
717       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
718       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
719       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
720       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
721       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
722       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
723       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
724       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
725       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
726       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
727       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
728       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
729       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
730       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
731       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
732       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
733       BinaryElementwiseOperatorTester()
734         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
735         .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
736         .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
737         .TestF32();
738     }
739   }
740 }
741 
742 TEST(DIVIDE_ND_F32, 5d_x_5d) {
743   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
744     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
745       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
746       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
747       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
748       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
749       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
750       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
751       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
752       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
753       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
754       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
755       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
756       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
757       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
758       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
759       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
760       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
761       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
762       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
763       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
764       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
765       BinaryElementwiseOperatorTester()
766         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
767         .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
768         .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
769         .iterations(1)
770         .TestF32();
771     }
772   }
773 }
774 
775 TEST(DIVIDE_ND_F32, 0d_x_6d) {
776   for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
777     const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
778     const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
779     const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
780     const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
781     const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
782     const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
783     const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
784     const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
785     const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
786     const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
787     const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
788     const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
789     BinaryElementwiseOperatorTester()
790       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
791       .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
792       .TestF32();
793   }
794 }
795 
796 TEST(DIVIDE_ND_F32, 1d_x_6d) {
797   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 1); bm1++) {
798     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
799       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
800       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
801       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
802       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
803       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
804       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
805       const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
806       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
807       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
808       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
809       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
810       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
811       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
812       const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
813       BinaryElementwiseOperatorTester()
814         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
815         .input1_shape({input1_dim1})
816         .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
817         .TestF32();
818     }
819   }
820 }
821 
822 TEST(DIVIDE_ND_F32, 2d_x_6d) {
823   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 2); bm1++) {
824     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
825       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
826       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
827       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
828       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
829       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
830       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
831       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
832       const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
833       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
834       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
835       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
836       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
837       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
838       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
839       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
840       const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
841       BinaryElementwiseOperatorTester()
842         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
843         .input1_shape({input1_dim2, input1_dim1})
844         .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
845         .TestF32();
846     }
847   }
848 }
849 
850 TEST(DIVIDE_ND_F32, 3d_x_6d) {
851   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 3); bm1++) {
852     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
853       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
854       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
855       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
856       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
857       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
858       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
859       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
860       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
861       const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
862       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
863       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
864       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
865       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
866       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
867       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
868       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
869       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
870       const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
871       BinaryElementwiseOperatorTester()
872         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
873         .input1_shape({input1_dim3, input1_dim2, input1_dim1})
874         .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
875         .TestF32();
876     }
877   }
878 }
879 
880 TEST(DIVIDE_ND_F32, 4d_x_6d) {
881   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 4); bm1++) {
882     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
883       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
884       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
885       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
886       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
887       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
888       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
889       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
890       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
891       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
892       const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
893       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
894       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
895       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
896       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
897       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
898       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
899       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
900       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
901       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
902       const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
903       BinaryElementwiseOperatorTester()
904         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
905         .input1_shape({input1_dim4, input1_dim3, input1_dim2, input1_dim1})
906         .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
907         .TestF32();
908     }
909   }
910 }
911 
912 TEST(DIVIDE_ND_F32, 5d_x_6d) {
913   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 5); bm1++) {
914     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
915       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
916       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
917       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
918       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
919       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
920       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
921       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
922       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
923       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
924       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
925       const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
926       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
927       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
928       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
929       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
930       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
931       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
932       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
933       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
934       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
935       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
936       const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
937       BinaryElementwiseOperatorTester()
938         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
939         .input1_shape({input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
940         .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
941         .iterations(1)
942         .TestF32();
943     }
944   }
945 }
946 
947 TEST(DIVIDE_ND_F32, 6d_x_0d) {
948   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
949     const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
950     const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
951     const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
952     const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
953     const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
954     const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
955     const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
956     const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
957     const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
958     const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
959     const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
960     const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
961     BinaryElementwiseOperatorTester()
962       .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
963       .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
964       .TestF32();
965   }
966 }
967 
968 TEST(DIVIDE_ND_F32, 6d_x_1d) {
969   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
970     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 1); bm2++) {
971       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
972       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
973       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
974       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
975       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
976       const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
977       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
978       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
979       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
980       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
981       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
982       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
983       const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
984       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
985       BinaryElementwiseOperatorTester()
986         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
987         .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
988         .input2_shape({input2_dim1})
989         .TestF32();
990     }
991   }
992 }
993 
994 TEST(DIVIDE_ND_F32, 6d_x_2d) {
995   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
996     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 2); bm2++) {
997       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
998       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
999       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
1000       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
1001       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
1002       const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
1003       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
1004       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
1005       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
1006       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
1007       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
1008       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
1009       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
1010       const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
1011       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
1012       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
1013       BinaryElementwiseOperatorTester()
1014         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
1015         .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
1016         .input2_shape({input2_dim2, input2_dim1})
1017         .TestF32();
1018     }
1019   }
1020 }
1021 
1022 TEST(DIVIDE_ND_F32, 6d_x_3d) {
1023   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
1024     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 3); bm2++) {
1025       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
1026       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
1027       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
1028       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
1029       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
1030       const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
1031       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
1032       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
1033       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
1034       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
1035       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
1036       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
1037       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
1038       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
1039       const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
1040       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
1041       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
1042       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
1043       BinaryElementwiseOperatorTester()
1044         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
1045         .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
1046         .input2_shape({input2_dim3, input2_dim2, input2_dim1})
1047         .TestF32();
1048     }
1049   }
1050 }
1051 
1052 TEST(DIVIDE_ND_F32, 6d_x_4d) {
1053   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
1054     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 4); bm2++) {
1055       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
1056       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
1057       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
1058       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
1059       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
1060       const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
1061       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
1062       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
1063       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
1064       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
1065       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
1066       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
1067       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
1068       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
1069       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
1070       const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
1071       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
1072       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
1073       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
1074       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
1075       BinaryElementwiseOperatorTester()
1076         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
1077         .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
1078         .input2_shape({input2_dim4, input2_dim3, input2_dim2, input2_dim1})
1079         .TestF32();
1080     }
1081   }
1082 }
1083 
1084 TEST(DIVIDE_ND_F32, 6d_x_5d) {
1085   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
1086     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 5); bm2++) {
1087       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
1088       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
1089       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
1090       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
1091       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
1092       const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
1093       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
1094       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
1095       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
1096       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
1097       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
1098       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
1099       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
1100       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
1101       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
1102       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
1103       const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
1104       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
1105       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
1106       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
1107       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
1108       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
1109       BinaryElementwiseOperatorTester()
1110         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
1111         .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
1112         .input2_shape({input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
1113         .iterations(1)
1114         .TestF32();
1115     }
1116   }
1117 }
1118 
1119 TEST(DIVIDE_ND_F32, 6d_x_6d) {
1120   for (uint32_t bm1 = 0; bm1 < (uint32_t(1) << 6); bm1++) {
1121     for (uint32_t bm2 = 0; bm2 < (uint32_t(1) << 6); bm2++) {
1122       const bool input1_broadcast_dim1 = bm1 & (uint32_t(1) << 0);
1123       const bool input1_broadcast_dim2 = bm1 & (uint32_t(1) << 1);
1124       const bool input1_broadcast_dim3 = bm1 & (uint32_t(1) << 2);
1125       const bool input1_broadcast_dim4 = bm1 & (uint32_t(1) << 3);
1126       const bool input1_broadcast_dim5 = bm1 & (uint32_t(1) << 4);
1127       const bool input1_broadcast_dim6 = bm1 & (uint32_t(1) << 5);
1128       const bool input2_broadcast_dim1 = bm2 & (uint32_t(1) << 0);
1129       const bool input2_broadcast_dim2 = bm2 & (uint32_t(1) << 1);
1130       const bool input2_broadcast_dim3 = bm2 & (uint32_t(1) << 2);
1131       const bool input2_broadcast_dim4 = bm2 & (uint32_t(1) << 3);
1132       const bool input2_broadcast_dim5 = bm2 & (uint32_t(1) << 4);
1133       const bool input2_broadcast_dim6 = bm2 & (uint32_t(1) << 5);
1134       const size_t input1_dim1 = input1_broadcast_dim1 ? 1 : kDim1;
1135       const size_t input1_dim2 = input1_broadcast_dim2 ? 1 : kDim2;
1136       const size_t input1_dim3 = input1_broadcast_dim3 ? 1 : kDim3;
1137       const size_t input1_dim4 = input1_broadcast_dim4 ? 1 : kDim4;
1138       const size_t input1_dim5 = input1_broadcast_dim5 ? 1 : kDim5;
1139       const size_t input1_dim6 = input1_broadcast_dim6 ? 1 : kDim6;
1140       const size_t input2_dim1 = input2_broadcast_dim1 ? 1 : kDim1;
1141       const size_t input2_dim2 = input2_broadcast_dim2 ? 1 : kDim2;
1142       const size_t input2_dim3 = input2_broadcast_dim3 ? 1 : kDim3;
1143       const size_t input2_dim4 = input2_broadcast_dim4 ? 1 : kDim4;
1144       const size_t input2_dim5 = input2_broadcast_dim5 ? 1 : kDim5;
1145       const size_t input2_dim6 = input2_broadcast_dim6 ? 1 : kDim6;
1146       BinaryElementwiseOperatorTester()
1147         .operation_type(BinaryElementwiseOperatorTester::OperationType::Divide)
1148         .input1_shape({input1_dim6, input1_dim5, input1_dim4, input1_dim3, input1_dim2, input1_dim1})
1149         .input2_shape({input2_dim6, input2_dim5, input2_dim4, input2_dim3, input2_dim2, input2_dim1})
1150         .iterations(1)
1151         .TestF32();
1152     }
1153   }
1154 }
1155