Elffuss BraidHub

kikocis/ncnn public

master · 18.1 KiBRawPermalink
1// Tencent is pleased to support the open source community by making ncnn available.
2//
3// Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
4//
5// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6// in compliance with the License. You may obtain a copy of the License at
7//
8// https://opensource.org/licenses/BSD-3-Clause
9//
10// Unless required by applicable law or agreed to in writing, software distributed
11// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12// CONDITIONS OF ANY KIND, either express or implied. See the License for the
13// specific language governing permissions and limitations under the License.
14
15#include "testutil.h"
16
17#define OP_TYPE_MAX 11
18
19static int op_type = 0;
20
21static ncnn::Mat IntArrayMat(int a0)
22{
23 ncnn::Mat m(1);
24 int* p = m;
25 p[0] = a0;
26 return m;
27}
28
29static ncnn::Mat IntArrayMat(int a0, int a1)
30{
31 ncnn::Mat m(2);
32 int* p = m;
33 p[0] = a0;
34 p[1] = a1;
35 return m;
36}
37
38static ncnn::Mat IntArrayMat(int a0, int a1, int a2)
39{
40 ncnn::Mat m(3);
41 int* p = m;
42 p[0] = a0;
43 p[1] = a1;
44 p[2] = a2;
45 return m;
46}
47
48static ncnn::Mat IntArrayMat(int a0, int a1, int a2, int a3)
49{
50 ncnn::Mat m(4);
51 int* p = m;
52 p[0] = a0;
53 p[1] = a1;
54 p[2] = a2;
55 p[3] = a3;
56 return m;
57}
58
59static void print_int_array(const ncnn::Mat& a)
60{
61 const int* pa = a;
62
63 fprintf(stderr, "[");
64 for (int i = 0; i < a.w; i++)
65 {
66 fprintf(stderr, " %d", pa[i]);
67 }
68 fprintf(stderr, " ]");
69}
70
71static int test_reduction(const ncnn::Mat& _a, float coeff, int keepdims)
72{
73 ncnn::Mat a = _a;
74 if (op_type == 9 || op_type == 10)
75 {
76 // value must be positive for logsum and logsumexp
77 Randomize(a, 0.001f, 2.f);
78 }
79
80 ncnn::ParamDict pd;
81 pd.set(0, op_type);
82 pd.set(1, 1); // reduce_all
83 pd.set(2, coeff);
84 pd.set(4, keepdims);
85
86 std::vector<ncnn::Mat> weights(0);
87
88 int ret = test_layer("Reduction", pd, weights, a);
89 if (ret != 0)
90 {
91 fprintf(stderr, "test_reduction failed a.dims=%d a=(%d %d %d %d) op_type=%d coeff=%f keepdims=%d reduce_all=1\n", a.dims, a.w, a.h, a.d, a.c, op_type, coeff, keepdims);
92 }
93
94 return ret;
95}
96
97static int test_reduction(const ncnn::Mat& _a, float coeff, int keepdims, const ncnn::Mat& axes)
98{
99 ncnn::Mat a = _a;
100 if (op_type == 9 || op_type == 10)
101 {
102 // value must be positive for logsum and logsumexp
103 Randomize(a, 0.001f, 2.f);
104 }
105
106 ncnn::ParamDict pd;
107 pd.set(0, op_type);
108 pd.set(1, 0); // reduce_all
109 pd.set(2, coeff);
110 pd.set(3, axes);
111 pd.set(4, keepdims);
112 pd.set(5, 1); // fixbug0
113
114 std::vector<ncnn::Mat> weights(0);
115
116 int ret = test_layer("Reduction", pd, weights, a);
117 if (ret != 0)
118 {
119 fprintf(stderr, "test_reduction failed a.dims=%d a=(%d %d %d %d) op_type=%d coeff=%f keepdims=%d", a.dims, a.w, a.h, a.d, a.c, op_type, coeff, keepdims);
120 fprintf(stderr, " axes=");
121 print_int_array(axes);
122 fprintf(stderr, "\n");
123 }
124
125 return ret;
126}
127
128static int test_reduction_0()
129{
130 return 0
131 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0)
132 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0)
133 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0)
134 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0)
135 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0)
136 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0)
137
138 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1)
139 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1)
140 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1)
141 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1)
142 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1)
143 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1)
144
145 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(0))
146 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(1))
147 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(2))
148 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(3))
149 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(0, 1))
150 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(0, 2))
151 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(0, 3))
152 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(1, 2))
153 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(1, 3))
154 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(2, 3))
155 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(0, 1, 2))
156 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(0, 1, 3))
157 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(0, 2, 3))
158 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 0, IntArrayMat(1, 2, 3))
159 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 0, IntArrayMat(0, 1, 2, 3))
160 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(0))
161 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(1))
162 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(2))
163 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(3))
164 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(0, 1))
165 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(0, 2))
166 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(0, 3))
167 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(1, 2))
168 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(1, 3))
169 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(2, 3))
170 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(0, 1, 2))
171 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(0, 1, 3))
172 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(0, 2, 3))
173 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 0, IntArrayMat(1, 2, 3))
174 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 0, IntArrayMat(0, 1, 2, 3))
175 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(0))
176 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(1))
177 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(2))
178 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(3))
179 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(0, 1))
180 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(0, 2))
181 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(0, 3))
182 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(1, 2))
183 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(1, 3))
184 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(2, 3))
185 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(0, 1, 2))
186 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(0, 1, 3))
187 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(0, 2, 3))
188 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 0, IntArrayMat(1, 2, 3))
189 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 0, IntArrayMat(0, 1, 2, 3))
190
191 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(0))
192 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(1))
193 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(2))
194 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(3))
195 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(0, 1))
196 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(0, 2))
197 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(0, 3))
198 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(1, 2))
199 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(1, 3))
200 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(2, 3))
201 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(0, 1, 2))
202 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(0, 1, 3))
203 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(0, 2, 3))
204 || test_reduction(RandomMat(5, 6, 7, 24), 2.f, 1, IntArrayMat(1, 2, 3))
205 || test_reduction(RandomMat(5, 6, 7, 24), 1.f, 1, IntArrayMat(0, 1, 2, 3))
206 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(0))
207 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(1))
208 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(2))
209 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(3))
210 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(0, 1))
211 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(0, 2))
212 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(0, 3))
213 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(1, 2))
214 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(1, 3))
215 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(2, 3))
216 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(0, 1, 2))
217 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(0, 1, 3))
218 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(0, 2, 3))
219 || test_reduction(RandomMat(7, 8, 9, 12), 2.f, 1, IntArrayMat(1, 2, 3))
220 || test_reduction(RandomMat(7, 8, 9, 12), 1.f, 1, IntArrayMat(0, 1, 2, 3))
221 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(0))
222 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(1))
223 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(2))
224 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(3))
225 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(0, 1))
226 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(0, 2))
227 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(0, 3))
228 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(1, 2))
229 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(1, 3))
230 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(2, 3))
231 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(0, 1, 2))
232 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(0, 1, 3))
233 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(0, 2, 3))
234 || test_reduction(RandomMat(3, 4, 5, 13), 2.f, 1, IntArrayMat(1, 2, 3))
235 || test_reduction(RandomMat(3, 4, 5, 13), 1.f, 1, IntArrayMat(0, 1, 2, 3));
236}
237
238static int test_reduction_1()
239{
240 return 0
241 || test_reduction(RandomMat(5, 7, 24), 1.f, 0)
242 || test_reduction(RandomMat(5, 7, 24), 2.f, 0)
243 || test_reduction(RandomMat(7, 9, 12), 1.f, 0)
244 || test_reduction(RandomMat(7, 9, 12), 2.f, 0)
245 || test_reduction(RandomMat(3, 5, 13), 1.f, 0)
246 || test_reduction(RandomMat(3, 5, 13), 2.f, 0)
247
248 || test_reduction(RandomMat(5, 7, 24), 1.f, 1)
249 || test_reduction(RandomMat(5, 7, 24), 2.f, 1)
250 || test_reduction(RandomMat(7, 9, 12), 1.f, 1)
251 || test_reduction(RandomMat(7, 9, 12), 2.f, 1)
252 || test_reduction(RandomMat(3, 5, 13), 1.f, 1)
253 || test_reduction(RandomMat(3, 5, 13), 2.f, 1)
254
255 || test_reduction(RandomMat(5, 7, 24), 1.f, 0, IntArrayMat(0))
256 || test_reduction(RandomMat(5, 7, 24), 2.f, 0, IntArrayMat(1))
257 || test_reduction(RandomMat(5, 7, 24), 1.f, 0, IntArrayMat(0, 1))
258 || test_reduction(RandomMat(5, 7, 24), 2.f, 0, IntArrayMat(0, 2))
259 || test_reduction(RandomMat(5, 7, 24), 1.f, 0, IntArrayMat(1, 2))
260 || test_reduction(RandomMat(5, 7, 24), 2.f, 0, IntArrayMat(0, 1, 2))
261 || test_reduction(RandomMat(7, 9, 12), 1.f, 0, IntArrayMat(0))
262 || test_reduction(RandomMat(7, 9, 12), 2.f, 0, IntArrayMat(1))
263 || test_reduction(RandomMat(7, 9, 12), 1.f, 0, IntArrayMat(0, 1))
264 || test_reduction(RandomMat(7, 9, 12), 2.f, 0, IntArrayMat(0, 2))
265 || test_reduction(RandomMat(7, 9, 12), 1.f, 0, IntArrayMat(1, 2))
266 || test_reduction(RandomMat(7, 9, 12), 2.f, 0, IntArrayMat(0, 1, 2))
267 || test_reduction(RandomMat(3, 5, 13), 1.f, 0, IntArrayMat(0))
268 || test_reduction(RandomMat(3, 5, 13), 2.f, 0, IntArrayMat(1))
269 || test_reduction(RandomMat(3, 5, 13), 1.f, 0, IntArrayMat(0, 1))
270 || test_reduction(RandomMat(3, 5, 13), 2.f, 0, IntArrayMat(0, 2))
271 || test_reduction(RandomMat(3, 5, 13), 1.f, 0, IntArrayMat(1, 2))
272 || test_reduction(RandomMat(3, 5, 13), 2.f, 0, IntArrayMat(0, 1, 2))
273
274 || test_reduction(RandomMat(5, 7, 24), 1.f, 1, IntArrayMat(0))
275 || test_reduction(RandomMat(5, 7, 24), 2.f, 1, IntArrayMat(1))
276 || test_reduction(RandomMat(5, 7, 24), 1.f, 1, IntArrayMat(0, 1))
277 || test_reduction(RandomMat(5, 7, 24), 2.f, 1, IntArrayMat(0, 2))
278 || test_reduction(RandomMat(5, 7, 24), 1.f, 1, IntArrayMat(1, 2))
279 || test_reduction(RandomMat(5, 7, 24), 2.f, 1, IntArrayMat(0, 1, 2))
280 || test_reduction(RandomMat(7, 9, 12), 1.f, 1, IntArrayMat(0))
281 || test_reduction(RandomMat(7, 9, 12), 2.f, 1, IntArrayMat(1))
282 || test_reduction(RandomMat(7, 9, 12), 1.f, 1, IntArrayMat(0, 1))
283 || test_reduction(RandomMat(7, 9, 12), 2.f, 1, IntArrayMat(0, 2))
284 || test_reduction(RandomMat(7, 9, 12), 1.f, 1, IntArrayMat(1, 2))
285 || test_reduction(RandomMat(7, 9, 12), 2.f, 1, IntArrayMat(0, 1, 2))
286 || test_reduction(RandomMat(3, 5, 13), 1.f, 1, IntArrayMat(0))
287 || test_reduction(RandomMat(3, 5, 13), 2.f, 1, IntArrayMat(1))
288 || test_reduction(RandomMat(3, 5, 13), 1.f, 1, IntArrayMat(0, 1))
289 || test_reduction(RandomMat(3, 5, 13), 2.f, 1, IntArrayMat(0, 2))
290 || test_reduction(RandomMat(3, 5, 13), 1.f, 1, IntArrayMat(1, 2))
291 || test_reduction(RandomMat(3, 5, 13), 2.f, 1, IntArrayMat(0, 1, 2));
292}
293
294static int test_reduction_2()
295{
296 return 0
297 || test_reduction(RandomMat(15, 24), 1.f, 0)
298 || test_reduction(RandomMat(15, 24), 2.f, 0)
299 || test_reduction(RandomMat(17, 12), 1.f, 0)
300 || test_reduction(RandomMat(17, 12), 2.f, 0)
301 || test_reduction(RandomMat(19, 15), 1.f, 0)
302 || test_reduction(RandomMat(19, 15), 2.f, 0)
303
304 || test_reduction(RandomMat(15, 24), 1.f, 1)
305 || test_reduction(RandomMat(15, 24), 2.f, 1)
306 || test_reduction(RandomMat(17, 12), 1.f, 1)
307 || test_reduction(RandomMat(17, 12), 2.f, 1)
308 || test_reduction(RandomMat(19, 15), 1.f, 1)
309 || test_reduction(RandomMat(19, 15), 2.f, 1)
310
311 || test_reduction(RandomMat(15, 24), 1.f, 0, IntArrayMat(0))
312 || test_reduction(RandomMat(15, 24), 2.f, 0, IntArrayMat(1))
313 || test_reduction(RandomMat(15, 24), 1.f, 0, IntArrayMat(0, 1))
314 || test_reduction(RandomMat(17, 12), 2.f, 0, IntArrayMat(0))
315 || test_reduction(RandomMat(17, 12), 1.f, 0, IntArrayMat(1))
316 || test_reduction(RandomMat(17, 12), 2.f, 0, IntArrayMat(0, 1))
317 || test_reduction(RandomMat(19, 15), 1.f, 0, IntArrayMat(0))
318 || test_reduction(RandomMat(19, 15), 2.f, 0, IntArrayMat(1))
319 || test_reduction(RandomMat(19, 15), 1.f, 0, IntArrayMat(0, 1))
320
321 || test_reduction(RandomMat(15, 24), 2.f, 1, IntArrayMat(0))
322 || test_reduction(RandomMat(15, 24), 1.f, 1, IntArrayMat(1))
323 || test_reduction(RandomMat(15, 24), 2.f, 1, IntArrayMat(0, 1))
324 || test_reduction(RandomMat(17, 12), 1.f, 1, IntArrayMat(0))
325 || test_reduction(RandomMat(17, 12), 2.f, 1, IntArrayMat(1))
326 || test_reduction(RandomMat(17, 12), 1.f, 1, IntArrayMat(0, 1))
327 || test_reduction(RandomMat(19, 15), 2.f, 1, IntArrayMat(0))
328 || test_reduction(RandomMat(19, 15), 1.f, 1, IntArrayMat(1))
329 || test_reduction(RandomMat(19, 15), 2.f, 1, IntArrayMat(0, 1));
330}
331
332static int test_reduction_3()
333{
334 return 0
335 || test_reduction(RandomMat(128), 1.f, 0)
336 || test_reduction(RandomMat(128), 2.f, 0)
337 || test_reduction(RandomMat(124), 1.f, 0)
338 || test_reduction(RandomMat(124), 2.f, 0)
339 || test_reduction(RandomMat(127), 1.f, 0)
340 || test_reduction(RandomMat(127), 2.f, 0)
341
342 || test_reduction(RandomMat(128), 1.f, 1)
343 || test_reduction(RandomMat(128), 2.f, 1)
344 || test_reduction(RandomMat(124), 1.f, 1)
345 || test_reduction(RandomMat(124), 2.f, 1)
346 || test_reduction(RandomMat(127), 1.f, 1)
347 || test_reduction(RandomMat(127), 2.f, 1)
348
349 || test_reduction(RandomMat(128), 1.f, 0, IntArrayMat(0))
350 || test_reduction(RandomMat(128), 2.f, 0, IntArrayMat(0))
351 || test_reduction(RandomMat(124), 1.f, 0, IntArrayMat(0))
352 || test_reduction(RandomMat(124), 2.f, 0, IntArrayMat(0))
353 || test_reduction(RandomMat(127), 1.f, 0, IntArrayMat(0))
354 || test_reduction(RandomMat(127), 2.f, 0, IntArrayMat(0))
355
356 || test_reduction(RandomMat(128), 1.f, 1, IntArrayMat(0))
357 || test_reduction(RandomMat(128), 2.f, 1, IntArrayMat(0))
358 || test_reduction(RandomMat(124), 1.f, 1, IntArrayMat(0))
359 || test_reduction(RandomMat(124), 2.f, 1, IntArrayMat(0))
360 || test_reduction(RandomMat(127), 1.f, 1, IntArrayMat(0))
361 || test_reduction(RandomMat(127), 1.f, 1, IntArrayMat(0));
362}
363
364int main()
365{
366 SRAND(7767517);
367
368 for (op_type = 0; op_type < OP_TYPE_MAX; op_type++)
369 {
370 int ret = 0
371 || test_reduction_0()
372 || test_reduction_1()
373 || test_reduction_2()
374 || test_reduction_3();
375
376 if (ret != 0)
377 return ret;
378 }
379
380 return 0;
381}