• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

krakjoe / ort / 19174598641

07 Nov 2025 04:07PM UTC coverage: 92.332% (+0.4%) from 91.936%
19174598641

push

github

krakjoe
define f32/f64 when onnxruntime is loaded

12450 of 13484 relevant lines covered (92.33%)

299476.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/src/maths/dispatch.c
1
/*
2
  +----------------------------------------------------------------------+
3
  | ort                                                                  |
4
  +----------------------------------------------------------------------+
5
  | Copyright (c) Joe Watkins 2025                                       |
6
  +----------------------------------------------------------------------+
7
  | This source file is subject to version 3.01 of the PHP license,      |
8
  | that is bundled with this package in the file LICENSE, and is        |
9
  | available through the world-wide-web at the following url:           |
10
  | http://www.php.net/license/3_01.txt                                  |
11
  | If you did not receive a copy of the PHP license and are unable to   |
12
  | obtain it through the world-wide-web, please send a note to          |
13
  | license@php.net so we can mail you a copy immediately.               |
14
  +----------------------------------------------------------------------+
15
  | Author: krakjoe                                                      |
16
  +----------------------------------------------------------------------+
17
 */
18

19
#include "maths/dispatch.h"
20
#include "maths/frontend/impl.h"
21

22
/* Error dispatch */
23
ORT_TLS ort_math_dispatch_t __ort_math_dispatch_error;
24
 
25
/* Complete dispatch table */
26
ORT_TLS ort_math_dispatch_t __ort_math_dispatch_table[] = {
27
    /* FLOAT16 */
28
    {
29
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16,
30
        .add_func        = ort_math_frontend_add_float16,
31
        .add_scalar_func = ort_math_frontend_add_scalar_float16,
32

33
        .div_func        = ort_math_frontend_div_float16,
34
        .div_scalar_func = ort_math_frontend_div_scalar_float16,
35

36
        .sub_func        = ort_math_frontend_sub_float16,
37
        .sub_scalar_func = ort_math_frontend_sub_scalar_float16,
38

39
        .mul_func        = ort_math_frontend_mul_float16,
40
        .mul_scalar_func = ort_math_frontend_mul_scalar_float16,
41

42
        .ceil_func       = ort_math_frontend_ceil_float16,
43
        .floor_func      = ort_math_frontend_floor_float16,
44
        .round_func      = ort_math_frontend_round_float16,
45
        .abs_func        = ort_math_frontend_abs_float16,
46
        .sqrt_func       = ort_math_frontend_sqrt_float16,
47
        .neg_func        = ort_math_frontend_neg_float16,
48
        .recip_func      = ort_math_frontend_recip_float16,
49
        .sign_func       = ort_math_frontend_sign_float16,
50
        .trunc_func      = ort_math_frontend_trunc_float16,
51
        .dot_func        = ort_math_frontend_dot_float16,
52
        .matmul_func     = ort_math_frontend_matmul_float16,
53
        .sum_func        = ort_math_frontend_sum_float16,
54
        .sum_axis_func   = ort_math_frontend_sum_axis_float16,
55
        .min_func        = ort_math_frontend_min_float16,
56
        .min_axis_func   = ort_math_frontend_min_axis_float16,
57
        .max_func        = ort_math_frontend_max_float16,
58
        .max_axis_func   = ort_math_frontend_max_axis_float16,
59
        .mean_func       = ort_math_frontend_mean_float16,
60
        .mean_axis_func  = ort_math_frontend_mean_axis_float16,
61
        .softmax_axis_func = ort_math_frontend_softmax_axis_float16,
62
        .argmax_func     = ort_math_frontend_argmax_float16,
63
        .argmax_axis_func = ort_math_frontend_argmax_axis_float16,
64

65
        .mod_func        = ort_math_frontend_mod_float16,
66
        .mod_scalar_func = ort_math_frontend_mod_scalar_float16,
67

68
        .pow_func        = ort_math_frontend_pow_float16,
69
        .pow_scalar_func = ort_math_frontend_pow_scalar_float16,
70
    },
71
    /* FLOAT32 */
72
    {
73
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT32,
74
        .add_func        = ort_math_frontend_add_float32,
75
        .add_scalar_func = ort_math_frontend_add_scalar_float32,
76

77
        .div_func        = ort_math_frontend_div_float32,
78
        .div_scalar_func = ort_math_frontend_div_scalar_float32,
79

80
        .sub_func        = ort_math_frontend_sub_float32,
81
        .sub_scalar_func = ort_math_frontend_sub_scalar_float32,
82

83
        .mul_func        = ort_math_frontend_mul_float32,
84
        .mul_scalar_func = ort_math_frontend_mul_scalar_float32,
85

86
        .ceil_func       = ort_math_frontend_ceil_float32,
87
        .floor_func      = ort_math_frontend_floor_float32,
88
        .round_func      = ort_math_frontend_round_float32,
89
        .abs_func        = ort_math_frontend_abs_float32,
90
        .sqrt_func       = ort_math_frontend_sqrt_float32,
91
        .neg_func        = ort_math_frontend_neg_float32,
92
        .recip_func      = ort_math_frontend_recip_float32,
93
        .sign_func       = ort_math_frontend_sign_float32,
94
        .trunc_func      = ort_math_frontend_trunc_float32,
95
        .dot_func        = ort_math_frontend_dot_float32,
96
        .matmul_func     = ort_math_frontend_matmul_float32,
97
        .sum_func        = ort_math_frontend_sum_float32,
98
        .sum_axis_func   = ort_math_frontend_sum_axis_float32,
99
        .min_func        = ort_math_frontend_min_float32,
100
        .min_axis_func   = ort_math_frontend_min_axis_float32,
101
        .max_func        = ort_math_frontend_max_float32,
102
        .max_axis_func   = ort_math_frontend_max_axis_float32,
103
        .mean_func       = ort_math_frontend_mean_float32,
104
        .mean_axis_func  = ort_math_frontend_mean_axis_float32,
105
        .softmax_axis_func = ort_math_frontend_softmax_axis_float32,
106
        .argmax_func     = ort_math_frontend_argmax_float32,
107
        .argmax_axis_func = ort_math_frontend_argmax_axis_float32,
108

109
        .mod_func        = ort_math_frontend_mod_float32,
110
        .mod_scalar_func = ort_math_frontend_mod_scalar_float32,
111

112
        .pow_func        = ort_math_frontend_pow_float32,
113
        .pow_scalar_func = ort_math_frontend_pow_scalar_float32,
114
    },
115
    /* FLOAT64 */
116
    {
117
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT64,
118
        .add_func        = ort_math_frontend_add_float64,
119
        .add_scalar_func = ort_math_frontend_add_scalar_float64,
120

121
        .div_func        = ort_math_frontend_div_float64,
122
        .div_scalar_func = ort_math_frontend_div_scalar_float64,
123

124
        .sub_func        = ort_math_frontend_sub_float64,
125
        .sub_scalar_func = ort_math_frontend_sub_scalar_float64,
126

127
        .mul_func        = ort_math_frontend_mul_float64,
128
        .mul_scalar_func = ort_math_frontend_mul_scalar_float64,
129

130
        .ceil_func       = ort_math_frontend_ceil_float64,
131
        .floor_func      = ort_math_frontend_floor_float64,
132
        .round_func      = ort_math_frontend_round_float64,
133
        .abs_func        = ort_math_frontend_abs_float64,
134
        .sqrt_func       = ort_math_frontend_sqrt_float64,
135
        .neg_func        = ort_math_frontend_neg_float64,
136
        .recip_func      = ort_math_frontend_recip_float64,
137
        .sign_func       = ort_math_frontend_sign_float64,
138
        .trunc_func      = ort_math_frontend_trunc_float64,
139
        .dot_func        = ort_math_frontend_dot_float64,
140
        .matmul_func     = ort_math_frontend_matmul_float64,
141
        .sum_func        = ort_math_frontend_sum_float64,
142
        .sum_axis_func   = ort_math_frontend_sum_axis_float64,
143
        .min_func        = ort_math_frontend_min_float64,
144
        .min_axis_func   = ort_math_frontend_min_axis_float64,
145
        .max_func        = ort_math_frontend_max_float64,
146
        .max_axis_func   = ort_math_frontend_max_axis_float64,
147
        .mean_func       = ort_math_frontend_mean_float64,
148
        .mean_axis_func  = ort_math_frontend_mean_axis_float64,
149
        .softmax_axis_func = ort_math_frontend_softmax_axis_float64,
150
        .argmax_func     = ort_math_frontend_argmax_float64,
151
        .argmax_axis_func = ort_math_frontend_argmax_axis_float64,
152
        .mod_func        = ort_math_frontend_mod_float64,
153
        .mod_scalar_func = ort_math_frontend_mod_scalar_float64,
154

155
        .pow_func        = ort_math_frontend_pow_float64,
156
        .pow_scalar_func = ort_math_frontend_pow_scalar_float64,
157
    },
158
    /* INT8 */
159
    {
160
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8,
161
        .add_func        = ort_math_frontend_add_int8_t,
162
        .add_scalar_func = ort_math_frontend_add_scalar_int8_t,
163

164
        .div_func        = NULL,
165
        .div_scalar_func = NULL,
166

167
        .sub_func        = ort_math_frontend_sub_int8_t,
168
        .sub_scalar_func = ort_math_frontend_sub_scalar_int8_t,
169

170
        .mul_func        = ort_math_frontend_mul_int8_t,
171
        .mul_scalar_func = ort_math_frontend_mul_scalar_int8_t,
172

173
        .ceil_func       = ort_math_frontend_ceil_int8_t,
174
        .floor_func      = ort_math_frontend_floor_int8_t,
175
        .round_func      = ort_math_frontend_round_int8_t,
176
        .abs_func        = ort_math_frontend_abs_int8_t,
177
        .sqrt_func       = NULL,
178
        .neg_func        = ort_math_frontend_neg_int8_t,
179
        .recip_func      = NULL,
180
        .sign_func       = ort_math_frontend_sign_int8_t,
181
        .trunc_func      = ort_math_frontend_trunc_int8_t,
182
        .dot_func        = ort_math_frontend_dot_int8_t,
183
        .matmul_func     = ort_math_frontend_matmul_int8_t,
184
        .sum_func        = NULL,
185
        .sum_axis_func   = NULL,
186
        .min_func        = ort_math_frontend_min_int8_t,
187
        .min_axis_func   = ort_math_frontend_min_axis_int8_t,
188
        .max_func        = ort_math_frontend_max_int8_t,
189
        .max_axis_func   = ort_math_frontend_max_axis_int8_t,
190
        .mean_func       = NULL,
191
        .mean_axis_func  = NULL,
192
        .softmax_axis_func = NULL,
193
        .argmax_func     = ort_math_frontend_argmax_int8_t,
194
        .argmax_axis_func = ort_math_frontend_argmax_axis_int8_t,
195

196
        .mod_func        = ort_math_frontend_mod_int8_t,
197
        .mod_scalar_func = ort_math_frontend_mod_scalar_int8_t,
198

199
        .pow_func        = ort_math_frontend_pow_int8_t,
200
        .pow_scalar_func = ort_math_frontend_pow_scalar_int8_t,
201
    },
202
    /* INT16 */
203
    {
204
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16,
205
        .add_func        = ort_math_frontend_add_int16_t,
206
        .add_scalar_func = ort_math_frontend_add_scalar_int16_t,
207

208
        .div_func        = NULL,
209
        .div_scalar_func = NULL,
210

211
        .sub_func        = ort_math_frontend_sub_int16_t,
212
        .sub_scalar_func = ort_math_frontend_sub_scalar_int16_t,
213
    
214
        .mul_func        = ort_math_frontend_mul_int16_t,
215
        .mul_scalar_func = ort_math_frontend_mul_scalar_int16_t,
216

217
        .ceil_func       = ort_math_frontend_ceil_int16_t,
218
        .floor_func      = ort_math_frontend_floor_int16_t,
219
        .round_func      = ort_math_frontend_round_int16_t,
220
        .abs_func        = ort_math_frontend_abs_int16_t,
221
        .sqrt_func       = NULL,
222
        .neg_func        = ort_math_frontend_neg_int16_t,
223
        .recip_func      = NULL,
224
        .sign_func       = ort_math_frontend_sign_int16_t,
225
        .trunc_func      = ort_math_frontend_trunc_int16_t,
226
        .dot_func        = ort_math_frontend_dot_int16_t,
227
        .matmul_func     = ort_math_frontend_matmul_int16_t,
228
        .sum_func        = NULL,
229
        .sum_axis_func   = NULL,
230
        .min_func        = ort_math_frontend_min_int16_t,
231
        .min_axis_func   = ort_math_frontend_min_axis_int16_t,
232
        .max_func        = ort_math_frontend_max_int16_t,
233
        .max_axis_func   = ort_math_frontend_max_axis_int16_t,
234
        .mean_func       = NULL,
235
        .mean_axis_func  = NULL,
236
        .softmax_axis_func = NULL,
237

238
        .argmax_func     = ort_math_frontend_argmax_int16_t,
239
        .argmax_axis_func = ort_math_frontend_argmax_axis_int16_t,
240

241
        .mod_func        = ort_math_frontend_mod_int16_t,
242
        .mod_scalar_func = ort_math_frontend_mod_scalar_int16_t,
243

244
        .pow_func        = ort_math_frontend_pow_int16_t,
245
        .pow_scalar_func = ort_math_frontend_pow_scalar_int16_t,
246
    },
247
    /* INT32 */
248
    {
249
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32,
250
        .add_func        = ort_math_frontend_add_int32_t,
251
        .add_scalar_func = ort_math_frontend_add_scalar_int32_t,
252

253
        .div_func        = NULL,
254
        .div_scalar_func = NULL,
255

256
        .sub_func        = ort_math_frontend_sub_int32_t,
257
        .sub_scalar_func = ort_math_frontend_sub_scalar_int32_t,
258

259
        .mul_func        = ort_math_frontend_mul_int32_t,
260
        .mul_scalar_func = ort_math_frontend_mul_scalar_int32_t,
261

262
        .ceil_func       = ort_math_frontend_ceil_int32_t,
263
        .floor_func      = ort_math_frontend_floor_int32_t,
264
        .round_func      = ort_math_frontend_round_int32_t,
265
        .abs_func        = ort_math_frontend_abs_int32_t,
266
        .sqrt_func       = NULL,
267
        .neg_func        = ort_math_frontend_neg_int32_t,
268
        .recip_func      = NULL,
269
        .sign_func       = ort_math_frontend_sign_int32_t,
270
        .trunc_func      = ort_math_frontend_trunc_int32_t,
271
        .dot_func        = ort_math_frontend_dot_int32_t,
272
        .matmul_func     = ort_math_frontend_matmul_int32_t,
273
        .sum_func        = NULL,
274
        .sum_axis_func   = NULL,
275
        .min_func        = ort_math_frontend_min_int32_t,
276
        .min_axis_func   = ort_math_frontend_min_axis_int32_t,
277
        .max_func        = ort_math_frontend_max_int32_t,
278
        .max_axis_func   = ort_math_frontend_max_axis_int32_t,
279
        .mean_func       = NULL,
280
        .mean_axis_func  = NULL,
281
        .softmax_axis_func = NULL,
282

283
        .argmax_func     = ort_math_frontend_argmax_int32_t,
284
        .argmax_axis_func = ort_math_frontend_argmax_axis_int32_t,
285

286
        .mod_func        = ort_math_frontend_mod_int32_t,
287
        .mod_scalar_func = ort_math_frontend_mod_scalar_int32_t,
288

289
        .pow_func        = ort_math_frontend_pow_int32_t,
290
        .pow_scalar_func = ort_math_frontend_pow_scalar_int32_t,
291
    },
292
    /* INT64 */
293
    {
294
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64,
295
        .add_func        = ort_math_frontend_add_int64_t,
296
        .add_scalar_func = ort_math_frontend_add_scalar_int64_t,
297

298
        .sub_func        = ort_math_frontend_sub_int64_t,
299
        .sub_scalar_func = ort_math_frontend_sub_scalar_int64_t,
300

301
        .mul_func        = ort_math_frontend_mul_int64_t,
302
        .mul_scalar_func = ort_math_frontend_mul_scalar_int64_t,
303
    
304
        .div_func        = NULL,
305
        .div_scalar_func = NULL,
306
        .ceil_func       = ort_math_frontend_ceil_int64_t,
307
        .floor_func      = ort_math_frontend_floor_int64_t,
308
        .round_func      = ort_math_frontend_round_int64_t,
309
        .abs_func        = ort_math_frontend_abs_int64_t,
310
        .sqrt_func       = NULL,
311
        .neg_func        = ort_math_frontend_neg_int64_t,
312
        .recip_func      = NULL,
313
        .sign_func       = ort_math_frontend_sign_int64_t,
314
        .trunc_func      = ort_math_frontend_trunc_int64_t,
315
        .dot_func        = ort_math_frontend_dot_int64_t,
316
        .matmul_func     = ort_math_frontend_matmul_int64_t,
317
        .sum_func        = ort_math_frontend_sum_int64_t,
318
        .sum_axis_func   = ort_math_frontend_sum_axis_int64_t,
319
        .min_func        = ort_math_frontend_min_int64_t,
320
        .min_axis_func   = ort_math_frontend_min_axis_int64_t,
321
        .max_func        = ort_math_frontend_max_int64_t,
322
        .max_axis_func   = ort_math_frontend_max_axis_int64_t,
323
        .mean_func       = NULL,
324
        .mean_axis_func  = NULL,
325
        .softmax_axis_func = NULL,
326
        .argmax_func     = ort_math_frontend_argmax_int64_t,
327
        .argmax_axis_func = ort_math_frontend_argmax_axis_int64_t,
328
        .mod_func        = ort_math_frontend_mod_int64_t,
329
        .mod_scalar_func = ort_math_frontend_mod_scalar_int64_t,
330

331
        .pow_func        = ort_math_frontend_pow_int64_t,
332
        .pow_scalar_func = ort_math_frontend_pow_scalar_int64_t,
333
    },
334
    /* UINT8 */
335
    {
336
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8,
337
        .add_func        = ort_math_frontend_add_uint8_t,
338
        .add_scalar_func = ort_math_frontend_add_scalar_uint8_t,
339

340
        .sub_func        = ort_math_frontend_sub_uint8_t,
341
        .sub_scalar_func = ort_math_frontend_sub_scalar_uint8_t,
342
    
343
        .mul_func        = ort_math_frontend_mul_uint8_t,
344
        .mul_scalar_func = ort_math_frontend_mul_scalar_uint8_t,
345
    
346
        .div_func        = NULL,
347
        .div_scalar_func = NULL,
348
        .ceil_func       = ort_math_frontend_ceil_uint8_t,
349
        .floor_func      = ort_math_frontend_floor_uint8_t,
350
        .round_func      = ort_math_frontend_round_uint8_t,
351
        .abs_func        = ort_math_frontend_abs_uint8_t,
352
        .sqrt_func       = NULL,
353
        .neg_func        = ort_math_frontend_neg_uint8_t,
354
        .recip_func      = NULL,
355
        .sign_func       = ort_math_frontend_sign_uint8_t,
356
        .trunc_func      = ort_math_frontend_trunc_uint8_t,
357
        .dot_func        = ort_math_frontend_dot_uint8_t,
358
        .matmul_func     = ort_math_frontend_matmul_uint8_t,
359
        .sum_func        = NULL,
360
        .sum_axis_func   = NULL,
361
        .min_func        = ort_math_frontend_min_uint8_t,
362
        .min_axis_func   = ort_math_frontend_min_axis_uint8_t,
363
        .max_func        = ort_math_frontend_max_uint8_t,
364
        .max_axis_func   = ort_math_frontend_max_axis_uint8_t,
365
        .mean_func       = NULL,
366
        .mean_axis_func  = NULL,
367
        .softmax_axis_func = NULL,
368

369
        .argmax_func     = ort_math_frontend_argmax_uint8_t,
370
        .argmax_axis_func = ort_math_frontend_argmax_axis_uint8_t,
371

372
        .mod_func        = ort_math_frontend_mod_uint8_t,
373
        .mod_scalar_func = ort_math_frontend_mod_scalar_uint8_t,
374

375
        .pow_func        = ort_math_frontend_pow_uint8_t,
376
        .pow_scalar_func = ort_math_frontend_pow_scalar_uint8_t,
377
    },
378
    /* UINT16 */
379
    {
380
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16,
381
        .add_func        = ort_math_frontend_add_uint16_t,
382
        .add_scalar_func = ort_math_frontend_add_scalar_uint16_t,
383

384
        .sub_func        = ort_math_frontend_sub_uint16_t,
385
        .sub_scalar_func = ort_math_frontend_sub_scalar_uint16_t,
386

387
        .mul_func        = ort_math_frontend_mul_uint16_t,
388
        .mul_scalar_func = ort_math_frontend_mul_scalar_uint16_t,
389

390
        .div_func        = NULL,
391
        .div_scalar_func = NULL,
392
        .ceil_func       = ort_math_frontend_ceil_uint16_t,
393
        .floor_func      = ort_math_frontend_floor_uint16_t,
394
        .round_func      = ort_math_frontend_round_uint16_t,
395
        .abs_func        = ort_math_frontend_abs_uint16_t,
396
        .sqrt_func       = NULL,
397
        .neg_func        = ort_math_frontend_neg_uint16_t,
398
        .recip_func      = NULL,
399
        .sign_func       = ort_math_frontend_sign_uint16_t,
400
        .trunc_func      = ort_math_frontend_trunc_uint16_t,
401
        .dot_func        = ort_math_frontend_dot_uint16_t,
402
        .matmul_func     = ort_math_frontend_matmul_uint16_t,
403
        .sum_func        = NULL,
404
        .sum_axis_func   = NULL,
405
        .min_func        = ort_math_frontend_min_uint16_t,
406
        .min_axis_func   = ort_math_frontend_min_axis_uint16_t,
407
        .max_func        = ort_math_frontend_max_uint16_t,
408
        .max_axis_func   = ort_math_frontend_max_axis_uint16_t,
409
        .mean_func       = NULL,
410
        .mean_axis_func  = NULL,
411
        .softmax_axis_func = NULL,
412

413
        .argmax_func     = ort_math_frontend_argmax_uint16_t,
414
        .argmax_axis_func = ort_math_frontend_argmax_axis_uint16_t,
415

416
        .mod_func        = ort_math_frontend_mod_uint16_t,
417
        .mod_scalar_func = ort_math_frontend_mod_scalar_uint16_t,
418

419
        .pow_func        = ort_math_frontend_pow_uint16_t,
420
        .pow_scalar_func = ort_math_frontend_pow_scalar_uint16_t,
421
    },
422
    /* UINT32 */
423
    {
424
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32,
425
        .add_func        = ort_math_frontend_add_uint32_t,
426
        .add_scalar_func = ort_math_frontend_add_scalar_uint32_t,
427

428
        .sub_func        = ort_math_frontend_sub_uint32_t,
429
        .sub_scalar_func = ort_math_frontend_sub_scalar_uint32_t,
430

431
        .mul_func        = ort_math_frontend_mul_uint32_t,
432
        .mul_scalar_func = ort_math_frontend_mul_scalar_uint32_t,
433

434
        .div_func        = NULL,
435
        .div_scalar_func = NULL,
436
        .ceil_func       = ort_math_frontend_ceil_uint32_t,
437
        .floor_func      = ort_math_frontend_floor_uint32_t,
438
        .round_func      = ort_math_frontend_round_uint32_t,
439
        .abs_func        = ort_math_frontend_abs_uint32_t,
440
        .sqrt_func       = NULL,
441
        .neg_func        = ort_math_frontend_neg_uint32_t,
442
        .recip_func      = NULL,
443
        .sign_func       = ort_math_frontend_sign_uint32_t,
444
        .trunc_func      = ort_math_frontend_trunc_uint32_t,
445
        .dot_func        = ort_math_frontend_dot_uint32_t,
446
        .matmul_func     = ort_math_frontend_matmul_uint32_t,
447
        .sum_func        = NULL,
448
        .sum_axis_func   = NULL,
449
        .min_func        = ort_math_frontend_min_uint32_t,
450
        .min_axis_func   = ort_math_frontend_min_axis_uint32_t,
451
        .max_func        = ort_math_frontend_max_uint32_t,
452
        .max_axis_func   = ort_math_frontend_max_axis_uint32_t,
453
        .mean_func       = NULL,
454
        .mean_axis_func  = NULL,
455
        .softmax_axis_func = NULL,
456
        .argmax_func     = ort_math_frontend_argmax_uint32_t,
457
        .argmax_axis_func = ort_math_frontend_argmax_axis_uint32_t,
458
        .mod_func        = ort_math_frontend_mod_uint32_t,
459
        .mod_scalar_func = ort_math_frontend_mod_scalar_uint32_t,
460

461
        .pow_func        = ort_math_frontend_pow_uint32_t,
462
        .pow_scalar_func = ort_math_frontend_pow_scalar_uint32_t,
463
    },
464
    /* BOOL */
465
    {
466
        .type = ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL,
467
        .add_func        = ort_math_frontend_add_zend_bool,          // Logical OR (or addition)
468
        .add_scalar_func = ort_math_frontend_add_scalar_zend_bool,   // Logical OR (or addition)
469

470
        .div_func        = NULL,          // Logical division (A && B)
471
        .div_scalar_func = NULL,          // Logical division (A && B)
472

473
        .sub_func        = NULL,                         // Logical XOR (or subtraction)
474
        .sub_scalar_func = NULL,                         // Logical XOR (or subtraction)
475
        .mul_func        = ort_math_frontend_mul_zend_bool,          // Logical AND (or multiplication)
476
        .mul_scalar_func = ort_math_frontend_mul_scalar_zend_bool,   // Logical AND (or multiplication)
477
        .ceil_func       = NULL,                         // Not meaningful for bool
478
        .floor_func      = NULL,                         // Not meaningful for bool
479
        .round_func      = NULL,                         // Not meaningful for bool
480
        .abs_func        = NULL,                         // Identity for bool
481
        .sqrt_func       = NULL,                         // Not meaningful for bool
482
        .neg_func        = ort_math_frontend_neg_zend_bool,         // Logical NOT
483
        .recip_func      = NULL,                         // Not meaningful for bool
484
        .sign_func       = NULL,                         // Identity for bool
485
        .trunc_func      = NULL,                         // Not meaningful for bool
486
        .dot_func        = NULL,
487
        .matmul_func     = NULL,
488
        .sum_func        = NULL,
489
        .sum_axis_func   = NULL,
490
        .min_func        = ort_math_frontend_min_zend_bool,
491
        .min_axis_func   = ort_math_frontend_min_axis_zend_bool,
492
        .max_func        = ort_math_frontend_max_zend_bool,
493
        .max_axis_func   = ort_math_frontend_max_axis_zend_bool,
494
        .mean_func       = NULL,
495
        .mean_axis_func  = NULL,
496
        .softmax_axis_func = NULL,
497
        .argmax_func       = ort_math_frontend_argmax_zend_bool,       // Logical argmax (returns index of first true)
498
        .argmax_axis_func  = ort_math_frontend_argmax_axis_zend_bool, // Logical argmax along axis (returns index of first true along axis)
499
        .mod_func        = NULL,
500
        .mod_scalar_func = NULL,
501

502
        .pow_func        = NULL,                         // Logical power (A ** B)
503
        .pow_scalar_func = NULL,                         // Logical power (A ** B)  
504
    }
505
};
506

507
ort_math_dispatch_t* ort_math_dispatch_table(void) {
8,219✔
508
    return __ort_math_dispatch_table;
8,219✔
509
}
510

511
ort_math_dispatch_t* ort_math_dispatch_backup_malloc(void) {
2,258✔
512
    ort_math_dispatch_t* backup = (ort_math_dispatch_t*)
2,258✔
513
        malloc(
2,258✔
514
            sizeof(__ort_math_dispatch_table));
515
    memcpy(backup, __ort_math_dispatch_table,
2,258✔
516
        sizeof(__ort_math_dispatch_table));
517
    return backup;
2,258✔
518
}
519

520
void ort_math_dispatch_backup_free(ort_math_dispatch_t* backup) {
×
521
    free(backup);
×
522
}
×
523

524
const ort_math_dispatch_t* ort_math_dispatch_type(
23,387✔
525
    ONNXTensorElementDataType type) {
526
    int16_t index = ort_math_dispatch_indexof(type);
23,387✔
527

528
    if (index == FAILURE) {
23,351✔
529
        memset(&__ort_math_dispatch_error,
51✔
530
            0, sizeof(ort_math_dispatch_t));
531
        return &__ort_math_dispatch_error;
51✔
532
    }
533

534
    return &__ort_math_dispatch_table[index];
23,336✔
535
}
6,855✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc