1use super::{
20 OpAttributeKind, OpAttributeSpec, OpControlFlow, OpDTypeRule, OpDifferentiation, OpEffect,
21 OpFusionClass, OpLowering, OpShapeRule, OpValueKind, OperationContract,
22};
23
24pub mod matrix {
26 use super::*;
27
28 pub const ADD: OperationContract = OperationContract::new(
29 "oa::FnMatrix::add",
30 0x0a2a862200859b54,
31 &[OpValueKind::Matrix, OpValueKind::Matrix],
32 &[OpValueKind::Matrix],
33 )
34 .with_shape_rule(OpShapeRule::Broadcast)
35 .with_dtype_rule(OpDTypeRule::MatchInput)
36 .with_differentiation(OpDifferentiation::Reverse)
37 .with_lowering(OpLowering::Dispatch)
38 .with_fusion_class(OpFusionClass::Pointwise)
39 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
40
41 pub const BIAS_ADD: OperationContract = OperationContract::new(
42 "oa::FnMatrix::biasAdd",
43 0x19dd09a568e168cc,
44 &[OpValueKind::Matrix, OpValueKind::Matrix],
45 &[OpValueKind::Matrix],
46 )
47 .with_shape_rule(OpShapeRule::Broadcast)
48 .with_dtype_rule(OpDTypeRule::MatchInput)
49 .with_differentiation(OpDifferentiation::Reverse)
50 .with_lowering(OpLowering::Dispatch)
51 .with_fusion_class(OpFusionClass::Pointwise)
52 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
53
54 pub const SUB: OperationContract = OperationContract::new(
55 "oa::FnMatrix::sub",
56 0x30324ed8c778da9e,
57 &[OpValueKind::Matrix, OpValueKind::Matrix],
58 &[OpValueKind::Matrix],
59 )
60 .with_shape_rule(OpShapeRule::Broadcast)
61 .with_dtype_rule(OpDTypeRule::MatchInput)
62 .with_differentiation(OpDifferentiation::Reverse)
63 .with_lowering(OpLowering::Dispatch)
64 .with_fusion_class(OpFusionClass::Pointwise)
65 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
66
67 pub const MUL: OperationContract = OperationContract::new(
68 "oa::FnMatrix::mul",
69 0xb7c7db3780c88252,
70 &[OpValueKind::Matrix, OpValueKind::Matrix],
71 &[OpValueKind::Matrix],
72 )
73 .with_shape_rule(OpShapeRule::Broadcast)
74 .with_dtype_rule(OpDTypeRule::MatchInput)
75 .with_differentiation(OpDifferentiation::Reverse)
76 .with_lowering(OpLowering::Dispatch)
77 .with_fusion_class(OpFusionClass::Pointwise)
78 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
79
80 pub const DIV: OperationContract = OperationContract::new(
81 "oa::FnMatrix::div",
82 0xd3d40d61745e20e9,
83 &[OpValueKind::Matrix, OpValueKind::Matrix],
84 &[OpValueKind::Matrix],
85 )
86 .with_shape_rule(OpShapeRule::Broadcast)
87 .with_dtype_rule(OpDTypeRule::MatchInput)
88 .with_differentiation(OpDifferentiation::Reverse)
89 .with_lowering(OpLowering::Dispatch)
90 .with_fusion_class(OpFusionClass::Pointwise)
91 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
92
93 pub const SCALE: OperationContract = OperationContract::new(
94 "oa::FnMatrix::scale",
95 0x3fa3800cff89b8ea,
96 &[OpValueKind::Matrix],
97 &[OpValueKind::Matrix],
98 )
99 .with_shape_rule(OpShapeRule::MatchInput)
100 .with_dtype_rule(OpDTypeRule::MatchInput)
101 .with_differentiation(OpDifferentiation::Reverse)
102 .with_lowering(OpLowering::Dispatch)
103 .with_fusion_class(OpFusionClass::Pointwise)
104 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
105 .attributes(&[OpAttributeSpec::new("scalar", OpAttributeKind::Float)]);
106
107 pub const NEG: OperationContract = OperationContract::new(
108 "oa::FnMatrix::neg",
109 0x35103edbf22d60f2,
110 &[OpValueKind::Matrix],
111 &[OpValueKind::Matrix],
112 )
113 .with_shape_rule(OpShapeRule::MatchInput)
114 .with_dtype_rule(OpDTypeRule::MatchInput)
115 .with_differentiation(OpDifferentiation::Reverse)
116 .with_lowering(OpLowering::Dispatch)
117 .with_fusion_class(OpFusionClass::Pointwise)
118 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
119
120 pub const ABS: OperationContract = OperationContract::new(
121 "oa::FnMatrix::abs",
122 0xc4fa5c4cc4fdca10,
123 &[OpValueKind::Matrix],
124 &[OpValueKind::Matrix],
125 )
126 .with_shape_rule(OpShapeRule::MatchInput)
127 .with_dtype_rule(OpDTypeRule::MatchInput)
128 .with_differentiation(OpDifferentiation::Reverse)
129 .with_lowering(OpLowering::Dispatch)
130 .with_fusion_class(OpFusionClass::Pointwise)
131 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
132
133 pub const LOG: OperationContract = OperationContract::new(
134 "oa::FnMatrix::log",
135 0x2c29315db02e4cd2,
136 &[OpValueKind::Matrix],
137 &[OpValueKind::Matrix],
138 )
139 .with_shape_rule(OpShapeRule::MatchInput)
140 .with_dtype_rule(OpDTypeRule::MatchInput)
141 .with_differentiation(OpDifferentiation::Reverse)
142 .with_lowering(OpLowering::Dispatch)
143 .with_fusion_class(OpFusionClass::Pointwise)
144 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
145
146 pub const SQRT: OperationContract = OperationContract::new(
147 "oa::FnMatrix::sqrt",
148 0x8e0ca16ed81704ac,
149 &[OpValueKind::Matrix],
150 &[OpValueKind::Matrix],
151 )
152 .with_shape_rule(OpShapeRule::MatchInput)
153 .with_dtype_rule(OpDTypeRule::MatchInput)
154 .with_differentiation(OpDifferentiation::Reverse)
155 .with_lowering(OpLowering::Dispatch)
156 .with_fusion_class(OpFusionClass::Pointwise)
157 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
158
159 pub const POW: OperationContract = OperationContract::new(
160 "oa::matrix::pow",
161 0xbc8894de20a23ff9,
162 &[OpValueKind::Matrix],
163 &[OpValueKind::Matrix],
164 )
165 .with_shape_rule(OpShapeRule::MatchInput)
166 .with_dtype_rule(OpDTypeRule::MatchInput)
167 .with_differentiation(OpDifferentiation::Reverse)
168 .with_lowering(OpLowering::Dispatch)
169 .with_fusion_class(OpFusionClass::Pointwise)
170 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
171 .attributes(&[OpAttributeSpec::new("exponent", OpAttributeKind::Float)]);
172
173 pub const ADD_SCALAR: OperationContract = OperationContract::new(
174 "oa::FnMatrix::addScalar",
175 0x3e273ec838e21451,
176 &[OpValueKind::Matrix],
177 &[OpValueKind::Matrix],
178 )
179 .with_shape_rule(OpShapeRule::MatchInput)
180 .with_dtype_rule(OpDTypeRule::MatchInput)
181 .with_differentiation(OpDifferentiation::Reverse)
182 .with_lowering(OpLowering::Dispatch)
183 .with_fusion_class(OpFusionClass::Pointwise)
184 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
185 .attributes(&[OpAttributeSpec::new("scalar", OpAttributeKind::Float)]);
186
187 pub const SUB_SCALAR: OperationContract = OperationContract::new(
188 "oa::FnMatrix::subScalar",
189 0x3fd8f52f2ac369ae,
190 &[OpValueKind::Matrix],
191 &[OpValueKind::Matrix],
192 )
193 .with_shape_rule(OpShapeRule::MatchInput)
194 .with_dtype_rule(OpDTypeRule::MatchInput)
195 .with_differentiation(OpDifferentiation::Reverse)
196 .with_lowering(OpLowering::Dispatch)
197 .with_fusion_class(OpFusionClass::Pointwise)
198 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
199 .attributes(&[OpAttributeSpec::new("scalar", OpAttributeKind::Float)]);
200
201 pub const DIV_SCALAR: OperationContract = OperationContract::new(
202 "oa::FnMatrix::divScalar",
203 0xc9501da52366c0f5,
204 &[OpValueKind::Matrix],
205 &[OpValueKind::Matrix],
206 )
207 .with_shape_rule(OpShapeRule::MatchInput)
208 .with_dtype_rule(OpDTypeRule::MatchInput)
209 .with_differentiation(OpDifferentiation::Reverse)
210 .with_lowering(OpLowering::Dispatch)
211 .with_fusion_class(OpFusionClass::Pointwise)
212 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
213 .attributes(&[OpAttributeSpec::new("scalar", OpAttributeKind::Float)]);
214
215 pub const EXP: OperationContract = OperationContract::new(
216 "oa::FnMatrix::exp",
217 0xe857df35113590b9,
218 &[OpValueKind::Matrix],
219 &[OpValueKind::Matrix],
220 )
221 .with_shape_rule(OpShapeRule::MatchInput)
222 .with_dtype_rule(OpDTypeRule::MatchInput)
223 .with_differentiation(OpDifferentiation::Reverse)
224 .with_lowering(OpLowering::Dispatch)
225 .with_fusion_class(OpFusionClass::Pointwise)
226 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
227
228 pub const SIN: OperationContract = OperationContract::new(
229 "oa::matrix::sin",
230 0x2ff28b5ff7466c66,
231 &[OpValueKind::Matrix],
232 &[OpValueKind::Matrix],
233 )
234 .with_shape_rule(OpShapeRule::MatchInput)
235 .with_dtype_rule(OpDTypeRule::MatchInput)
236 .with_differentiation(OpDifferentiation::None)
237 .with_lowering(OpLowering::Dispatch)
238 .with_fusion_class(OpFusionClass::Pointwise)
239 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
240
241 pub const COS: OperationContract = OperationContract::new(
242 "oa::matrix::cos",
243 0x3196fbecedf6a717,
244 &[OpValueKind::Matrix],
245 &[OpValueKind::Matrix],
246 )
247 .with_shape_rule(OpShapeRule::MatchInput)
248 .with_dtype_rule(OpDTypeRule::MatchInput)
249 .with_differentiation(OpDifferentiation::None)
250 .with_lowering(OpLowering::Dispatch)
251 .with_fusion_class(OpFusionClass::Pointwise)
252 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
253
254 pub const RECIPROCAL: OperationContract = OperationContract::new(
255 "oa::FnMatrix::reciprocal",
256 0xac25fcc8aed83a0e,
257 &[OpValueKind::Matrix],
258 &[OpValueKind::Matrix],
259 )
260 .with_shape_rule(OpShapeRule::MatchInput)
261 .with_dtype_rule(OpDTypeRule::MatchInput)
262 .with_differentiation(OpDifferentiation::Reverse)
263 .with_lowering(OpLowering::Dispatch)
264 .with_fusion_class(OpFusionClass::Pointwise)
265 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
266
267 pub const CLAMP_MAX: OperationContract = OperationContract::new(
268 "oa::FnMatrix::clampMax",
269 0x8536e231bc0298eb,
270 &[OpValueKind::Matrix],
271 &[OpValueKind::Matrix],
272 )
273 .with_shape_rule(OpShapeRule::MatchInput)
274 .with_dtype_rule(OpDTypeRule::MatchInput)
275 .with_differentiation(OpDifferentiation::Reverse)
276 .with_lowering(OpLowering::Dispatch)
277 .with_fusion_class(OpFusionClass::Reduce)
278 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
279 .attributes(&[OpAttributeSpec::new("max", OpAttributeKind::Float)]);
280
281 pub const CLAMP_MIN: OperationContract = OperationContract::new(
282 "oa::FnMatrix::clampMin",
283 0x8ee7ee97147e942b,
284 &[OpValueKind::Matrix],
285 &[OpValueKind::Matrix],
286 )
287 .with_shape_rule(OpShapeRule::MatchInput)
288 .with_dtype_rule(OpDTypeRule::MatchInput)
289 .with_differentiation(OpDifferentiation::Reverse)
290 .with_lowering(OpLowering::Dispatch)
291 .with_fusion_class(OpFusionClass::Reduce)
292 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
293 .attributes(&[OpAttributeSpec::new("min", OpAttributeKind::Float)]);
294
295 pub const COPY: OperationContract = OperationContract::new(
296 "oa::FnMatrix::copy",
297 0x90d68f7b3504b5bd,
298 &[OpValueKind::Matrix],
299 &[OpValueKind::Matrix],
300 )
301 .with_shape_rule(OpShapeRule::MatchInput)
302 .with_dtype_rule(OpDTypeRule::MatchInput)
303 .with_differentiation(OpDifferentiation::Reverse)
304 .with_lowering(OpLowering::Dispatch)
305 .with_fusion_class(OpFusionClass::Gather)
306 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
307
308 pub const MATMUL: OperationContract = OperationContract::new(
309 "oa::FnMatrix::matMulNt",
310 0x4309b836dbcb8f84,
311 &[OpValueKind::Matrix, OpValueKind::Matrix],
312 &[OpValueKind::Matrix],
313 )
314 .with_shape_rule(OpShapeRule::MatmulNt)
315 .with_dtype_rule(OpDTypeRule::MatchInput)
316 .with_differentiation(OpDifferentiation::Reverse)
317 .with_lowering(OpLowering::Gemm)
318 .with_fusion_class(OpFusionClass::Gemm)
319 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
320
321 pub const SOFTMAX: OperationContract = OperationContract::new(
322 "oa::FnMatrix::softmax",
323 0xb86716c0d18620df,
324 &[OpValueKind::Matrix],
325 &[OpValueKind::Matrix],
326 )
327 .with_shape_rule(OpShapeRule::MatchInput)
328 .with_dtype_rule(OpDTypeRule::MatchInput)
329 .with_differentiation(OpDifferentiation::Reverse)
330 .with_lowering(OpLowering::Dispatch)
331 .with_fusion_class(OpFusionClass::Reduce)
332 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
333 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
334
335 pub const SOFTMAX_BACKWARD: OperationContract = OperationContract::new(
336 "oa::matrix::softmax_backward",
337 0xda501396094472c2,
338 &[OpValueKind::Matrix, OpValueKind::Matrix],
339 &[OpValueKind::Matrix],
340 )
341 .with_shape_rule(OpShapeRule::MatchInput)
342 .with_dtype_rule(OpDTypeRule::MatchInput)
343 .with_differentiation(OpDifferentiation::None)
344 .with_lowering(OpLowering::Dispatch)
345 .with_fusion_class(OpFusionClass::Reduce)
346 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
347 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
348
349 pub const LOG_SOFTMAX: OperationContract = OperationContract::new(
350 "oa::FnMatrix::logSoftmax",
351 0x838e7642cbc653c5,
352 &[OpValueKind::Matrix],
353 &[OpValueKind::Matrix],
354 )
355 .with_shape_rule(OpShapeRule::MatchInput)
356 .with_dtype_rule(OpDTypeRule::MatchInput)
357 .with_differentiation(OpDifferentiation::Reverse)
358 .with_lowering(OpLowering::Dispatch)
359 .with_fusion_class(OpFusionClass::Reduce)
360 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
361 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
362
363 pub const LOG_SOFTMAX_BACKWARD: OperationContract = OperationContract::new(
364 "oa::matrix::log_softmax_backward",
365 0xa2f65f366bdea2d7,
366 &[OpValueKind::Matrix, OpValueKind::Matrix],
367 &[OpValueKind::Matrix],
368 )
369 .with_shape_rule(OpShapeRule::MatchInput)
370 .with_dtype_rule(OpDTypeRule::MatchInput)
371 .with_differentiation(OpDifferentiation::None)
372 .with_lowering(OpLowering::Dispatch)
373 .with_fusion_class(OpFusionClass::Reduce)
374 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
375 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
376
377 pub const SUM: OperationContract = OperationContract::new(
378 "oa::FnMatrix::sum",
379 0xb1a79b6637053642,
380 &[OpValueKind::Matrix],
381 &[OpValueKind::Matrix],
382 )
383 .with_shape_rule(OpShapeRule::Explicit)
384 .with_dtype_rule(OpDTypeRule::MatchInput)
385 .with_differentiation(OpDifferentiation::Reverse)
386 .with_lowering(OpLowering::Dispatch)
387 .with_fusion_class(OpFusionClass::Reduce)
388 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
389 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
390
391 pub const SUM_BACKWARD: OperationContract = OperationContract::new(
392 "oa::matrix::sum_backward",
393 0xc7c56a841d7c029f,
394 &[OpValueKind::Matrix, OpValueKind::Matrix],
395 &[OpValueKind::Matrix],
396 )
397 .with_shape_rule(OpShapeRule::Explicit)
398 .with_dtype_rule(OpDTypeRule::MatchInput)
399 .with_differentiation(OpDifferentiation::None)
400 .with_lowering(OpLowering::Dispatch)
401 .with_fusion_class(OpFusionClass::Reduce)
402 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
403 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
404
405 pub const MEAN: OperationContract = OperationContract::new(
406 "oa::FnMatrix::mean",
407 0x2c20cf9ff9387418,
408 &[OpValueKind::Matrix],
409 &[OpValueKind::Matrix],
410 )
411 .with_shape_rule(OpShapeRule::Explicit)
412 .with_dtype_rule(OpDTypeRule::MatchInput)
413 .with_differentiation(OpDifferentiation::Reverse)
414 .with_lowering(OpLowering::Dispatch)
415 .with_fusion_class(OpFusionClass::Reduce)
416 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
417 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
418
419 pub const MAX: OperationContract = OperationContract::new(
420 "oa::FnMatrix::max",
421 0xe07ea6a22cf81aa2,
422 &[OpValueKind::Matrix],
423 &[OpValueKind::Matrix],
424 )
425 .with_shape_rule(OpShapeRule::Explicit)
426 .with_dtype_rule(OpDTypeRule::MatchInput)
427 .with_differentiation(OpDifferentiation::Reverse)
428 .with_lowering(OpLowering::Dispatch)
429 .with_fusion_class(OpFusionClass::Reduce)
430 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
431
432 pub const MAX_BACKWARD: OperationContract = OperationContract::new(
433 "oa::matrix::max_backward",
434 0xc2c8d0406cf945ea,
435 &[
436 OpValueKind::Matrix,
437 OpValueKind::Matrix,
438 OpValueKind::Matrix,
439 ],
440 &[OpValueKind::Matrix],
441 )
442 .with_shape_rule(OpShapeRule::Explicit)
443 .with_dtype_rule(OpDTypeRule::MatchInput)
444 .with_differentiation(OpDifferentiation::None)
445 .with_lowering(OpLowering::Dispatch)
446 .with_fusion_class(OpFusionClass::Reduce)
447 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
448
449 pub const ARGMAX: OperationContract = OperationContract::new(
450 "oa::matrix::argmax",
451 0xf6d1cba4fd4071ec,
452 &[OpValueKind::Matrix],
453 &[OpValueKind::Matrix],
454 )
455 .with_shape_rule(OpShapeRule::Explicit)
456 .with_dtype_rule(OpDTypeRule::Explicit)
457 .with_differentiation(OpDifferentiation::None)
458 .with_lowering(OpLowering::Dispatch)
459 .with_fusion_class(OpFusionClass::Reduce)
460 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
461
462 pub const CATEGORICAL_ACCURACY_COUNT: OperationContract = OperationContract::new(
463 "oa::FnMatrix::categoricalAccuracyCount",
464 0xa0781bc439f628a8,
465 &[OpValueKind::Matrix, OpValueKind::Matrix],
466 &[OpValueKind::Matrix],
467 )
468 .with_shape_rule(OpShapeRule::Explicit)
469 .with_dtype_rule(OpDTypeRule::Explicit)
470 .with_differentiation(OpDifferentiation::None)
471 .with_lowering(OpLowering::Dispatch)
472 .with_fusion_class(OpFusionClass::Reduce)
473 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
474
475 pub const MASKED_CATEGORICAL_ACCURACY_COUNT: OperationContract = OperationContract::new(
476 "oa::FnMatrix::maskedCategoricalAccuracyCount",
477 0x39b31bd27e4dce1d,
478 &[
479 OpValueKind::Matrix,
480 OpValueKind::Matrix,
481 OpValueKind::Matrix,
482 ],
483 &[OpValueKind::Matrix],
484 )
485 .with_shape_rule(OpShapeRule::Explicit)
486 .with_dtype_rule(OpDTypeRule::Explicit)
487 .with_differentiation(OpDifferentiation::None)
488 .with_lowering(OpLowering::Dispatch)
489 .with_fusion_class(OpFusionClass::Gather)
490 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
491
492 pub const PHILOX_UNIFORM: OperationContract = OperationContract::new(
493 "oa::FnMatrix::philoxUniform",
494 0x0248c53d3ec118f4,
495 &[OpValueKind::Matrix],
496 &[OpValueKind::Matrix],
497 )
498 .with_shape_rule(OpShapeRule::MatchInput)
499 .with_dtype_rule(OpDTypeRule::MatchInput)
500 .with_differentiation(OpDifferentiation::None)
501 .with_lowering(OpLowering::Dispatch)
502 .with_fusion_class(OpFusionClass::Effect)
503 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
504 .attributes(&[
505 OpAttributeSpec::new("low", OpAttributeKind::Float),
506 OpAttributeSpec::new("high", OpAttributeKind::Float),
507 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
508 ]);
509
510 pub const PHILOX_NORMAL: OperationContract = OperationContract::new(
511 "oa::FnMatrix::philoxNormal",
512 0x0366c23d9029ef65,
513 &[OpValueKind::Matrix],
514 &[OpValueKind::Matrix],
515 )
516 .with_shape_rule(OpShapeRule::MatchInput)
517 .with_dtype_rule(OpDTypeRule::MatchInput)
518 .with_differentiation(OpDifferentiation::None)
519 .with_lowering(OpLowering::Dispatch)
520 .with_fusion_class(OpFusionClass::Reduce)
521 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
522 .attributes(&[
523 OpAttributeSpec::new("mean", OpAttributeKind::Float),
524 OpAttributeSpec::new("stddev", OpAttributeKind::Float),
525 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
526 ]);
527
528 pub const PHILOX_REPLAY_ADVANCE: OperationContract = OperationContract::new(
529 "oa::matrix::philox_replay_advance",
530 0x16e0d26cc7f2a978,
531 &[OpValueKind::Matrix],
532 &[OpValueKind::Matrix],
533 )
534 .with_shape_rule(OpShapeRule::Explicit)
535 .with_dtype_rule(OpDTypeRule::Explicit)
536 .with_differentiation(OpDifferentiation::None)
537 .with_lowering(OpLowering::Dispatch)
538 .with_fusion_class(OpFusionClass::Effect)
539 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
540 .mutated_inputs(0x01)
541 .alias(0, 0);
542
543 pub const DROPOUT: OperationContract = OperationContract::new(
544 "oa::FnMatrix::dropout",
545 0x3958102eb380e479,
546 &[OpValueKind::Matrix],
547 &[OpValueKind::Matrix],
548 )
549 .with_shape_rule(OpShapeRule::MatchInput)
550 .with_dtype_rule(OpDTypeRule::MatchInput)
551 .with_differentiation(OpDifferentiation::Reverse)
552 .with_lowering(OpLowering::Dispatch)
553 .with_fusion_class(OpFusionClass::Effect)
554 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
555 .with_control_flow(OpControlFlow::Conditional)
556 .attributes(&[
557 OpAttributeSpec::new("probability", OpAttributeKind::Float),
558 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
559 ]);
560
561 pub const DROPOUT_BACKWARD: OperationContract = OperationContract::new(
562 "oa::matrix::dropout_backward",
563 0xd8672f9ed03c2c9c,
564 &[OpValueKind::Matrix],
565 &[OpValueKind::Matrix],
566 )
567 .with_shape_rule(OpShapeRule::MatchInput)
568 .with_dtype_rule(OpDTypeRule::MatchInput)
569 .with_differentiation(OpDifferentiation::None)
570 .with_lowering(OpLowering::Dispatch)
571 .with_fusion_class(OpFusionClass::Effect)
572 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
573 .attributes(&[
574 OpAttributeSpec::new("probability", OpAttributeKind::Float),
575 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
576 ]);
577
578 pub const SAMPLE_LOGITS: OperationContract = OperationContract::new(
579 "oa::FnMatrix::sampleLogits",
580 0x3bbc4f6f7f2ffa8d,
581 &[OpValueKind::Matrix],
582 &[OpValueKind::Matrix],
583 )
584 .with_shape_rule(OpShapeRule::Explicit)
585 .with_dtype_rule(OpDTypeRule::Explicit)
586 .with_differentiation(OpDifferentiation::None)
587 .with_lowering(OpLowering::Dispatch)
588 .with_fusion_class(OpFusionClass::Effect)
589 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
590 .with_control_flow(OpControlFlow::Conditional)
591 .attributes(&[
592 OpAttributeSpec::new("temperature", OpAttributeKind::Float),
593 OpAttributeSpec::new("topK", OpAttributeKind::SignedInteger),
594 OpAttributeSpec::new("topP", OpAttributeKind::Float),
595 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
596 ]);
597
598 pub const TOP_K: OperationContract = OperationContract::new(
599 "oa::FnMatrix::topK",
600 0x93793e21044736a8,
601 &[OpValueKind::Matrix],
602 &[OpValueKind::Matrix, OpValueKind::Matrix],
603 )
604 .with_shape_rule(OpShapeRule::Explicit)
605 .with_dtype_rule(OpDTypeRule::Explicit)
606 .with_differentiation(OpDifferentiation::None)
607 .with_lowering(OpLowering::Dispatch)
608 .with_fusion_class(OpFusionClass::Reduce)
609 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
610 .with_control_flow(OpControlFlow::Conditional)
611 .attributes(&[
612 OpAttributeSpec::new("k", OpAttributeKind::SignedInteger),
613 OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger),
614 ]);
615
616 pub const TOP_K_MASK: OperationContract = OperationContract::new(
617 "oa::FnMatrix::topKMask",
618 0xc3326e70e602bec6,
619 &[OpValueKind::Matrix],
620 &[OpValueKind::Matrix],
621 )
622 .with_shape_rule(OpShapeRule::Explicit)
623 .with_dtype_rule(OpDTypeRule::Explicit)
624 .with_differentiation(OpDifferentiation::None)
625 .with_lowering(OpLowering::Dispatch)
626 .with_fusion_class(OpFusionClass::Reduce)
627 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
628 .attributes(&[OpAttributeSpec::new(
629 "numExperts",
630 OpAttributeKind::SignedInteger,
631 )]);
632
633 pub const MOE_EXPERT_PLAN: OperationContract = OperationContract::new(
634 "oa::FnMatrix::moeExpertPlan",
635 0x91e036e9fc58329e,
636 &[OpValueKind::Matrix],
637 &[
638 OpValueKind::Matrix,
639 OpValueKind::Matrix,
640 OpValueKind::Matrix,
641 OpValueKind::Matrix,
642 OpValueKind::Matrix,
643 OpValueKind::Matrix,
644 ],
645 )
646 .with_shape_rule(OpShapeRule::Explicit)
647 .with_dtype_rule(OpDTypeRule::Explicit)
648 .with_differentiation(OpDifferentiation::None)
649 .with_lowering(OpLowering::Dispatch)
650 .with_fusion_class(OpFusionClass::Pointwise)
651 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
652 .attributes(&[OpAttributeSpec::new(
653 "numExperts",
654 OpAttributeKind::SignedInteger,
655 )]);
656
657 pub const MOE_ROUTING_BIAS_UPDATE: OperationContract = OperationContract::new(
658 "oa::matrix::moe_routing_bias_update",
659 0x12dc72174a36cc86,
660 &[OpValueKind::Matrix, OpValueKind::Matrix],
661 &[OpValueKind::Matrix],
662 )
663 .with_shape_rule(OpShapeRule::Explicit)
664 .with_dtype_rule(OpDTypeRule::Explicit)
665 .with_differentiation(OpDifferentiation::None)
666 .with_lowering(OpLowering::Dispatch)
667 .with_fusion_class(OpFusionClass::Effect)
668 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
669 .attributes(&[
670 OpAttributeSpec::new("experts_per_token", OpAttributeKind::SignedInteger),
671 OpAttributeSpec::new("gamma", OpAttributeKind::Float),
672 ])
673 .mutated_inputs(0x02)
674 .alias(0, 1);
675
676 pub const SLICE: OperationContract = OperationContract::new(
677 "oa::FnMatrix::slice",
678 0x7d2d4f73f42bda65,
679 &[OpValueKind::Matrix],
680 &[OpValueKind::Matrix],
681 )
682 .with_shape_rule(OpShapeRule::Explicit)
683 .with_dtype_rule(OpDTypeRule::MatchInput)
684 .with_differentiation(OpDifferentiation::Reverse)
685 .with_lowering(OpLowering::Dispatch)
686 .with_fusion_class(OpFusionClass::Gather)
687 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
688 .attributes(&[
689 OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger),
690 OpAttributeSpec::new("start", OpAttributeKind::SignedInteger),
691 OpAttributeSpec::new("end", OpAttributeKind::SignedInteger),
692 ]);
693
694 pub const SLICE_BACKWARD: OperationContract = OperationContract::new(
695 "oa::matrix::slice_backward",
696 0x899e93a893422910,
697 &[OpValueKind::Matrix],
698 &[OpValueKind::Matrix],
699 )
700 .with_shape_rule(OpShapeRule::Explicit)
701 .with_dtype_rule(OpDTypeRule::MatchInput)
702 .with_differentiation(OpDifferentiation::None)
703 .with_lowering(OpLowering::Dispatch)
704 .with_fusion_class(OpFusionClass::Gather)
705 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
706 .attributes(&[
707 OpAttributeSpec::new("input_shape", OpAttributeKind::Shape),
708 OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger),
709 OpAttributeSpec::new("start", OpAttributeKind::SignedInteger),
710 OpAttributeSpec::new("end", OpAttributeKind::SignedInteger),
711 ]);
712
713 pub const PAD: OperationContract = OperationContract::new(
714 "oa::matrix::pad",
715 0xa230e8355b39a336,
716 &[OpValueKind::Matrix],
717 &[OpValueKind::Matrix],
718 )
719 .with_shape_rule(OpShapeRule::Explicit)
720 .with_dtype_rule(OpDTypeRule::MatchInput)
721 .with_differentiation(OpDifferentiation::Reverse)
722 .with_lowering(OpLowering::Dispatch)
723 .with_fusion_class(OpFusionClass::Gather)
724 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
725 .attributes(&[
726 OpAttributeSpec::new("pads", OpAttributeKind::Shape),
727 OpAttributeSpec::new("mode", OpAttributeKind::UnsignedInteger),
728 OpAttributeSpec::new("fill", OpAttributeKind::Float),
729 ]);
730
731 pub const PAD_BACKWARD: OperationContract = OperationContract::new(
732 "oa::matrix::pad_backward",
733 0x085aed5943d4c786,
734 &[OpValueKind::Matrix],
735 &[OpValueKind::Matrix],
736 )
737 .with_shape_rule(OpShapeRule::Explicit)
738 .with_dtype_rule(OpDTypeRule::MatchInput)
739 .with_differentiation(OpDifferentiation::None)
740 .with_lowering(OpLowering::Dispatch)
741 .with_fusion_class(OpFusionClass::Gather)
742 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
743 .attributes(&[
744 OpAttributeSpec::new("input_shape", OpAttributeKind::Shape),
745 OpAttributeSpec::new("pads", OpAttributeKind::Shape),
746 OpAttributeSpec::new("mode", OpAttributeKind::UnsignedInteger),
747 ]);
748
749 pub const REPEAT_INTERLEAVE: OperationContract = OperationContract::new(
750 "oa::FnMatrix::repeatInterleave",
751 0x38ff9eff40739b27,
752 &[OpValueKind::Matrix],
753 &[OpValueKind::Matrix],
754 )
755 .with_shape_rule(OpShapeRule::Explicit)
756 .with_dtype_rule(OpDTypeRule::MatchInput)
757 .with_differentiation(OpDifferentiation::Reverse)
758 .with_lowering(OpLowering::Dispatch)
759 .with_fusion_class(OpFusionClass::Gather)
760 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
761 .attributes(&[
762 OpAttributeSpec::new("repeats", OpAttributeKind::SignedInteger),
763 OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger),
764 ]);
765
766 pub const REPEAT_INTERLEAVE_BACKWARD: OperationContract = OperationContract::new(
767 "oa::matrix::repeat_interleave_backward",
768 0x4e22e67d4018f048,
769 &[OpValueKind::Matrix],
770 &[OpValueKind::Matrix],
771 )
772 .with_shape_rule(OpShapeRule::Explicit)
773 .with_dtype_rule(OpDTypeRule::MatchInput)
774 .with_differentiation(OpDifferentiation::None)
775 .with_lowering(OpLowering::Dispatch)
776 .with_fusion_class(OpFusionClass::Gather)
777 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
778 .attributes(&[
779 OpAttributeSpec::new("input_shape", OpAttributeKind::Shape),
780 OpAttributeSpec::new("repeats", OpAttributeKind::SignedInteger),
781 OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger),
782 ]);
783
784 pub const GATHER: OperationContract = OperationContract::new(
785 "oa::FnMatrix::gather",
786 0xa57c49c29d5a76ea,
787 &[OpValueKind::Matrix, OpValueKind::Matrix],
788 &[OpValueKind::Matrix],
789 )
790 .with_shape_rule(OpShapeRule::Explicit)
791 .with_dtype_rule(OpDTypeRule::MatchInput)
792 .with_differentiation(OpDifferentiation::Reverse)
793 .with_lowering(OpLowering::Dispatch)
794 .with_fusion_class(OpFusionClass::Gather)
795 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
796
797 pub const GATHER_BACKWARD: OperationContract = OperationContract::new(
798 "oa::matrix::gather_backward",
799 0x5eeb74cc99a0c248,
800 &[OpValueKind::Matrix, OpValueKind::Matrix],
801 &[OpValueKind::Matrix],
802 )
803 .with_shape_rule(OpShapeRule::Explicit)
804 .with_dtype_rule(OpDTypeRule::Explicit)
805 .with_differentiation(OpDifferentiation::None)
806 .with_lowering(OpLowering::Dispatch)
807 .with_fusion_class(OpFusionClass::Gather)
808 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
809 .attributes(&[OpAttributeSpec::new("input_shape", OpAttributeKind::Shape)]);
810
811 pub const GATHER_LAST_DIM: OperationContract = OperationContract::new(
812 "oa::FnMatrix::gatherLastDim",
813 0x842ae739cff848e7,
814 &[OpValueKind::Matrix, OpValueKind::Matrix],
815 &[OpValueKind::Matrix],
816 )
817 .with_shape_rule(OpShapeRule::Explicit)
818 .with_dtype_rule(OpDTypeRule::MatchInput)
819 .with_differentiation(OpDifferentiation::Reverse)
820 .with_lowering(OpLowering::Dispatch)
821 .with_fusion_class(OpFusionClass::Reduce)
822 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
823
824 pub const GATHER_LAST_DIM_BACKWARD: OperationContract = OperationContract::new(
825 "oa::matrix::gather_last_dim_backward",
826 0x88e091196ef1c67f,
827 &[OpValueKind::Matrix, OpValueKind::Matrix],
828 &[OpValueKind::Matrix],
829 )
830 .with_shape_rule(OpShapeRule::Explicit)
831 .with_dtype_rule(OpDTypeRule::Explicit)
832 .with_differentiation(OpDifferentiation::None)
833 .with_lowering(OpLowering::Dispatch)
834 .with_fusion_class(OpFusionClass::Reduce)
835 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
836 .attributes(&[OpAttributeSpec::new(
837 "input_width",
838 OpAttributeKind::SignedInteger,
839 )]);
840
841 pub const CONCAT: OperationContract = OperationContract::new(
842 "oa::FnMatrix::concat",
843 0xbe61d4c206671ab2,
844 &[],
845 &[OpValueKind::Matrix],
846 )
847 .variadic_inputs(OpValueKind::Matrix, 1)
848 .with_shape_rule(OpShapeRule::Explicit)
849 .with_dtype_rule(OpDTypeRule::MatchInput)
850 .with_differentiation(OpDifferentiation::Reverse)
851 .with_lowering(OpLowering::Dispatch)
852 .with_fusion_class(OpFusionClass::Gather)
853 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
854 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
855
856 pub const TRANSPOSE: OperationContract = OperationContract::new(
857 "oa::FnMatrix::transpose",
858 0xebc1236cc3148055,
859 &[OpValueKind::Matrix],
860 &[OpValueKind::Matrix],
861 )
862 .with_shape_rule(OpShapeRule::Explicit)
863 .with_dtype_rule(OpDTypeRule::MatchInput)
864 .with_differentiation(OpDifferentiation::Reverse)
865 .with_lowering(OpLowering::Dispatch)
866 .with_fusion_class(OpFusionClass::Gather)
867 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
868 .attributes(&[
869 OpAttributeSpec::new("dim0", OpAttributeKind::SignedInteger),
870 OpAttributeSpec::new("dim1", OpAttributeKind::SignedInteger),
871 ]);
872
873 pub const EQUAL: OperationContract = OperationContract::new(
874 "oa::FnMatrix::equal",
875 0x56cec835fafe3bbc,
876 &[OpValueKind::Matrix],
877 &[OpValueKind::Matrix],
878 )
879 .with_shape_rule(OpShapeRule::MatchInput)
880 .with_dtype_rule(OpDTypeRule::Explicit)
881 .with_differentiation(OpDifferentiation::None)
882 .with_lowering(OpLowering::Dispatch)
883 .with_fusion_class(OpFusionClass::Pointwise)
884 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
885 .attributes(&[OpAttributeSpec::new("value", OpAttributeKind::Float)]);
886
887 pub const CAUSAL_MASK: OperationContract = OperationContract::new(
888 "oa::FnMatrix::causalMask",
889 0x0288e2fe1c3d6f7b,
890 &[OpValueKind::Matrix],
891 &[OpValueKind::Matrix],
892 )
893 .with_shape_rule(OpShapeRule::MatchInput)
894 .with_dtype_rule(OpDTypeRule::MatchInput)
895 .with_differentiation(OpDifferentiation::Reverse)
896 .with_lowering(OpLowering::Dispatch)
897 .with_fusion_class(OpFusionClass::Attention)
898 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
899
900 pub const CAUSAL_MASK_BACKWARD: OperationContract = OperationContract::new(
901 "oa::FnMatrix::causalMaskBwd",
902 0x9dd451de17799ce9,
903 &[OpValueKind::Matrix],
904 &[OpValueKind::Matrix],
905 )
906 .with_shape_rule(OpShapeRule::MatchInput)
907 .with_dtype_rule(OpDTypeRule::MatchInput)
908 .with_differentiation(OpDifferentiation::None)
909 .with_lowering(OpLowering::Dispatch)
910 .with_fusion_class(OpFusionClass::Attention)
911 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
912
913 pub const GREATER_EQUAL: OperationContract = OperationContract::new(
914 "oa::FnMatrix::greaterEqual",
915 0xdaf5db72737d2c48,
916 &[OpValueKind::Matrix],
917 &[OpValueKind::Matrix],
918 )
919 .with_shape_rule(OpShapeRule::MatchInput)
920 .with_dtype_rule(OpDTypeRule::Explicit)
921 .with_differentiation(OpDifferentiation::None)
922 .with_lowering(OpLowering::Dispatch)
923 .with_fusion_class(OpFusionClass::Pointwise)
924 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
925 .attributes(&[OpAttributeSpec::new("value", OpAttributeKind::Float)]);
926
927 pub const SPLIT: OperationContract = OperationContract::new(
928 "oa::FnMatrix::split",
929 0x2018054bb5b3d8e2,
930 &[OpValueKind::Matrix],
931 &[],
932 )
933 .variadic_outputs(OpValueKind::Matrix, 1)
934 .with_shape_rule(OpShapeRule::Explicit)
935 .with_dtype_rule(OpDTypeRule::MatchInput)
936 .with_differentiation(OpDifferentiation::Reverse)
937 .with_lowering(OpLowering::Dispatch)
938 .with_fusion_class(OpFusionClass::Gather)
939 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
940 .attributes(&[OpAttributeSpec::new("dim", OpAttributeKind::SignedInteger)]);
941
942 pub const COMPACT_ROWS: OperationContract = OperationContract::new(
943 "oa::FnMatrix::compactRows",
944 0xeee49eb4d585f2b0,
945 &[OpValueKind::Matrix, OpValueKind::Matrix],
946 &[
947 OpValueKind::Matrix,
948 OpValueKind::Matrix,
949 OpValueKind::Matrix,
950 OpValueKind::Matrix,
951 ],
952 )
953 .with_shape_rule(OpShapeRule::Explicit)
954 .with_dtype_rule(OpDTypeRule::Explicit)
955 .with_differentiation(OpDifferentiation::Reverse)
956 .with_lowering(OpLowering::Dispatch)
957 .with_fusion_class(OpFusionClass::Gather)
958 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
959
960 pub const COMPACT_ROWS_BACKWARD: OperationContract = OperationContract::new(
961 "oa::FnMatrix::compactRowsBwd",
962 0xe92c574212f13ff0,
963 &[
964 OpValueKind::Matrix,
965 OpValueKind::Matrix,
966 OpValueKind::Matrix,
967 OpValueKind::Matrix,
968 ],
969 &[OpValueKind::Matrix],
970 )
971 .with_shape_rule(OpShapeRule::Explicit)
972 .with_dtype_rule(OpDTypeRule::MatchInput)
973 .with_differentiation(OpDifferentiation::None)
974 .with_lowering(OpLowering::Dispatch)
975 .with_fusion_class(OpFusionClass::Gather)
976 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
977 .with_control_flow(OpControlFlow::Conditional)
978 .attributes(&[OpAttributeSpec::new("inputShape", OpAttributeKind::Shape)])
979 .optional_inputs(0x08);
980
981 pub const SCATTER_ROWS: OperationContract = OperationContract::new(
982 "oa::FnMatrix::scatterRows",
983 0x3728208e79db6edc,
984 &[
985 OpValueKind::Matrix,
986 OpValueKind::Matrix,
987 OpValueKind::Matrix,
988 OpValueKind::Matrix,
989 OpValueKind::Matrix,
990 ],
991 &[OpValueKind::Matrix],
992 )
993 .with_shape_rule(OpShapeRule::Explicit)
994 .with_dtype_rule(OpDTypeRule::MatchInput)
995 .with_differentiation(OpDifferentiation::Reverse)
996 .with_lowering(OpLowering::Dispatch)
997 .with_fusion_class(OpFusionClass::Gather)
998 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
999 .with_control_flow(OpControlFlow::Conditional)
1000 .optional_inputs(0x10);
1001
1002 pub const SCATTER_ROWS_BACKWARD_SOURCE: OperationContract = OperationContract::new(
1003 "oa::FnMatrix::scatterRowsBwdSource",
1004 0x4a3f4202abc8226c,
1005 &[
1006 OpValueKind::Matrix,
1007 OpValueKind::Matrix,
1008 OpValueKind::Matrix,
1009 OpValueKind::Matrix,
1010 ],
1011 &[OpValueKind::Matrix],
1012 )
1013 .with_shape_rule(OpShapeRule::MatchInput)
1014 .with_dtype_rule(OpDTypeRule::MatchInput)
1015 .with_differentiation(OpDifferentiation::None)
1016 .with_lowering(OpLowering::Dispatch)
1017 .with_fusion_class(OpFusionClass::Gather)
1018 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1019 .with_control_flow(OpControlFlow::Conditional)
1020 .optional_inputs(0x08);
1021
1022 pub const CAST_F32_I32: OperationContract = OperationContract::new(
1023 "oa::matrix::cast_f32_i32",
1024 0xc1fa6c9e17122a31,
1025 &[OpValueKind::Matrix],
1026 &[OpValueKind::Matrix],
1027 )
1028 .with_shape_rule(OpShapeRule::MatchInput)
1029 .with_dtype_rule(OpDTypeRule::Explicit)
1030 .with_differentiation(OpDifferentiation::None)
1031 .with_lowering(OpLowering::Dispatch)
1032 .with_fusion_class(OpFusionClass::Pointwise)
1033 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1034
1035 pub const CAST_I32_F32: OperationContract = OperationContract::new(
1036 "oa::matrix::cast_i32_f32",
1037 0x5853a46a91848be0,
1038 &[OpValueKind::Matrix],
1039 &[OpValueKind::Matrix],
1040 )
1041 .with_shape_rule(OpShapeRule::MatchInput)
1042 .with_dtype_rule(OpDTypeRule::Explicit)
1043 .with_differentiation(OpDifferentiation::None)
1044 .with_lowering(OpLowering::Dispatch)
1045 .with_fusion_class(OpFusionClass::Pointwise)
1046 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1047}
1048
1049pub mod ml {
1051 use super::*;
1052
1053 pub const PPO_CLIPPED_POLICY: OperationContract = OperationContract::new(
1054 "oa::FnLoss::ppoClippedPolicy",
1055 0x78e8055ee5d49508,
1056 &[
1057 OpValueKind::Matrix,
1058 OpValueKind::Matrix,
1059 OpValueKind::Matrix,
1060 ],
1061 &[OpValueKind::Matrix],
1062 )
1063 .with_shape_rule(OpShapeRule::Explicit)
1064 .with_dtype_rule(OpDTypeRule::Explicit)
1065 .with_differentiation(OpDifferentiation::Reverse)
1066 .with_lowering(OpLowering::Dispatch)
1067 .with_fusion_class(OpFusionClass::Pointwise)
1068 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1069 .attributes(&[OpAttributeSpec::new("clipEpsilon", OpAttributeKind::Float)]);
1070
1071 pub const PPO_CLIPPED_POLICY_BACKWARD: OperationContract = OperationContract::new(
1072 "oa::ml::loss::ppo_clipped_policy_backward",
1073 0xc006aad6cf7d1203,
1074 &[
1075 OpValueKind::Matrix,
1076 OpValueKind::Matrix,
1077 OpValueKind::Matrix,
1078 ],
1079 &[OpValueKind::Matrix],
1080 )
1081 .with_shape_rule(OpShapeRule::Explicit)
1082 .with_dtype_rule(OpDTypeRule::MatchInput)
1083 .with_differentiation(OpDifferentiation::None)
1084 .with_lowering(OpLowering::Dispatch)
1085 .with_fusion_class(OpFusionClass::Pointwise)
1086 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1087 .attributes(&[OpAttributeSpec::new("clip_epsilon", OpAttributeKind::Float)]);
1088
1089 pub const LINEAR: OperationContract = OperationContract::new(
1090 "oa::FnMatrix::linear",
1091 0x8c33809a0e55807d,
1092 &[
1093 OpValueKind::Matrix,
1094 OpValueKind::Matrix,
1095 OpValueKind::Matrix,
1096 ],
1097 &[OpValueKind::Matrix],
1098 )
1099 .with_shape_rule(OpShapeRule::Explicit)
1100 .with_dtype_rule(OpDTypeRule::MatchInput)
1101 .with_differentiation(OpDifferentiation::Reverse)
1102 .with_lowering(OpLowering::Gemm)
1103 .with_fusion_class(OpFusionClass::Gemm)
1104 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1105 .optional_inputs(0x04);
1106
1107 pub const LINEAR_BACKWARD: OperationContract = OperationContract::new(
1108 "oa::ml::matrix::linear_backward",
1109 0x68c46e426d56785c,
1110 &[OpValueKind::Matrix, OpValueKind::Matrix],
1111 &[OpValueKind::Matrix],
1112 )
1113 .with_shape_rule(OpShapeRule::Explicit)
1114 .with_dtype_rule(OpDTypeRule::MatchInput)
1115 .with_differentiation(OpDifferentiation::None)
1116 .with_lowering(OpLowering::Dispatch)
1117 .with_fusion_class(OpFusionClass::Gemm)
1118 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1119
1120 pub const LINEAR_PARAMETER_BACKWARD: OperationContract = OperationContract::new(
1121 "oa::ml::matrix::linear_parameter_backward",
1122 0xfb4acaa7b9c18818,
1123 &[OpValueKind::Matrix, OpValueKind::Matrix],
1124 &[OpValueKind::Matrix, OpValueKind::Matrix],
1125 )
1126 .with_shape_rule(OpShapeRule::Explicit)
1127 .with_dtype_rule(OpDTypeRule::MatchInput)
1128 .with_differentiation(OpDifferentiation::None)
1129 .with_lowering(OpLowering::Dispatch)
1130 .with_fusion_class(OpFusionClass::Gemm)
1131 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1132
1133 pub const CROSS_ENTROPY: OperationContract = OperationContract::new(
1134 "oa::FnLoss::crossEntropy",
1135 0xa04a65e53238b471,
1136 &[OpValueKind::Matrix, OpValueKind::Matrix],
1137 &[OpValueKind::Matrix],
1138 )
1139 .with_shape_rule(OpShapeRule::Explicit)
1140 .with_dtype_rule(OpDTypeRule::PromoteFloat)
1141 .with_differentiation(OpDifferentiation::Reverse)
1142 .with_lowering(OpLowering::Dispatch)
1143 .with_fusion_class(OpFusionClass::Reduce)
1144 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1145
1146 pub const CROSS_ENTROPY_BACKWARD: OperationContract = OperationContract::new(
1147 "oa::ml::loss::cross_entropy_backward",
1148 0x2de515dc32a7fdc4,
1149 &[OpValueKind::Matrix, OpValueKind::Matrix],
1150 &[OpValueKind::Matrix],
1151 )
1152 .with_shape_rule(OpShapeRule::Explicit)
1153 .with_dtype_rule(OpDTypeRule::Explicit)
1154 .with_differentiation(OpDifferentiation::None)
1155 .with_lowering(OpLowering::Dispatch)
1156 .with_fusion_class(OpFusionClass::Reduce)
1157 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1158
1159 pub const MASKED_CROSS_ENTROPY: OperationContract = OperationContract::new(
1160 "oa::FnLoss::maskedCrossEntropy",
1161 0x1ad7ae89fcbd6bed,
1162 &[
1163 OpValueKind::Matrix,
1164 OpValueKind::Matrix,
1165 OpValueKind::Matrix,
1166 ],
1167 &[OpValueKind::Matrix],
1168 )
1169 .with_shape_rule(OpShapeRule::Explicit)
1170 .with_dtype_rule(OpDTypeRule::Explicit)
1171 .with_differentiation(OpDifferentiation::Reverse)
1172 .with_lowering(OpLowering::Dispatch)
1173 .with_fusion_class(OpFusionClass::Reduce)
1174 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1175 .attributes(&[OpAttributeSpec::new(
1176 "validCount",
1177 OpAttributeKind::SignedInteger,
1178 )]);
1179
1180 pub const MASKED_CROSS_ENTROPY_BACKWARD: OperationContract = OperationContract::new(
1181 "oa::ml::loss::masked_cross_entropy_backward",
1182 0x839076ab7eb44e64,
1183 &[
1184 OpValueKind::Matrix,
1185 OpValueKind::Matrix,
1186 OpValueKind::Matrix,
1187 ],
1188 &[OpValueKind::Matrix],
1189 )
1190 .with_shape_rule(OpShapeRule::Explicit)
1191 .with_dtype_rule(OpDTypeRule::Explicit)
1192 .with_differentiation(OpDifferentiation::None)
1193 .with_lowering(OpLowering::Dispatch)
1194 .with_fusion_class(OpFusionClass::Reduce)
1195 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1196 .attributes(&[OpAttributeSpec::new(
1197 "valid_count",
1198 OpAttributeKind::SignedInteger,
1199 )]);
1200
1201 pub const SMOOTH_L1: OperationContract = OperationContract::new(
1202 "oa::FnLoss::smoothL1",
1203 0x56ccb90430e222b5,
1204 &[OpValueKind::Matrix, OpValueKind::Matrix],
1205 &[OpValueKind::Matrix],
1206 )
1207 .with_shape_rule(OpShapeRule::Explicit)
1208 .with_dtype_rule(OpDTypeRule::MatchInput)
1209 .with_differentiation(OpDifferentiation::Reverse)
1210 .with_lowering(OpLowering::Dispatch)
1211 .with_fusion_class(OpFusionClass::Pointwise)
1212 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1213
1214 pub const SMOOTH_L1_BACKWARD: OperationContract = OperationContract::new(
1215 "oa::ml::loss::smooth_l1_backward",
1216 0xa1d3c9ca79d2e7f1,
1217 &[OpValueKind::Matrix, OpValueKind::Matrix],
1218 &[OpValueKind::Matrix],
1219 )
1220 .with_shape_rule(OpShapeRule::Explicit)
1221 .with_dtype_rule(OpDTypeRule::MatchInput)
1222 .with_differentiation(OpDifferentiation::None)
1223 .with_lowering(OpLowering::Dispatch)
1224 .with_fusion_class(OpFusionClass::Pointwise)
1225 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1226
1227 pub const MSE: OperationContract = OperationContract::new(
1228 "oa::FnLoss::mse",
1229 0x3625518b38867a7d,
1230 &[OpValueKind::Matrix, OpValueKind::Matrix],
1231 &[OpValueKind::Matrix],
1232 )
1233 .with_shape_rule(OpShapeRule::Explicit)
1234 .with_dtype_rule(OpDTypeRule::MatchInput)
1235 .with_differentiation(OpDifferentiation::Reverse)
1236 .with_lowering(OpLowering::Dispatch)
1237 .with_fusion_class(OpFusionClass::Pointwise)
1238 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1239
1240 pub const MSE_BACKWARD: OperationContract = OperationContract::new(
1241 "oa::ml::loss::mse_backward",
1242 0x71002c6dbc659be1,
1243 &[OpValueKind::Matrix, OpValueKind::Matrix],
1244 &[OpValueKind::Matrix],
1245 )
1246 .with_shape_rule(OpShapeRule::Explicit)
1247 .with_dtype_rule(OpDTypeRule::MatchInput)
1248 .with_differentiation(OpDifferentiation::None)
1249 .with_lowering(OpLowering::Dispatch)
1250 .with_fusion_class(OpFusionClass::Pointwise)
1251 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1252
1253 pub const L1: OperationContract = OperationContract::new(
1254 "oa::FnLoss::l1",
1255 0x97d1e71dd255b22b,
1256 &[OpValueKind::Matrix, OpValueKind::Matrix],
1257 &[OpValueKind::Matrix],
1258 )
1259 .with_shape_rule(OpShapeRule::Explicit)
1260 .with_dtype_rule(OpDTypeRule::MatchInput)
1261 .with_differentiation(OpDifferentiation::Reverse)
1262 .with_lowering(OpLowering::Dispatch)
1263 .with_fusion_class(OpFusionClass::Pointwise)
1264 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1265
1266 pub const L1_BACKWARD: OperationContract = OperationContract::new(
1267 "oa::ml::loss::l1_backward",
1268 0x7fd6b462f62ff52c,
1269 &[OpValueKind::Matrix, OpValueKind::Matrix],
1270 &[OpValueKind::Matrix],
1271 )
1272 .with_shape_rule(OpShapeRule::Explicit)
1273 .with_dtype_rule(OpDTypeRule::MatchInput)
1274 .with_differentiation(OpDifferentiation::None)
1275 .with_lowering(OpLowering::Dispatch)
1276 .with_fusion_class(OpFusionClass::Pointwise)
1277 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1278
1279 pub const BCE: OperationContract = OperationContract::new(
1280 "oa::FnLoss::bce",
1281 0x0e39027101da1c42,
1282 &[OpValueKind::Matrix, OpValueKind::Matrix],
1283 &[OpValueKind::Matrix],
1284 )
1285 .with_shape_rule(OpShapeRule::Explicit)
1286 .with_dtype_rule(OpDTypeRule::MatchInput)
1287 .with_differentiation(OpDifferentiation::Reverse)
1288 .with_lowering(OpLowering::Dispatch)
1289 .with_fusion_class(OpFusionClass::Pointwise)
1290 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1291
1292 pub const BCE_BACKWARD: OperationContract = OperationContract::new(
1293 "oa::ml::loss::bce_backward",
1294 0x00dbf8de4c541c46,
1295 &[OpValueKind::Matrix, OpValueKind::Matrix],
1296 &[OpValueKind::Matrix],
1297 )
1298 .with_shape_rule(OpShapeRule::Explicit)
1299 .with_dtype_rule(OpDTypeRule::MatchInput)
1300 .with_differentiation(OpDifferentiation::None)
1301 .with_lowering(OpLowering::Dispatch)
1302 .with_fusion_class(OpFusionClass::Pointwise)
1303 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1304
1305 pub const SGD: OperationContract = OperationContract::new(
1306 "oa::ml::optim::sgd",
1307 0x744d119d59f06680,
1308 &[OpValueKind::Matrix, OpValueKind::Matrix],
1309 &[OpValueKind::Matrix],
1310 )
1311 .with_shape_rule(OpShapeRule::Explicit)
1312 .with_dtype_rule(OpDTypeRule::MatchInput)
1313 .with_differentiation(OpDifferentiation::None)
1314 .with_lowering(OpLowering::Dispatch)
1315 .with_fusion_class(OpFusionClass::Effect)
1316 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1317 .attributes(&[
1318 OpAttributeSpec::new("learning_rate", OpAttributeKind::Float),
1319 OpAttributeSpec::new("weight_decay", OpAttributeKind::Float),
1320 ])
1321 .mutated_inputs(0x01)
1322 .alias(0, 0);
1323
1324 pub const CLIP_GRAD_NORM: OperationContract = OperationContract::new(
1325 "oa::ml::optim::clip_grad_norm",
1326 0x7058f3f2b1c2e4d7,
1327 &[],
1328 &[],
1329 )
1330 .variadic_inputs(OpValueKind::Matrix, 1)
1331 .variadic_outputs(OpValueKind::Matrix, 1)
1332 .aligned_variadic_aliases()
1333 .with_shape_rule(OpShapeRule::Explicit)
1334 .with_dtype_rule(OpDTypeRule::MatchInput)
1335 .with_differentiation(OpDifferentiation::None)
1336 .with_lowering(OpLowering::Dispatch)
1337 .with_fusion_class(OpFusionClass::Reduce)
1338 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1339 .attributes(&[OpAttributeSpec::new("max_norm", OpAttributeKind::Float)]);
1340
1341 pub const SGD_MOMENTUM: OperationContract = OperationContract::new(
1342 "oa::ml::optim::sgd_momentum",
1343 0x8b1f27ad74ae2780,
1344 &[
1345 OpValueKind::Matrix,
1346 OpValueKind::Matrix,
1347 OpValueKind::Matrix,
1348 ],
1349 &[OpValueKind::Matrix, OpValueKind::Matrix],
1350 )
1351 .with_shape_rule(OpShapeRule::Explicit)
1352 .with_dtype_rule(OpDTypeRule::MatchInput)
1353 .with_differentiation(OpDifferentiation::None)
1354 .with_lowering(OpLowering::Dispatch)
1355 .with_fusion_class(OpFusionClass::Effect)
1356 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1357 .attributes(&[
1358 OpAttributeSpec::new("learning_rate", OpAttributeKind::Float),
1359 OpAttributeSpec::new("momentum", OpAttributeKind::Float),
1360 OpAttributeSpec::new("weight_decay", OpAttributeKind::Float),
1361 ])
1362 .mutated_inputs(0x05)
1363 .alias(0, 0)
1364 .alias(1, 2);
1365
1366 pub const ADAM: OperationContract = OperationContract::new(
1367 "oa::ml::optim::adam",
1368 0x04dd9ffeca937f61,
1369 &[
1370 OpValueKind::Matrix,
1371 OpValueKind::Matrix,
1372 OpValueKind::Matrix,
1373 OpValueKind::Matrix,
1374 ],
1375 &[
1376 OpValueKind::Matrix,
1377 OpValueKind::Matrix,
1378 OpValueKind::Matrix,
1379 ],
1380 )
1381 .with_shape_rule(OpShapeRule::Explicit)
1382 .with_dtype_rule(OpDTypeRule::MatchInput)
1383 .with_differentiation(OpDifferentiation::None)
1384 .with_lowering(OpLowering::Dispatch)
1385 .with_fusion_class(OpFusionClass::Effect)
1386 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1387 .attributes(&[
1388 OpAttributeSpec::new("step", OpAttributeKind::UnsignedInteger),
1389 OpAttributeSpec::new("learning_rate", OpAttributeKind::Float),
1390 OpAttributeSpec::new("beta1", OpAttributeKind::Float),
1391 OpAttributeSpec::new("beta2", OpAttributeKind::Float),
1392 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
1393 ])
1394 .mutated_inputs(0x0d)
1395 .alias(0, 0)
1396 .alias(1, 2)
1397 .alias(2, 3);
1398
1399 pub const MUON: OperationContract = OperationContract::new(
1400 "oa::ml::optim::muon",
1401 0x5488c11dff7f689c,
1402 &[
1403 OpValueKind::Matrix,
1404 OpValueKind::Matrix,
1405 OpValueKind::Matrix,
1406 ],
1407 &[OpValueKind::Matrix, OpValueKind::Matrix],
1408 )
1409 .with_shape_rule(OpShapeRule::Explicit)
1410 .with_dtype_rule(OpDTypeRule::MatchInput)
1411 .with_differentiation(OpDifferentiation::None)
1412 .with_lowering(OpLowering::Dispatch)
1413 .with_fusion_class(OpFusionClass::Effect)
1414 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1415 .attributes(&[
1416 OpAttributeSpec::new("learning_rate", OpAttributeKind::Float),
1417 OpAttributeSpec::new("beta", OpAttributeKind::Float),
1418 OpAttributeSpec::new("weight_decay", OpAttributeKind::Float),
1419 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
1420 OpAttributeSpec::new("ns5_iterations", OpAttributeKind::UnsignedInteger),
1421 ])
1422 .mutated_inputs(0x05)
1423 .alias(0, 0)
1424 .alias(1, 2);
1425
1426 pub const ADAMW: OperationContract = OperationContract::new(
1427 "oa::ml::optim::adamw",
1428 0x12bb830b532ec935,
1429 &[
1430 OpValueKind::Matrix,
1431 OpValueKind::Matrix,
1432 OpValueKind::Matrix,
1433 OpValueKind::Matrix,
1434 ],
1435 &[
1436 OpValueKind::Matrix,
1437 OpValueKind::Matrix,
1438 OpValueKind::Matrix,
1439 ],
1440 )
1441 .with_shape_rule(OpShapeRule::Explicit)
1442 .with_dtype_rule(OpDTypeRule::MatchInput)
1443 .with_differentiation(OpDifferentiation::None)
1444 .with_lowering(OpLowering::Dispatch)
1445 .with_fusion_class(OpFusionClass::Effect)
1446 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1447 .attributes(&[
1448 OpAttributeSpec::new("step", OpAttributeKind::UnsignedInteger),
1449 OpAttributeSpec::new("learning_rate", OpAttributeKind::Float),
1450 OpAttributeSpec::new("beta1", OpAttributeKind::Float),
1451 OpAttributeSpec::new("beta2", OpAttributeKind::Float),
1452 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
1453 OpAttributeSpec::new("weight_decay", OpAttributeKind::Float),
1454 ])
1455 .mutated_inputs(0x0d)
1456 .alias(0, 0)
1457 .alias(1, 2)
1458 .alias(2, 3);
1459
1460 pub const ADAMW_GRAPH_ADVANCE: OperationContract = OperationContract::new(
1461 "oa::ml::optim::adamw_graph_advance",
1462 0x703e26fce7552b88,
1463 &[OpValueKind::Matrix],
1464 &[OpValueKind::Matrix],
1465 )
1466 .with_shape_rule(OpShapeRule::Explicit)
1467 .with_dtype_rule(OpDTypeRule::Explicit)
1468 .with_differentiation(OpDifferentiation::None)
1469 .with_lowering(OpLowering::Dispatch)
1470 .with_fusion_class(OpFusionClass::Effect)
1471 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1472 .mutated_inputs(0x01)
1473 .alias(0, 0);
1474
1475 pub const ADAMW_GRAPH: OperationContract = OperationContract::new(
1476 "oa::ml::optim::adamw_graph",
1477 0xa3c9ccbb3ad37339,
1478 &[
1479 OpValueKind::Matrix,
1480 OpValueKind::Matrix,
1481 OpValueKind::Matrix,
1482 OpValueKind::Matrix,
1483 OpValueKind::Matrix,
1484 ],
1485 &[
1486 OpValueKind::Matrix,
1487 OpValueKind::Matrix,
1488 OpValueKind::Matrix,
1489 ],
1490 )
1491 .with_shape_rule(OpShapeRule::Explicit)
1492 .with_dtype_rule(OpDTypeRule::Explicit)
1493 .with_differentiation(OpDifferentiation::None)
1494 .with_lowering(OpLowering::Dispatch)
1495 .with_fusion_class(OpFusionClass::Effect)
1496 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1497 .mutated_inputs(0x0d)
1498 .alias(0, 0)
1499 .alias(1, 2)
1500 .alias(2, 3);
1501
1502 pub const ADAMW_GATED_GRAPH_ADVANCE: OperationContract = OperationContract::new(
1503 "oa::ml::optim::adamw_gated_graph_advance",
1504 0xe2090b8caa755438,
1505 &[OpValueKind::Matrix, OpValueKind::Matrix],
1506 &[OpValueKind::Matrix],
1507 )
1508 .with_shape_rule(OpShapeRule::Explicit)
1509 .with_dtype_rule(OpDTypeRule::Explicit)
1510 .with_differentiation(OpDifferentiation::None)
1511 .with_lowering(OpLowering::Dispatch)
1512 .with_fusion_class(OpFusionClass::Effect)
1513 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1514 .mutated_inputs(0x01)
1515 .alias(0, 0);
1516
1517 pub const ADAMW_GATED_GRAPH: OperationContract = OperationContract::new(
1518 "oa::ml::optim::adamw_gated_graph",
1519 0x97de0df5d8804c3a,
1520 &[
1521 OpValueKind::Matrix,
1522 OpValueKind::Matrix,
1523 OpValueKind::Matrix,
1524 OpValueKind::Matrix,
1525 OpValueKind::Matrix,
1526 OpValueKind::Matrix,
1527 ],
1528 &[
1529 OpValueKind::Matrix,
1530 OpValueKind::Matrix,
1531 OpValueKind::Matrix,
1532 ],
1533 )
1534 .with_shape_rule(OpShapeRule::Explicit)
1535 .with_dtype_rule(OpDTypeRule::Explicit)
1536 .with_differentiation(OpDifferentiation::None)
1537 .with_lowering(OpLowering::Dispatch)
1538 .with_fusion_class(OpFusionClass::Effect)
1539 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1540 .mutated_inputs(0x0d)
1541 .alias(0, 0)
1542 .alias(1, 2)
1543 .alias(2, 3);
1544
1545 pub const GRAD_SCALER_ADVANCE: OperationContract = OperationContract::new(
1546 "oa::ml::optim::grad_scaler_advance",
1547 0x30bed15237afeb07,
1548 &[
1549 OpValueKind::Matrix,
1550 OpValueKind::Matrix,
1551 OpValueKind::Matrix,
1552 OpValueKind::Matrix,
1553 ],
1554 &[
1555 OpValueKind::Matrix,
1556 OpValueKind::Matrix,
1557 OpValueKind::Matrix,
1558 ],
1559 )
1560 .with_shape_rule(OpShapeRule::Explicit)
1561 .with_dtype_rule(OpDTypeRule::MatchInput)
1562 .with_differentiation(OpDifferentiation::None)
1563 .with_lowering(OpLowering::Dispatch)
1564 .with_fusion_class(OpFusionClass::Effect)
1565 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1566 .mutated_inputs(0x0e)
1567 .alias(0, 1)
1568 .alias(1, 2)
1569 .alias(2, 3);
1570
1571 pub const EMBEDDING: OperationContract = OperationContract::new(
1572 "oa::ml::matrix::embedding",
1573 0xc9619082560f2159,
1574 &[OpValueKind::Matrix, OpValueKind::Matrix],
1575 &[OpValueKind::Matrix],
1576 )
1577 .with_shape_rule(OpShapeRule::Explicit)
1578 .with_dtype_rule(OpDTypeRule::Explicit)
1579 .with_differentiation(OpDifferentiation::Reverse)
1580 .with_lowering(OpLowering::Dispatch)
1581 .with_fusion_class(OpFusionClass::Gather)
1582 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1583
1584 pub const EMBEDDING_BACKWARD: OperationContract = OperationContract::new(
1585 "oa::ml::matrix::embedding_backward",
1586 0x6ea2b965ff29b962,
1587 &[
1588 OpValueKind::Matrix,
1589 OpValueKind::Matrix,
1590 OpValueKind::Matrix,
1591 ],
1592 &[OpValueKind::Matrix],
1593 )
1594 .with_shape_rule(OpShapeRule::Explicit)
1595 .with_dtype_rule(OpDTypeRule::Explicit)
1596 .with_differentiation(OpDifferentiation::None)
1597 .with_lowering(OpLowering::Dispatch)
1598 .with_fusion_class(OpFusionClass::Gather)
1599 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1600
1601 pub const CHANNEL_NORM: OperationContract = OperationContract::new(
1602 "oa::FnMatrix::channelNorm",
1603 0x4ffae2632e359b91,
1604 &[
1605 OpValueKind::Matrix,
1606 OpValueKind::Matrix,
1607 OpValueKind::Matrix,
1608 ],
1609 &[OpValueKind::Matrix],
1610 )
1611 .with_shape_rule(OpShapeRule::MatchInput)
1612 .with_dtype_rule(OpDTypeRule::MatchInput)
1613 .with_differentiation(OpDifferentiation::Reverse)
1614 .with_lowering(OpLowering::Dispatch)
1615 .with_fusion_class(OpFusionClass::Reduce)
1616 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1617 .attributes(&[
1618 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
1619 OpAttributeSpec::new("channels", OpAttributeKind::SignedInteger),
1620 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
1621 OpAttributeSpec::new("eps", OpAttributeKind::Float),
1622 ]);
1623
1624 pub const CHANNEL_NORM_BACKWARD: OperationContract = OperationContract::new(
1625 "oa::ml::matrix::channel_norm_backward",
1626 0x05718ab0c40354e2,
1627 &[
1628 OpValueKind::Matrix,
1629 OpValueKind::Matrix,
1630 OpValueKind::Matrix,
1631 ],
1632 &[
1633 OpValueKind::Matrix,
1634 OpValueKind::Matrix,
1635 OpValueKind::Matrix,
1636 ],
1637 )
1638 .with_shape_rule(OpShapeRule::Explicit)
1639 .with_dtype_rule(OpDTypeRule::MatchInput)
1640 .with_differentiation(OpDifferentiation::None)
1641 .with_lowering(OpLowering::Dispatch)
1642 .with_fusion_class(OpFusionClass::Reduce)
1643 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1644 .attributes(&[
1645 OpAttributeSpec::new("batch", OpAttributeKind::UnsignedInteger),
1646 OpAttributeSpec::new("channels", OpAttributeKind::UnsignedInteger),
1647 OpAttributeSpec::new("sequence_length", OpAttributeKind::UnsignedInteger),
1648 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
1649 ]);
1650
1651 pub const CHANNEL_NORM_RELU: OperationContract = OperationContract::new(
1652 "oa::FnMatrix::channelNormRelu",
1653 0xcb42799d33c4fa6b,
1654 &[
1655 OpValueKind::Matrix,
1656 OpValueKind::Matrix,
1657 OpValueKind::Matrix,
1658 ],
1659 &[OpValueKind::Matrix],
1660 )
1661 .with_shape_rule(OpShapeRule::MatchInput)
1662 .with_dtype_rule(OpDTypeRule::MatchInput)
1663 .with_differentiation(OpDifferentiation::Reverse)
1664 .with_lowering(OpLowering::Dispatch)
1665 .with_fusion_class(OpFusionClass::Reduce)
1666 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1667 .attributes(&[
1668 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
1669 OpAttributeSpec::new("channels", OpAttributeKind::SignedInteger),
1670 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
1671 OpAttributeSpec::new("eps", OpAttributeKind::Float),
1672 ]);
1673
1674 pub const CHANNEL_NORM_RELU_BACKWARD: OperationContract = OperationContract::new(
1675 "oa::ml::matrix::channel_norm_relu_backward",
1676 0x1b963b9ffb53f168,
1677 &[
1678 OpValueKind::Matrix,
1679 OpValueKind::Matrix,
1680 OpValueKind::Matrix,
1681 OpValueKind::Matrix,
1682 ],
1683 &[
1684 OpValueKind::Matrix,
1685 OpValueKind::Matrix,
1686 OpValueKind::Matrix,
1687 ],
1688 )
1689 .with_shape_rule(OpShapeRule::Explicit)
1690 .with_dtype_rule(OpDTypeRule::MatchInput)
1691 .with_differentiation(OpDifferentiation::None)
1692 .with_lowering(OpLowering::Dispatch)
1693 .with_fusion_class(OpFusionClass::Reduce)
1694 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1695 .attributes(&[
1696 OpAttributeSpec::new("batch", OpAttributeKind::UnsignedInteger),
1697 OpAttributeSpec::new("channels", OpAttributeKind::UnsignedInteger),
1698 OpAttributeSpec::new("sequence_length", OpAttributeKind::UnsignedInteger),
1699 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
1700 ]);
1701
1702 pub const RNN_SCAN: OperationContract = OperationContract::new(
1703 "oa::FnMatrix::rnnScan",
1704 0x6bcab5aa32da6246,
1705 &[
1706 OpValueKind::Matrix,
1707 OpValueKind::Matrix,
1708 OpValueKind::Matrix,
1709 ],
1710 &[OpValueKind::Matrix, OpValueKind::Matrix],
1711 )
1712 .with_shape_rule(OpShapeRule::Explicit)
1713 .with_dtype_rule(OpDTypeRule::MatchInput)
1714 .with_differentiation(OpDifferentiation::Reverse)
1715 .with_lowering(OpLowering::Dispatch)
1716 .with_fusion_class(OpFusionClass::Scan)
1717 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1718 .with_control_flow(OpControlFlow::Loop)
1719 .attributes(&[
1720 OpAttributeSpec::new("hiddenSize", OpAttributeKind::SignedInteger),
1721 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
1722 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
1723 ])
1724 .optional_inputs(0x04);
1725
1726 pub const RNN_SCAN_BACKWARD: OperationContract = OperationContract::new(
1727 "oa::ml::matrix::rnn_scan_backward",
1728 0x42548b61390cb410,
1729 &[
1730 OpValueKind::Matrix,
1731 OpValueKind::Matrix,
1732 OpValueKind::Matrix,
1733 OpValueKind::Matrix,
1734 OpValueKind::Matrix,
1735 ],
1736 &[
1737 OpValueKind::Matrix,
1738 OpValueKind::Matrix,
1739 OpValueKind::Matrix,
1740 ],
1741 )
1742 .with_shape_rule(OpShapeRule::Explicit)
1743 .with_dtype_rule(OpDTypeRule::MatchInput)
1744 .with_differentiation(OpDifferentiation::None)
1745 .with_lowering(OpLowering::Dispatch)
1746 .with_fusion_class(OpFusionClass::Scan)
1747 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1748 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
1749
1750 pub const LAYER_NORM: OperationContract = OperationContract::new(
1751 "oa::ml::matrix::layer_norm",
1752 0x8deb325bf9bacb79,
1753 &[
1754 OpValueKind::Matrix,
1755 OpValueKind::Matrix,
1756 OpValueKind::Matrix,
1757 ],
1758 &[
1759 OpValueKind::Matrix,
1760 OpValueKind::Matrix,
1761 OpValueKind::Matrix,
1762 ],
1763 )
1764 .with_shape_rule(OpShapeRule::Explicit)
1765 .with_dtype_rule(OpDTypeRule::MatchInput)
1766 .with_differentiation(OpDifferentiation::Reverse)
1767 .with_lowering(OpLowering::Dispatch)
1768 .with_fusion_class(OpFusionClass::Reduce)
1769 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1770 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
1771
1772 pub const LAYER_NORM_BACKWARD: OperationContract = OperationContract::new(
1773 "oa::ml::matrix::layer_norm_backward",
1774 0xf64771f99130f9c9,
1775 &[
1776 OpValueKind::Matrix,
1777 OpValueKind::Matrix,
1778 OpValueKind::Matrix,
1779 OpValueKind::Matrix,
1780 ],
1781 &[
1782 OpValueKind::Matrix,
1783 OpValueKind::Matrix,
1784 OpValueKind::Matrix,
1785 ],
1786 )
1787 .with_shape_rule(OpShapeRule::Explicit)
1788 .with_dtype_rule(OpDTypeRule::MatchInput)
1789 .with_differentiation(OpDifferentiation::None)
1790 .with_lowering(OpLowering::Dispatch)
1791 .with_fusion_class(OpFusionClass::Reduce)
1792 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1793
1794 pub const RMS_NORM: OperationContract = OperationContract::new(
1795 "oa::FnMatrix::rmsNorm",
1796 0xee3af65769d3ee97,
1797 &[OpValueKind::Matrix, OpValueKind::Matrix],
1798 &[OpValueKind::Matrix],
1799 )
1800 .with_shape_rule(OpShapeRule::MatchInput)
1801 .with_dtype_rule(OpDTypeRule::MatchInput)
1802 .with_differentiation(OpDifferentiation::Reverse)
1803 .with_lowering(OpLowering::Dispatch)
1804 .with_fusion_class(OpFusionClass::Reduce)
1805 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1806 .attributes(&[OpAttributeSpec::new("eps", OpAttributeKind::Float)]);
1807
1808 pub const RMS_NORM_BACKWARD: OperationContract = OperationContract::new(
1809 "oa::ml::matrix::rms_norm_backward",
1810 0xe04da914d0e53361,
1811 &[
1812 OpValueKind::Matrix,
1813 OpValueKind::Matrix,
1814 OpValueKind::Matrix,
1815 ],
1816 &[OpValueKind::Matrix, OpValueKind::Matrix],
1817 )
1818 .with_shape_rule(OpShapeRule::Explicit)
1819 .with_dtype_rule(OpDTypeRule::MatchInput)
1820 .with_differentiation(OpDifferentiation::None)
1821 .with_lowering(OpLowering::Dispatch)
1822 .with_fusion_class(OpFusionClass::Reduce)
1823 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1824 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
1825
1826 pub const GELU: OperationContract = OperationContract::new(
1827 "oa::FnMatrix::gelu",
1828 0x418ae43f0776531b,
1829 &[OpValueKind::Matrix],
1830 &[OpValueKind::Matrix],
1831 )
1832 .with_shape_rule(OpShapeRule::MatchInput)
1833 .with_dtype_rule(OpDTypeRule::MatchInput)
1834 .with_differentiation(OpDifferentiation::Reverse)
1835 .with_lowering(OpLowering::Dispatch)
1836 .with_fusion_class(OpFusionClass::Pointwise)
1837 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1838
1839 pub const GELU_BACKWARD: OperationContract = OperationContract::new(
1840 "oa::ml::matrix::gelu_backward",
1841 0x4269e8b8b6083f3a,
1842 &[OpValueKind::Matrix, OpValueKind::Matrix],
1843 &[OpValueKind::Matrix],
1844 )
1845 .with_shape_rule(OpShapeRule::MatchInput)
1846 .with_dtype_rule(OpDTypeRule::MatchInput)
1847 .with_differentiation(OpDifferentiation::None)
1848 .with_lowering(OpLowering::Dispatch)
1849 .with_fusion_class(OpFusionClass::Pointwise)
1850 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1851
1852 pub const SILU: OperationContract = OperationContract::new(
1853 "oa::FnMatrix::silu",
1854 0xc1cd373b504abcc3,
1855 &[OpValueKind::Matrix],
1856 &[OpValueKind::Matrix],
1857 )
1858 .with_shape_rule(OpShapeRule::MatchInput)
1859 .with_dtype_rule(OpDTypeRule::MatchInput)
1860 .with_differentiation(OpDifferentiation::Reverse)
1861 .with_lowering(OpLowering::Dispatch)
1862 .with_fusion_class(OpFusionClass::Pointwise)
1863 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1864
1865 pub const SILU_BACKWARD: OperationContract = OperationContract::new(
1866 "oa::ml::matrix::silu_backward",
1867 0xe10ef969604619a0,
1868 &[OpValueKind::Matrix, OpValueKind::Matrix],
1869 &[OpValueKind::Matrix],
1870 )
1871 .with_shape_rule(OpShapeRule::MatchInput)
1872 .with_dtype_rule(OpDTypeRule::MatchInput)
1873 .with_differentiation(OpDifferentiation::None)
1874 .with_lowering(OpLowering::Dispatch)
1875 .with_fusion_class(OpFusionClass::Pointwise)
1876 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1877
1878 pub const RELU: OperationContract = OperationContract::new(
1879 "oa::FnMatrix::relu",
1880 0xaacb073a9ba2e2a8,
1881 &[OpValueKind::Matrix],
1882 &[OpValueKind::Matrix],
1883 )
1884 .with_shape_rule(OpShapeRule::MatchInput)
1885 .with_dtype_rule(OpDTypeRule::MatchInput)
1886 .with_differentiation(OpDifferentiation::Reverse)
1887 .with_lowering(OpLowering::Dispatch)
1888 .with_fusion_class(OpFusionClass::Pointwise)
1889 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1890
1891 pub const RELU_BACKWARD: OperationContract = OperationContract::new(
1892 "oa::ml::matrix::relu_backward",
1893 0x3e6b8c194ecade60,
1894 &[OpValueKind::Matrix, OpValueKind::Matrix],
1895 &[OpValueKind::Matrix],
1896 )
1897 .with_shape_rule(OpShapeRule::MatchInput)
1898 .with_dtype_rule(OpDTypeRule::MatchInput)
1899 .with_differentiation(OpDifferentiation::None)
1900 .with_lowering(OpLowering::Dispatch)
1901 .with_fusion_class(OpFusionClass::Pointwise)
1902 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1903
1904 pub const TANH: OperationContract = OperationContract::new(
1905 "oa::FnMatrix::tanh",
1906 0xd2f0fb456ef45ba1,
1907 &[OpValueKind::Matrix],
1908 &[OpValueKind::Matrix],
1909 )
1910 .with_shape_rule(OpShapeRule::MatchInput)
1911 .with_dtype_rule(OpDTypeRule::MatchInput)
1912 .with_differentiation(OpDifferentiation::Reverse)
1913 .with_lowering(OpLowering::Dispatch)
1914 .with_fusion_class(OpFusionClass::Pointwise)
1915 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1916
1917 pub const TANH_BACKWARD: OperationContract = OperationContract::new(
1918 "oa::ml::matrix::tanh_backward",
1919 0x7c28513e3ebfa672,
1920 &[OpValueKind::Matrix, OpValueKind::Matrix],
1921 &[OpValueKind::Matrix],
1922 )
1923 .with_shape_rule(OpShapeRule::MatchInput)
1924 .with_dtype_rule(OpDTypeRule::MatchInput)
1925 .with_differentiation(OpDifferentiation::None)
1926 .with_lowering(OpLowering::Dispatch)
1927 .with_fusion_class(OpFusionClass::Pointwise)
1928 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1929
1930 pub const SIGMOID: OperationContract = OperationContract::new(
1931 "oa::FnMatrix::sigmoid",
1932 0xa907ab10b1dee770,
1933 &[OpValueKind::Matrix],
1934 &[OpValueKind::Matrix],
1935 )
1936 .with_shape_rule(OpShapeRule::MatchInput)
1937 .with_dtype_rule(OpDTypeRule::MatchInput)
1938 .with_differentiation(OpDifferentiation::Reverse)
1939 .with_lowering(OpLowering::Dispatch)
1940 .with_fusion_class(OpFusionClass::Pointwise)
1941 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1942
1943 pub const SIGMOID_BACKWARD: OperationContract = OperationContract::new(
1944 "oa::ml::matrix::sigmoid_backward",
1945 0x6732d8591ce3d774,
1946 &[OpValueKind::Matrix, OpValueKind::Matrix],
1947 &[OpValueKind::Matrix],
1948 )
1949 .with_shape_rule(OpShapeRule::MatchInput)
1950 .with_dtype_rule(OpDTypeRule::MatchInput)
1951 .with_differentiation(OpDifferentiation::None)
1952 .with_lowering(OpLowering::Dispatch)
1953 .with_fusion_class(OpFusionClass::Pointwise)
1954 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
1955
1956 pub const LEAKY_RELU: OperationContract = OperationContract::new(
1957 "oa::FnMatrix::leakyRelu",
1958 0x1cb6137e01a98888,
1959 &[OpValueKind::Matrix],
1960 &[OpValueKind::Matrix],
1961 )
1962 .with_shape_rule(OpShapeRule::MatchInput)
1963 .with_dtype_rule(OpDTypeRule::MatchInput)
1964 .with_differentiation(OpDifferentiation::Reverse)
1965 .with_lowering(OpLowering::Dispatch)
1966 .with_fusion_class(OpFusionClass::Pointwise)
1967 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1968 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
1969
1970 pub const LEAKY_RELU_BACKWARD: OperationContract = OperationContract::new(
1971 "oa::ml::matrix::leaky_relu_backward",
1972 0xe53727ca92a7bcda,
1973 &[OpValueKind::Matrix, OpValueKind::Matrix],
1974 &[OpValueKind::Matrix],
1975 )
1976 .with_shape_rule(OpShapeRule::MatchInput)
1977 .with_dtype_rule(OpDTypeRule::MatchInput)
1978 .with_differentiation(OpDifferentiation::None)
1979 .with_lowering(OpLowering::Dispatch)
1980 .with_fusion_class(OpFusionClass::Pointwise)
1981 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1982 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
1983
1984 pub const ELU: OperationContract = OperationContract::new(
1985 "oa::FnMatrix::elu",
1986 0xc396b3608776e278,
1987 &[OpValueKind::Matrix],
1988 &[OpValueKind::Matrix],
1989 )
1990 .with_shape_rule(OpShapeRule::MatchInput)
1991 .with_dtype_rule(OpDTypeRule::MatchInput)
1992 .with_differentiation(OpDifferentiation::Reverse)
1993 .with_lowering(OpLowering::Dispatch)
1994 .with_fusion_class(OpFusionClass::Pointwise)
1995 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
1996 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
1997
1998 pub const ELU_BACKWARD: OperationContract = OperationContract::new(
1999 "oa::ml::matrix::elu_backward",
2000 0xc11dbf4e537a42da,
2001 &[OpValueKind::Matrix, OpValueKind::Matrix],
2002 &[OpValueKind::Matrix],
2003 )
2004 .with_shape_rule(OpShapeRule::MatchInput)
2005 .with_dtype_rule(OpDTypeRule::MatchInput)
2006 .with_differentiation(OpDifferentiation::None)
2007 .with_lowering(OpLowering::Dispatch)
2008 .with_fusion_class(OpFusionClass::Pointwise)
2009 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2010 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
2011
2012 pub const MISH: OperationContract = OperationContract::new(
2013 "oa::FnMatrix::mish",
2014 0xa9d72471a5bb7599,
2015 &[OpValueKind::Matrix],
2016 &[OpValueKind::Matrix],
2017 )
2018 .with_shape_rule(OpShapeRule::MatchInput)
2019 .with_dtype_rule(OpDTypeRule::MatchInput)
2020 .with_differentiation(OpDifferentiation::Reverse)
2021 .with_lowering(OpLowering::Dispatch)
2022 .with_fusion_class(OpFusionClass::Pointwise)
2023 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2024
2025 pub const MISH_BACKWARD: OperationContract = OperationContract::new(
2026 "oa::ml::matrix::mish_backward",
2027 0xfdf4f4a53158620e,
2028 &[OpValueKind::Matrix, OpValueKind::Matrix],
2029 &[OpValueKind::Matrix],
2030 )
2031 .with_shape_rule(OpShapeRule::MatchInput)
2032 .with_dtype_rule(OpDTypeRule::MatchInput)
2033 .with_differentiation(OpDifferentiation::None)
2034 .with_lowering(OpLowering::Dispatch)
2035 .with_fusion_class(OpFusionClass::Pointwise)
2036 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2037
2038 pub const SOFTPLUS: OperationContract = OperationContract::new(
2039 "oa::FnMatrix::softplus",
2040 0xd7a3e9ca147510fe,
2041 &[OpValueKind::Matrix],
2042 &[OpValueKind::Matrix],
2043 )
2044 .with_shape_rule(OpShapeRule::MatchInput)
2045 .with_dtype_rule(OpDTypeRule::MatchInput)
2046 .with_differentiation(OpDifferentiation::Reverse)
2047 .with_lowering(OpLowering::Dispatch)
2048 .with_fusion_class(OpFusionClass::Pointwise)
2049 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2050
2051 pub const SOFTPLUS_BACKWARD: OperationContract = OperationContract::new(
2052 "oa::ml::matrix::softplus_backward",
2053 0xba345c3922bc168e,
2054 &[OpValueKind::Matrix, OpValueKind::Matrix],
2055 &[OpValueKind::Matrix],
2056 )
2057 .with_shape_rule(OpShapeRule::MatchInput)
2058 .with_dtype_rule(OpDTypeRule::MatchInput)
2059 .with_differentiation(OpDifferentiation::None)
2060 .with_lowering(OpLowering::Dispatch)
2061 .with_fusion_class(OpFusionClass::Pointwise)
2062 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2063
2064 pub const SWIGLU: OperationContract = OperationContract::new(
2065 "oa::FnMatrix::swiglu",
2066 0x8a39189dd0a79977,
2067 &[OpValueKind::Matrix, OpValueKind::Matrix],
2068 &[OpValueKind::Matrix],
2069 )
2070 .with_shape_rule(OpShapeRule::MatchInput)
2071 .with_dtype_rule(OpDTypeRule::MatchInput)
2072 .with_differentiation(OpDifferentiation::Reverse)
2073 .with_lowering(OpLowering::Dispatch)
2074 .with_fusion_class(OpFusionClass::Pointwise)
2075 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2076
2077 pub const SWIGLU_BACKWARD: OperationContract = OperationContract::new(
2078 "oa::ml::matrix::swiglu_backward",
2079 0x914a5cbf8e9199b5,
2080 &[
2081 OpValueKind::Matrix,
2082 OpValueKind::Matrix,
2083 OpValueKind::Matrix,
2084 ],
2085 &[OpValueKind::Matrix, OpValueKind::Matrix],
2086 )
2087 .with_shape_rule(OpShapeRule::Explicit)
2088 .with_dtype_rule(OpDTypeRule::MatchInput)
2089 .with_differentiation(OpDifferentiation::None)
2090 .with_lowering(OpLowering::Dispatch)
2091 .with_fusion_class(OpFusionClass::Pointwise)
2092 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2093
2094 pub const ROPE: OperationContract = OperationContract::new(
2095 "oa::ml::matrix::rope",
2096 0x4dcf7e4b2ece0d62,
2097 &[OpValueKind::Matrix],
2098 &[OpValueKind::Matrix],
2099 )
2100 .with_shape_rule(OpShapeRule::Explicit)
2101 .with_dtype_rule(OpDTypeRule::MatchInput)
2102 .with_differentiation(OpDifferentiation::Reverse)
2103 .with_lowering(OpLowering::Dispatch)
2104 .with_fusion_class(OpFusionClass::Gather)
2105 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2106 .attributes(&[
2107 OpAttributeSpec::new("num_heads", OpAttributeKind::UnsignedInteger),
2108 OpAttributeSpec::new("head_dim", OpAttributeKind::UnsignedInteger),
2109 OpAttributeSpec::new("theta_base", OpAttributeKind::Float),
2110 OpAttributeSpec::new("position_offset", OpAttributeKind::UnsignedInteger),
2111 ]);
2112
2113 pub const ROPE_BACKWARD: OperationContract = OperationContract::new(
2114 "oa::ml::matrix::rope_backward",
2115 0x92eb12a8af0fc9b4,
2116 &[OpValueKind::Matrix],
2117 &[OpValueKind::Matrix],
2118 )
2119 .with_shape_rule(OpShapeRule::Explicit)
2120 .with_dtype_rule(OpDTypeRule::MatchInput)
2121 .with_differentiation(OpDifferentiation::None)
2122 .with_lowering(OpLowering::Dispatch)
2123 .with_fusion_class(OpFusionClass::Gather)
2124 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2125 .attributes(&[
2126 OpAttributeSpec::new("num_heads", OpAttributeKind::UnsignedInteger),
2127 OpAttributeSpec::new("head_dim", OpAttributeKind::UnsignedInteger),
2128 OpAttributeSpec::new("theta_base", OpAttributeKind::Float),
2129 OpAttributeSpec::new("position_offset", OpAttributeKind::UnsignedInteger),
2130 ]);
2131
2132 pub const AVG_POOL_2D: OperationContract = OperationContract::new(
2133 "oa::ml::matrix::avg_pool_2d",
2134 0xf0cd090d0a7e6d36,
2135 &[OpValueKind::Matrix],
2136 &[OpValueKind::Matrix],
2137 )
2138 .with_shape_rule(OpShapeRule::Explicit)
2139 .with_dtype_rule(OpDTypeRule::MatchInput)
2140 .with_differentiation(OpDifferentiation::Reverse)
2141 .with_lowering(OpLowering::Dispatch)
2142 .with_fusion_class(OpFusionClass::Conv)
2143 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2144 .attributes(&[
2145 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2146 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2147 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2148 ]);
2149
2150 pub const AVG_POOL_2D_BACKWARD: OperationContract = OperationContract::new(
2151 "oa::ml::matrix::avg_pool_2d_backward",
2152 0x5977c65cdaaa7150,
2153 &[OpValueKind::Matrix, OpValueKind::Matrix],
2154 &[OpValueKind::Matrix],
2155 )
2156 .with_shape_rule(OpShapeRule::Explicit)
2157 .with_dtype_rule(OpDTypeRule::MatchInput)
2158 .with_differentiation(OpDifferentiation::None)
2159 .with_lowering(OpLowering::Dispatch)
2160 .with_fusion_class(OpFusionClass::Conv)
2161 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2162 .attributes(&[
2163 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2164 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2165 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2166 ]);
2167
2168 pub const MAX_POOL_2D: OperationContract = OperationContract::new(
2169 "oa::ml::matrix::max_pool_2d",
2170 0x5fc9c7ccd348432a,
2171 &[OpValueKind::Matrix],
2172 &[OpValueKind::Matrix, OpValueKind::Matrix],
2173 )
2174 .with_shape_rule(OpShapeRule::Explicit)
2175 .with_dtype_rule(OpDTypeRule::Explicit)
2176 .with_differentiation(OpDifferentiation::Reverse)
2177 .with_lowering(OpLowering::Dispatch)
2178 .with_fusion_class(OpFusionClass::Conv)
2179 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2180 .attributes(&[
2181 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2182 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2183 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2184 ]);
2185
2186 pub const MAX_POOL_2D_BACKWARD: OperationContract = OperationContract::new(
2187 "oa::ml::matrix::max_pool_2d_backward",
2188 0x08d90e244a5c42e5,
2189 &[
2190 OpValueKind::Matrix,
2191 OpValueKind::Matrix,
2192 OpValueKind::Matrix,
2193 ],
2194 &[OpValueKind::Matrix],
2195 )
2196 .with_shape_rule(OpShapeRule::Explicit)
2197 .with_dtype_rule(OpDTypeRule::Explicit)
2198 .with_differentiation(OpDifferentiation::None)
2199 .with_lowering(OpLowering::Dispatch)
2200 .with_fusion_class(OpFusionClass::Conv)
2201 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2202 .attributes(&[
2203 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2204 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2205 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2206 ]);
2207
2208 pub const ADAPTIVE_AVG_POOL_2D: OperationContract = OperationContract::new(
2209 "oa::ml::matrix::adaptive_avg_pool_2d",
2210 0x96b0b5e79bb4df1e,
2211 &[OpValueKind::Matrix],
2212 &[OpValueKind::Matrix],
2213 )
2214 .with_shape_rule(OpShapeRule::Explicit)
2215 .with_dtype_rule(OpDTypeRule::MatchInput)
2216 .with_differentiation(OpDifferentiation::Reverse)
2217 .with_lowering(OpLowering::Dispatch)
2218 .with_fusion_class(OpFusionClass::Conv)
2219 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2220 .attributes(&[
2221 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
2222 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
2223 ]);
2224
2225 pub const ADAPTIVE_AVG_POOL_2D_BACKWARD: OperationContract = OperationContract::new(
2226 "oa::ml::matrix::adaptive_avg_pool_2d_backward",
2227 0x03fd7fe6954c7ada,
2228 &[OpValueKind::Matrix, OpValueKind::Matrix],
2229 &[OpValueKind::Matrix],
2230 )
2231 .with_shape_rule(OpShapeRule::Explicit)
2232 .with_dtype_rule(OpDTypeRule::MatchInput)
2233 .with_differentiation(OpDifferentiation::None)
2234 .with_lowering(OpLowering::Dispatch)
2235 .with_fusion_class(OpFusionClass::Conv)
2236 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2237 .attributes(&[
2238 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
2239 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
2240 ]);
2241
2242 pub const MAX_POOL_1D: OperationContract = OperationContract::new(
2243 "oa::ml::matrix::max_pool_1d",
2244 0xb75c0f0ec623a8c2,
2245 &[OpValueKind::Matrix],
2246 &[OpValueKind::Matrix, OpValueKind::Matrix],
2247 )
2248 .with_shape_rule(OpShapeRule::Explicit)
2249 .with_dtype_rule(OpDTypeRule::Explicit)
2250 .with_differentiation(OpDifferentiation::Reverse)
2251 .with_lowering(OpLowering::Dispatch)
2252 .with_fusion_class(OpFusionClass::Conv)
2253 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2254 .attributes(&[
2255 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2256 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2257 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2258 ]);
2259
2260 pub const MAX_POOL_1D_BACKWARD: OperationContract = OperationContract::new(
2261 "oa::ml::matrix::max_pool_1d_backward",
2262 0x80f77ee0202efe74,
2263 &[
2264 OpValueKind::Matrix,
2265 OpValueKind::Matrix,
2266 OpValueKind::Matrix,
2267 ],
2268 &[OpValueKind::Matrix],
2269 )
2270 .with_shape_rule(OpShapeRule::Explicit)
2271 .with_dtype_rule(OpDTypeRule::Explicit)
2272 .with_differentiation(OpDifferentiation::None)
2273 .with_lowering(OpLowering::Dispatch)
2274 .with_fusion_class(OpFusionClass::Conv)
2275 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2276 .attributes(&[
2277 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2278 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2279 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2280 ]);
2281
2282 pub const ADAPTIVE_MAX_POOL_1D: OperationContract = OperationContract::new(
2283 "oa::ml::matrix::adaptive_max_pool_1d",
2284 0x292ebd0f9e12c6ca,
2285 &[OpValueKind::Matrix],
2286 &[OpValueKind::Matrix, OpValueKind::Matrix],
2287 )
2288 .with_shape_rule(OpShapeRule::Explicit)
2289 .with_dtype_rule(OpDTypeRule::Explicit)
2290 .with_differentiation(OpDifferentiation::Reverse)
2291 .with_lowering(OpLowering::Dispatch)
2292 .with_fusion_class(OpFusionClass::Conv)
2293 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2294 .attributes(&[OpAttributeSpec::new(
2295 "output_length",
2296 OpAttributeKind::UnsignedInteger,
2297 )]);
2298
2299 pub const ADAPTIVE_MAX_POOL_1D_BACKWARD: OperationContract = OperationContract::new(
2300 "oa::ml::matrix::adaptive_max_pool_1d_backward",
2301 0x392ef0738decc0e1,
2302 &[
2303 OpValueKind::Matrix,
2304 OpValueKind::Matrix,
2305 OpValueKind::Matrix,
2306 ],
2307 &[OpValueKind::Matrix],
2308 )
2309 .with_shape_rule(OpShapeRule::Explicit)
2310 .with_dtype_rule(OpDTypeRule::Explicit)
2311 .with_differentiation(OpDifferentiation::None)
2312 .with_lowering(OpLowering::Dispatch)
2313 .with_fusion_class(OpFusionClass::Conv)
2314 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2315 .attributes(&[OpAttributeSpec::new(
2316 "output_length",
2317 OpAttributeKind::UnsignedInteger,
2318 )]);
2319
2320 pub const BATCH_NORM_2D: OperationContract = OperationContract::new(
2321 "oa::ml::matrix::batch_norm_2d",
2322 0xda7b505171725de3,
2323 &[
2324 OpValueKind::Matrix,
2325 OpValueKind::Matrix,
2326 OpValueKind::Matrix,
2327 ],
2328 &[
2329 OpValueKind::Matrix,
2330 OpValueKind::Matrix,
2331 OpValueKind::Matrix,
2332 ],
2333 )
2334 .with_shape_rule(OpShapeRule::Explicit)
2335 .with_dtype_rule(OpDTypeRule::MatchInput)
2336 .with_differentiation(OpDifferentiation::Reverse)
2337 .with_lowering(OpLowering::Dispatch)
2338 .with_fusion_class(OpFusionClass::Reduce)
2339 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2340 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
2341
2342 pub const BATCH_NORM_2D_WITH_STATS: OperationContract = OperationContract::new(
2343 "oa::ml::matrix::batch_norm_2d_with_stats",
2344 0x5868a1ecb156adac,
2345 &[
2346 OpValueKind::Matrix,
2347 OpValueKind::Matrix,
2348 OpValueKind::Matrix,
2349 OpValueKind::Matrix,
2350 OpValueKind::Matrix,
2351 ],
2352 &[OpValueKind::Matrix],
2353 )
2354 .with_shape_rule(OpShapeRule::Explicit)
2355 .with_dtype_rule(OpDTypeRule::MatchInput)
2356 .with_differentiation(OpDifferentiation::Reverse)
2357 .with_lowering(OpLowering::Dispatch)
2358 .with_fusion_class(OpFusionClass::Reduce)
2359 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2360 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
2361
2362 pub const BATCH_NORM_2D_RUNNING_UPDATE: OperationContract = OperationContract::new(
2363 "oa::ml::matrix::batch_norm_2d_running_update",
2364 0x5b146ef1a26ac031,
2365 &[
2366 OpValueKind::Matrix,
2367 OpValueKind::Matrix,
2368 OpValueKind::Matrix,
2369 OpValueKind::Matrix,
2370 ],
2371 &[OpValueKind::Matrix, OpValueKind::Matrix],
2372 )
2373 .with_shape_rule(OpShapeRule::Explicit)
2374 .with_dtype_rule(OpDTypeRule::MatchInput)
2375 .with_differentiation(OpDifferentiation::None)
2376 .with_lowering(OpLowering::Dispatch)
2377 .with_fusion_class(OpFusionClass::Reduce)
2378 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2379 .attributes(&[OpAttributeSpec::new("momentum", OpAttributeKind::Float)])
2380 .mutated_inputs(0x03)
2381 .alias(0, 0)
2382 .alias(1, 1);
2383
2384 pub const BATCH_NORM_2D_BACKWARD: OperationContract = OperationContract::new(
2385 "oa::ml::matrix::batch_norm_2d_backward",
2386 0x0d0f006b2bf76f6a,
2387 &[
2388 OpValueKind::Matrix,
2389 OpValueKind::Matrix,
2390 OpValueKind::Matrix,
2391 OpValueKind::Matrix,
2392 OpValueKind::Matrix,
2393 ],
2394 &[
2395 OpValueKind::Matrix,
2396 OpValueKind::Matrix,
2397 OpValueKind::Matrix,
2398 ],
2399 )
2400 .with_shape_rule(OpShapeRule::Explicit)
2401 .with_dtype_rule(OpDTypeRule::MatchInput)
2402 .with_differentiation(OpDifferentiation::None)
2403 .with_lowering(OpLowering::Dispatch)
2404 .with_fusion_class(OpFusionClass::Reduce)
2405 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2406 .attributes(&[
2407 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
2408 OpAttributeSpec::new("training", OpAttributeKind::Boolean),
2409 ]);
2410
2411 pub const UPSAMPLE_2D: OperationContract = OperationContract::new(
2412 "oa::ml::matrix::upsample_2d",
2413 0x5921a1fd8d291a1e,
2414 &[OpValueKind::Matrix],
2415 &[OpValueKind::Matrix],
2416 )
2417 .with_shape_rule(OpShapeRule::Explicit)
2418 .with_dtype_rule(OpDTypeRule::MatchInput)
2419 .with_differentiation(OpDifferentiation::Reverse)
2420 .with_lowering(OpLowering::Dispatch)
2421 .with_fusion_class(OpFusionClass::Effect)
2422 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2423 .attributes(&[
2424 OpAttributeSpec::new("scale_factor", OpAttributeKind::UnsignedInteger),
2425 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
2426 ]);
2427
2428 pub const UPSAMPLE_2D_BACKWARD: OperationContract = OperationContract::new(
2429 "oa::ml::matrix::upsample_2d_backward",
2430 0xee9107e6d0741d99,
2431 &[OpValueKind::Matrix, OpValueKind::Matrix],
2432 &[OpValueKind::Matrix],
2433 )
2434 .with_shape_rule(OpShapeRule::Explicit)
2435 .with_dtype_rule(OpDTypeRule::MatchInput)
2436 .with_differentiation(OpDifferentiation::None)
2437 .with_lowering(OpLowering::Dispatch)
2438 .with_fusion_class(OpFusionClass::Effect)
2439 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2440 .attributes(&[
2441 OpAttributeSpec::new("scale_factor", OpAttributeKind::UnsignedInteger),
2442 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
2443 ]);
2444
2445 pub const CONV_2D: OperationContract = OperationContract::new(
2446 "oa::ml::matrix::conv_2d",
2447 0x657d482964539a5f,
2448 &[
2449 OpValueKind::Matrix,
2450 OpValueKind::Matrix,
2451 OpValueKind::Matrix,
2452 ],
2453 &[OpValueKind::Matrix],
2454 )
2455 .with_shape_rule(OpShapeRule::Explicit)
2456 .with_dtype_rule(OpDTypeRule::MatchInput)
2457 .with_differentiation(OpDifferentiation::Reverse)
2458 .with_lowering(OpLowering::Dispatch)
2459 .with_fusion_class(OpFusionClass::Conv)
2460 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2461 .attributes(&[
2462 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2463 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2464 OpAttributeSpec::new("groups", OpAttributeKind::UnsignedInteger),
2465 ]);
2466
2467 pub const CONV_2D_BACKWARD: OperationContract = OperationContract::new(
2468 "oa::ml::matrix::conv_2d_backward",
2469 0xf9a1b2db7fa48013,
2470 &[
2471 OpValueKind::Matrix,
2472 OpValueKind::Matrix,
2473 OpValueKind::Matrix,
2474 ],
2475 &[
2476 OpValueKind::Matrix,
2477 OpValueKind::Matrix,
2478 OpValueKind::Matrix,
2479 ],
2480 )
2481 .with_shape_rule(OpShapeRule::Explicit)
2482 .with_dtype_rule(OpDTypeRule::MatchInput)
2483 .with_differentiation(OpDifferentiation::None)
2484 .with_lowering(OpLowering::Dispatch)
2485 .with_fusion_class(OpFusionClass::Conv)
2486 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2487 .attributes(&[
2488 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2489 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2490 OpAttributeSpec::new("groups", OpAttributeKind::UnsignedInteger),
2491 ]);
2492
2493 pub const CONV_3D: OperationContract = OperationContract::new(
2494 "oa::ml::matrix::conv_3d",
2495 0x76331e99280417f2,
2496 &[
2497 OpValueKind::Matrix,
2498 OpValueKind::Matrix,
2499 OpValueKind::Matrix,
2500 ],
2501 &[OpValueKind::Matrix],
2502 )
2503 .with_shape_rule(OpShapeRule::Explicit)
2504 .with_dtype_rule(OpDTypeRule::MatchInput)
2505 .with_differentiation(OpDifferentiation::Reverse)
2506 .with_lowering(OpLowering::Dispatch)
2507 .with_fusion_class(OpFusionClass::Conv)
2508 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2509 .attributes(&[
2510 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2511 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2512 OpAttributeSpec::new("groups", OpAttributeKind::UnsignedInteger),
2513 ]);
2514
2515 pub const CONV_3D_BACKWARD: OperationContract = OperationContract::new(
2516 "oa::ml::matrix::conv_3d_backward",
2517 0xc4d8069b807b39af,
2518 &[
2519 OpValueKind::Matrix,
2520 OpValueKind::Matrix,
2521 OpValueKind::Matrix,
2522 ],
2523 &[
2524 OpValueKind::Matrix,
2525 OpValueKind::Matrix,
2526 OpValueKind::Matrix,
2527 ],
2528 )
2529 .with_shape_rule(OpShapeRule::Explicit)
2530 .with_dtype_rule(OpDTypeRule::MatchInput)
2531 .with_differentiation(OpDifferentiation::None)
2532 .with_lowering(OpLowering::Dispatch)
2533 .with_fusion_class(OpFusionClass::Conv)
2534 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2535 .attributes(&[
2536 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2537 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2538 OpAttributeSpec::new("groups", OpAttributeKind::UnsignedInteger),
2539 ]);
2540
2541 pub const UNFOLD: OperationContract = OperationContract::new(
2542 "oa::ml::matrix::unfold",
2543 0xba155f2c6f2335db,
2544 &[OpValueKind::Matrix],
2545 &[OpValueKind::Matrix],
2546 )
2547 .with_shape_rule(OpShapeRule::Explicit)
2548 .with_dtype_rule(OpDTypeRule::MatchInput)
2549 .with_differentiation(OpDifferentiation::Reverse)
2550 .with_lowering(OpLowering::Dispatch)
2551 .with_fusion_class(OpFusionClass::Conv)
2552 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2553 .attributes(&[
2554 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2555 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2556 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2557 OpAttributeSpec::new("dilation", OpAttributeKind::UnsignedInteger),
2558 ]);
2559
2560 pub const FOLD: OperationContract = OperationContract::new(
2561 "oa::ml::matrix::fold",
2562 0xc1333a3a92c35354,
2563 &[OpValueKind::Matrix],
2564 &[OpValueKind::Matrix],
2565 )
2566 .with_shape_rule(OpShapeRule::Explicit)
2567 .with_dtype_rule(OpDTypeRule::MatchInput)
2568 .with_differentiation(OpDifferentiation::Reverse)
2569 .with_lowering(OpLowering::Dispatch)
2570 .with_fusion_class(OpFusionClass::Conv)
2571 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2572 .attributes(&[
2573 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
2574 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
2575 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
2576 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2577 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2578 OpAttributeSpec::new("dilation", OpAttributeKind::UnsignedInteger),
2579 ]);
2580
2581 pub const CONV_1D: OperationContract = OperationContract::new(
2582 "oa::ml::matrix::conv_1d",
2583 0xd14897b9f7d9fffb,
2584 &[
2585 OpValueKind::Matrix,
2586 OpValueKind::Matrix,
2587 OpValueKind::Matrix,
2588 ],
2589 &[OpValueKind::Matrix],
2590 )
2591 .with_shape_rule(OpShapeRule::Explicit)
2592 .with_dtype_rule(OpDTypeRule::MatchInput)
2593 .with_differentiation(OpDifferentiation::Reverse)
2594 .with_lowering(OpLowering::Dispatch)
2595 .with_fusion_class(OpFusionClass::Conv)
2596 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2597 .attributes(&[
2598 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2599 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2600 OpAttributeSpec::new("dilation", OpAttributeKind::UnsignedInteger),
2601 ]);
2602
2603 pub const CONV_1D_BACKWARD: OperationContract = OperationContract::new(
2604 "oa::ml::matrix::conv_1d_backward",
2605 0x478827640411c41e,
2606 &[
2607 OpValueKind::Matrix,
2608 OpValueKind::Matrix,
2609 OpValueKind::Matrix,
2610 ],
2611 &[
2612 OpValueKind::Matrix,
2613 OpValueKind::Matrix,
2614 OpValueKind::Matrix,
2615 ],
2616 )
2617 .with_shape_rule(OpShapeRule::Explicit)
2618 .with_dtype_rule(OpDTypeRule::MatchInput)
2619 .with_differentiation(OpDifferentiation::None)
2620 .with_lowering(OpLowering::Dispatch)
2621 .with_fusion_class(OpFusionClass::Conv)
2622 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2623 .attributes(&[
2624 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2625 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2626 OpAttributeSpec::new("dilation", OpAttributeKind::UnsignedInteger),
2627 ]);
2628
2629 pub const CONV_1D_TRANSPOSE: OperationContract = OperationContract::new(
2630 "oa::ml::matrix::conv_1d_transpose",
2631 0x065faf88fd4e4f3e,
2632 &[OpValueKind::Matrix, OpValueKind::Matrix],
2633 &[OpValueKind::Matrix],
2634 )
2635 .with_shape_rule(OpShapeRule::Explicit)
2636 .with_dtype_rule(OpDTypeRule::MatchInput)
2637 .with_differentiation(OpDifferentiation::Reverse)
2638 .with_lowering(OpLowering::Dispatch)
2639 .with_fusion_class(OpFusionClass::Conv)
2640 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2641 .attributes(&[
2642 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2643 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2644 OpAttributeSpec::new("dilation", OpAttributeKind::UnsignedInteger),
2645 ]);
2646
2647 pub const CONV_1D_TRANSPOSE_BACKWARD: OperationContract = OperationContract::new(
2648 "oa::ml::matrix::conv_1d_transpose_backward",
2649 0x044b6285a1ca1399,
2650 &[
2651 OpValueKind::Matrix,
2652 OpValueKind::Matrix,
2653 OpValueKind::Matrix,
2654 ],
2655 &[OpValueKind::Matrix, OpValueKind::Matrix],
2656 )
2657 .with_shape_rule(OpShapeRule::Explicit)
2658 .with_dtype_rule(OpDTypeRule::MatchInput)
2659 .with_differentiation(OpDifferentiation::None)
2660 .with_lowering(OpLowering::Dispatch)
2661 .with_fusion_class(OpFusionClass::Conv)
2662 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2663 .attributes(&[
2664 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2665 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2666 OpAttributeSpec::new("dilation", OpAttributeKind::UnsignedInteger),
2667 ]);
2668
2669 pub const CONV_2D_TRANSPOSE: OperationContract = OperationContract::new(
2670 "oa::ml::matrix::conv_2d_transpose",
2671 0xe9425ec91162405d,
2672 &[
2673 OpValueKind::Matrix,
2674 OpValueKind::Matrix,
2675 OpValueKind::Matrix,
2676 ],
2677 &[OpValueKind::Matrix],
2678 )
2679 .with_shape_rule(OpShapeRule::Explicit)
2680 .with_dtype_rule(OpDTypeRule::MatchInput)
2681 .with_differentiation(OpDifferentiation::Reverse)
2682 .with_lowering(OpLowering::Dispatch)
2683 .with_fusion_class(OpFusionClass::Conv)
2684 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2685 .attributes(&[
2686 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2687 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2688 ]);
2689
2690 pub const CONV_2D_TRANSPOSE_BACKWARD: OperationContract = OperationContract::new(
2691 "oa::ml::matrix::conv_2d_transpose_backward",
2692 0x52b9b65325ee5e29,
2693 &[
2694 OpValueKind::Matrix,
2695 OpValueKind::Matrix,
2696 OpValueKind::Matrix,
2697 ],
2698 &[
2699 OpValueKind::Matrix,
2700 OpValueKind::Matrix,
2701 OpValueKind::Matrix,
2702 ],
2703 )
2704 .with_shape_rule(OpShapeRule::Explicit)
2705 .with_dtype_rule(OpDTypeRule::MatchInput)
2706 .with_differentiation(OpDifferentiation::None)
2707 .with_lowering(OpLowering::Dispatch)
2708 .with_fusion_class(OpFusionClass::Conv)
2709 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2710 .attributes(&[
2711 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
2712 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
2713 ]);
2714
2715 pub const GRU_SCAN: OperationContract = OperationContract::new(
2716 "oa::FnMatrix::gruScan",
2717 0x63fd6abff46c0072,
2718 &[
2719 OpValueKind::Matrix,
2720 OpValueKind::Matrix,
2721 OpValueKind::Matrix,
2722 ],
2723 &[OpValueKind::Matrix, OpValueKind::Matrix],
2724 )
2725 .with_shape_rule(OpShapeRule::Explicit)
2726 .with_dtype_rule(OpDTypeRule::MatchInput)
2727 .with_differentiation(OpDifferentiation::Reverse)
2728 .with_lowering(OpLowering::Dispatch)
2729 .with_fusion_class(OpFusionClass::Scan)
2730 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2731 .with_control_flow(OpControlFlow::Loop)
2732 .attributes(&[
2733 OpAttributeSpec::new("hiddenSize", OpAttributeKind::SignedInteger),
2734 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
2735 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
2736 ])
2737 .optional_inputs(0x04);
2738
2739 pub const GRU_SCAN_BACKWARD: OperationContract = OperationContract::new(
2740 "oa::ml::matrix::gru_scan_backward",
2741 0x5281c3b2a5df5375,
2742 &[
2743 OpValueKind::Matrix,
2744 OpValueKind::Matrix,
2745 OpValueKind::Matrix,
2746 OpValueKind::Matrix,
2747 OpValueKind::Matrix,
2748 ],
2749 &[
2750 OpValueKind::Matrix,
2751 OpValueKind::Matrix,
2752 OpValueKind::Matrix,
2753 ],
2754 )
2755 .with_shape_rule(OpShapeRule::Explicit)
2756 .with_dtype_rule(OpDTypeRule::MatchInput)
2757 .with_differentiation(OpDifferentiation::None)
2758 .with_lowering(OpLowering::Dispatch)
2759 .with_fusion_class(OpFusionClass::Scan)
2760 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2761 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2762
2763 pub const GRU_CELL: OperationContract = OperationContract::new(
2764 "oa::ml::matrix::gru_cell",
2765 0x447099094fc64867,
2766 &[
2767 OpValueKind::Matrix,
2768 OpValueKind::Matrix,
2769 OpValueKind::Matrix,
2770 OpValueKind::Matrix,
2771 ],
2772 &[OpValueKind::Matrix, OpValueKind::Matrix],
2773 )
2774 .with_shape_rule(OpShapeRule::Explicit)
2775 .with_dtype_rule(OpDTypeRule::MatchInput)
2776 .with_differentiation(OpDifferentiation::Reverse)
2777 .with_lowering(OpLowering::Dispatch)
2778 .with_fusion_class(OpFusionClass::Opaque)
2779 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2780 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2781
2782 pub const GRU_CELL_BACKWARD: OperationContract = OperationContract::new(
2783 "oa::ml::matrix::gru_cell_backward",
2784 0x5caef52540e95f25,
2785 &[
2786 OpValueKind::Matrix,
2787 OpValueKind::Matrix,
2788 OpValueKind::Matrix,
2789 OpValueKind::Matrix,
2790 OpValueKind::Matrix,
2791 OpValueKind::Matrix,
2792 ],
2793 &[
2794 OpValueKind::Matrix,
2795 OpValueKind::Matrix,
2796 OpValueKind::Matrix,
2797 OpValueKind::Matrix,
2798 ],
2799 )
2800 .with_shape_rule(OpShapeRule::Explicit)
2801 .with_dtype_rule(OpDTypeRule::MatchInput)
2802 .with_differentiation(OpDifferentiation::None)
2803 .with_lowering(OpLowering::Dispatch)
2804 .with_fusion_class(OpFusionClass::Pointwise)
2805 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2806 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2807
2808 pub const LSTM_SCAN: OperationContract = OperationContract::new(
2809 "oa::ml::matrix::lstm_scan",
2810 0x79d1a1962071ef9d,
2811 &[
2812 OpValueKind::Matrix,
2813 OpValueKind::Matrix,
2814 OpValueKind::Matrix,
2815 ],
2816 &[
2817 OpValueKind::Matrix,
2818 OpValueKind::Matrix,
2819 OpValueKind::Matrix,
2820 OpValueKind::Matrix,
2821 ],
2822 )
2823 .with_shape_rule(OpShapeRule::Explicit)
2824 .with_dtype_rule(OpDTypeRule::MatchInput)
2825 .with_differentiation(OpDifferentiation::Reverse)
2826 .with_lowering(OpLowering::Dispatch)
2827 .with_fusion_class(OpFusionClass::Scan)
2828 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2829 .with_control_flow(OpControlFlow::Loop)
2830 .attributes(&[
2831 OpAttributeSpec::new("hiddenSize", OpAttributeKind::SignedInteger),
2832 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
2833 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
2834 ])
2835 .optional_inputs(0x04);
2836
2837 pub const LSTM_SCAN_BACKWARD: OperationContract = OperationContract::new(
2838 "oa::ml::matrix::lstm_scan_backward",
2839 0x013bbecdbf1eeeeb,
2840 &[
2841 OpValueKind::Matrix,
2842 OpValueKind::Matrix,
2843 OpValueKind::Matrix,
2844 OpValueKind::Matrix,
2845 OpValueKind::Matrix,
2846 OpValueKind::Matrix,
2847 OpValueKind::Matrix,
2848 ],
2849 &[
2850 OpValueKind::Matrix,
2851 OpValueKind::Matrix,
2852 OpValueKind::Matrix,
2853 ],
2854 )
2855 .with_shape_rule(OpShapeRule::Explicit)
2856 .with_dtype_rule(OpDTypeRule::MatchInput)
2857 .with_differentiation(OpDifferentiation::None)
2858 .with_lowering(OpLowering::Dispatch)
2859 .with_fusion_class(OpFusionClass::Scan)
2860 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2861 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2862
2863 pub const LSTM_CELL: OperationContract = OperationContract::new(
2864 "oa::ml::matrix::lstm_cell",
2865 0x63bb4de89f955adf,
2866 &[
2867 OpValueKind::Matrix,
2868 OpValueKind::Matrix,
2869 OpValueKind::Matrix,
2870 OpValueKind::Matrix,
2871 OpValueKind::Matrix,
2872 ],
2873 &[
2874 OpValueKind::Matrix,
2875 OpValueKind::Matrix,
2876 OpValueKind::Matrix,
2877 ],
2878 )
2879 .with_shape_rule(OpShapeRule::Explicit)
2880 .with_dtype_rule(OpDTypeRule::MatchInput)
2881 .with_differentiation(OpDifferentiation::Reverse)
2882 .with_lowering(OpLowering::Dispatch)
2883 .with_fusion_class(OpFusionClass::Opaque)
2884 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2885 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2886
2887 pub const LSTM_CELL_BACKWARD: OperationContract = OperationContract::new(
2888 "oa::ml::matrix::lstm_cell_backward",
2889 0x0a6964144da0f4d8,
2890 &[
2891 OpValueKind::Matrix,
2892 OpValueKind::Matrix,
2893 OpValueKind::Matrix,
2894 OpValueKind::Matrix,
2895 OpValueKind::Matrix,
2896 OpValueKind::Matrix,
2897 OpValueKind::Matrix,
2898 OpValueKind::Matrix,
2899 ],
2900 &[
2901 OpValueKind::Matrix,
2902 OpValueKind::Matrix,
2903 OpValueKind::Matrix,
2904 OpValueKind::Matrix,
2905 OpValueKind::Matrix,
2906 ],
2907 )
2908 .with_shape_rule(OpShapeRule::Explicit)
2909 .with_dtype_rule(OpDTypeRule::MatchInput)
2910 .with_differentiation(OpDifferentiation::None)
2911 .with_lowering(OpLowering::Dispatch)
2912 .with_fusion_class(OpFusionClass::Pointwise)
2913 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2914 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2915
2916 pub const RNN_CELL: OperationContract = OperationContract::new(
2917 "oa::ml::matrix::rnn_cell",
2918 0xa7b9340299dfbea5,
2919 &[
2920 OpValueKind::Matrix,
2921 OpValueKind::Matrix,
2922 OpValueKind::Matrix,
2923 OpValueKind::Matrix,
2924 ],
2925 &[OpValueKind::Matrix, OpValueKind::Matrix],
2926 )
2927 .with_shape_rule(OpShapeRule::Explicit)
2928 .with_dtype_rule(OpDTypeRule::MatchInput)
2929 .with_differentiation(OpDifferentiation::Reverse)
2930 .with_lowering(OpLowering::Dispatch)
2931 .with_fusion_class(OpFusionClass::Opaque)
2932 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2933 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2934
2935 pub const RNN_CELL_BACKWARD: OperationContract = OperationContract::new(
2936 "oa::ml::matrix::rnn_cell_backward",
2937 0xbb93fa788b7dc987,
2938 &[
2939 OpValueKind::Matrix,
2940 OpValueKind::Matrix,
2941 OpValueKind::Matrix,
2942 OpValueKind::Matrix,
2943 OpValueKind::Matrix,
2944 OpValueKind::Matrix,
2945 ],
2946 &[
2947 OpValueKind::Matrix,
2948 OpValueKind::Matrix,
2949 OpValueKind::Matrix,
2950 OpValueKind::Matrix,
2951 ],
2952 )
2953 .with_shape_rule(OpShapeRule::Explicit)
2954 .with_dtype_rule(OpDTypeRule::MatchInput)
2955 .with_differentiation(OpDifferentiation::None)
2956 .with_lowering(OpLowering::Dispatch)
2957 .with_fusion_class(OpFusionClass::Pointwise)
2958 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
2959 .attributes(&[OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean)]);
2960
2961 pub const BMM: OperationContract = OperationContract::new(
2962 "oa::FnMatrix::bmm",
2963 0xf560e4c2eb795506,
2964 &[OpValueKind::Matrix, OpValueKind::Matrix],
2965 &[OpValueKind::Matrix],
2966 )
2967 .with_shape_rule(OpShapeRule::Explicit)
2968 .with_dtype_rule(OpDTypeRule::MatchInput)
2969 .with_differentiation(OpDifferentiation::Reverse)
2970 .with_lowering(OpLowering::Dispatch)
2971 .with_fusion_class(OpFusionClass::Gemm)
2972 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2973
2974 pub const BMM_NT: OperationContract = OperationContract::new(
2975 "oa::FnMatrix::bmmNt",
2976 0x9faf9bc9d43b2e74,
2977 &[OpValueKind::Matrix, OpValueKind::Matrix],
2978 &[OpValueKind::Matrix],
2979 )
2980 .with_shape_rule(OpShapeRule::Explicit)
2981 .with_dtype_rule(OpDTypeRule::MatchInput)
2982 .with_differentiation(OpDifferentiation::Reverse)
2983 .with_lowering(OpLowering::Dispatch)
2984 .with_fusion_class(OpFusionClass::Gemm)
2985 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2986
2987 pub const BMM_TN: OperationContract = OperationContract::new(
2988 "oa::FnMatrix::bmmTn",
2989 0x0794cd39f84ef6dc,
2990 &[OpValueKind::Matrix, OpValueKind::Matrix],
2991 &[OpValueKind::Matrix],
2992 )
2993 .with_shape_rule(OpShapeRule::Explicit)
2994 .with_dtype_rule(OpDTypeRule::MatchInput)
2995 .with_differentiation(OpDifferentiation::Reverse)
2996 .with_lowering(OpLowering::Dispatch)
2997 .with_fusion_class(OpFusionClass::Gemm)
2998 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
2999
3000 pub const SPLIT_HEADS: OperationContract = OperationContract::new(
3001 "oa::FnMatrix::splitHeads",
3002 0x0cc0ff381c3662b6,
3003 &[OpValueKind::Matrix],
3004 &[OpValueKind::Matrix],
3005 )
3006 .with_shape_rule(OpShapeRule::Explicit)
3007 .with_dtype_rule(OpDTypeRule::MatchInput)
3008 .with_differentiation(OpDifferentiation::Reverse)
3009 .with_lowering(OpLowering::Dispatch)
3010 .with_fusion_class(OpFusionClass::Gather)
3011 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3012 .with_control_flow(OpControlFlow::Conditional)
3013 .attributes(&[
3014 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
3015 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
3016 OpAttributeSpec::new("headCount", OpAttributeKind::SignedInteger),
3017 ]);
3018
3019 pub const MERGE_HEADS: OperationContract = OperationContract::new(
3020 "oa::FnMatrix::mergeHeads",
3021 0xdc638cbb4461bffe,
3022 &[OpValueKind::Matrix],
3023 &[OpValueKind::Matrix],
3024 )
3025 .with_shape_rule(OpShapeRule::Explicit)
3026 .with_dtype_rule(OpDTypeRule::MatchInput)
3027 .with_differentiation(OpDifferentiation::Reverse)
3028 .with_lowering(OpLowering::Dispatch)
3029 .with_fusion_class(OpFusionClass::Gather)
3030 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3031 .with_control_flow(OpControlFlow::Conditional)
3032 .attributes(&[
3033 OpAttributeSpec::new("batch", OpAttributeKind::SignedInteger),
3034 OpAttributeSpec::new("sequenceLength", OpAttributeKind::SignedInteger),
3035 OpAttributeSpec::new("headCount", OpAttributeKind::SignedInteger),
3036 ]);
3037
3038 pub const SOFTMAX_SCALED_MASKED: OperationContract = OperationContract::new(
3039 "oa::FnMatrix::softmaxScaledMasked",
3040 0x653e363956fa9068,
3041 &[OpValueKind::Matrix, OpValueKind::Matrix],
3042 &[OpValueKind::Matrix],
3043 )
3044 .with_shape_rule(OpShapeRule::MatchInput)
3045 .with_dtype_rule(OpDTypeRule::MatchInput)
3046 .with_differentiation(OpDifferentiation::Reverse)
3047 .with_lowering(OpLowering::Dispatch)
3048 .with_fusion_class(OpFusionClass::Reduce)
3049 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3050 .with_control_flow(OpControlFlow::Conditional)
3051 .attributes(&[OpAttributeSpec::new("scale", OpAttributeKind::Float)]);
3052
3053 pub const SOFTMAX_SCALED_MASKED_BACKWARD: OperationContract = OperationContract::new(
3054 "oa::ml::matrix::softmax_scaled_masked_backward",
3055 0xe0483c8e01b05a8a,
3056 &[OpValueKind::Matrix, OpValueKind::Matrix],
3057 &[OpValueKind::Matrix],
3058 )
3059 .with_shape_rule(OpShapeRule::Explicit)
3060 .with_dtype_rule(OpDTypeRule::MatchInput)
3061 .with_differentiation(OpDifferentiation::None)
3062 .with_lowering(OpLowering::Dispatch)
3063 .with_fusion_class(OpFusionClass::Reduce)
3064 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3065 .attributes(&[OpAttributeSpec::new("scale", OpAttributeKind::Float)]);
3066
3067 pub const SCALED_DOT_PRODUCT_ATTENTION: OperationContract = OperationContract::new(
3068 "oa::FnMatrix::scaledDotProductAttention",
3069 0xbfb2e7fd9e051d43,
3070 &[
3071 OpValueKind::Matrix,
3072 OpValueKind::Matrix,
3073 OpValueKind::Matrix,
3074 OpValueKind::Matrix,
3075 ],
3076 &[OpValueKind::Matrix, OpValueKind::Matrix],
3077 )
3078 .with_shape_rule(OpShapeRule::Explicit)
3079 .with_dtype_rule(OpDTypeRule::Explicit)
3080 .with_differentiation(OpDifferentiation::Reverse)
3081 .with_lowering(OpLowering::Dispatch)
3082 .with_fusion_class(OpFusionClass::Attention)
3083 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3084 .attributes(&[
3085 OpAttributeSpec::new("scale", OpAttributeKind::Float),
3086 OpAttributeSpec::new("causal", OpAttributeKind::Boolean),
3087 ])
3088 .optional_inputs(0x08);
3089
3090 pub const SCALED_DOT_PRODUCT_ATTENTION_BACKWARD: OperationContract = OperationContract::new(
3091 "oa::ml::matrix::scaled_dot_product_attention_backward",
3092 0x8370e3e24615406b,
3093 &[
3094 OpValueKind::Matrix,
3095 OpValueKind::Matrix,
3096 OpValueKind::Matrix,
3097 OpValueKind::Matrix,
3098 OpValueKind::Matrix,
3099 OpValueKind::Matrix,
3100 ],
3101 &[
3102 OpValueKind::Matrix,
3103 OpValueKind::Matrix,
3104 OpValueKind::Matrix,
3105 ],
3106 )
3107 .with_shape_rule(OpShapeRule::Explicit)
3108 .with_dtype_rule(OpDTypeRule::MatchInput)
3109 .with_differentiation(OpDifferentiation::None)
3110 .with_lowering(OpLowering::Dispatch)
3111 .with_fusion_class(OpFusionClass::Attention)
3112 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3113 .attributes(&[
3114 OpAttributeSpec::new("scale", OpAttributeKind::Float),
3115 OpAttributeSpec::new("causal", OpAttributeKind::Boolean),
3116 ])
3117 .optional_inputs(0x08);
3118
3119 pub const MOE_ROUTE_WEIGHTS: OperationContract = OperationContract::new(
3120 "oa::FnMatrix::moeRouteWeights",
3121 0xa3c52d79ee9ae4ad,
3122 &[OpValueKind::Matrix, OpValueKind::Matrix],
3123 &[OpValueKind::Matrix],
3124 )
3125 .with_shape_rule(OpShapeRule::Explicit)
3126 .with_dtype_rule(OpDTypeRule::MatchInput)
3127 .with_differentiation(OpDifferentiation::Reverse)
3128 .with_lowering(OpLowering::Dispatch)
3129 .with_fusion_class(OpFusionClass::Reduce)
3130 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3131
3132 pub const MOE_ROUTE_WEIGHTS_BACKWARD: OperationContract = OperationContract::new(
3133 "oa::ml::matrix::moe_route_weights_backward",
3134 0x4e8d99c38a6c9d46,
3135 &[
3136 OpValueKind::Matrix,
3137 OpValueKind::Matrix,
3138 OpValueKind::Matrix,
3139 OpValueKind::Matrix,
3140 ],
3141 &[OpValueKind::Matrix],
3142 )
3143 .with_shape_rule(OpShapeRule::Explicit)
3144 .with_dtype_rule(OpDTypeRule::Explicit)
3145 .with_differentiation(OpDifferentiation::None)
3146 .with_lowering(OpLowering::Dispatch)
3147 .with_fusion_class(OpFusionClass::Pointwise)
3148 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3149
3150 pub const MOE_GATHER: OperationContract = OperationContract::new(
3151 "oa::FnMatrix::moeGather",
3152 0x93965accc5735e08,
3153 &[
3154 OpValueKind::Matrix,
3155 OpValueKind::Matrix,
3156 OpValueKind::Matrix,
3157 ],
3158 &[OpValueKind::Matrix],
3159 )
3160 .with_shape_rule(OpShapeRule::Explicit)
3161 .with_dtype_rule(OpDTypeRule::MatchInput)
3162 .with_differentiation(OpDifferentiation::Reverse)
3163 .with_lowering(OpLowering::Dispatch)
3164 .with_fusion_class(OpFusionClass::Gather)
3165 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3166
3167 pub const MOE_GATHER_BACKWARD: OperationContract = OperationContract::new(
3168 "oa::ml::matrix::moe_gather_backward",
3169 0x12c983a1948d19cc,
3170 &[OpValueKind::Matrix, OpValueKind::Matrix],
3171 &[OpValueKind::Matrix],
3172 )
3173 .with_shape_rule(OpShapeRule::Explicit)
3174 .with_dtype_rule(OpDTypeRule::Explicit)
3175 .with_differentiation(OpDifferentiation::None)
3176 .with_lowering(OpLowering::Dispatch)
3177 .with_fusion_class(OpFusionClass::Gather)
3178 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3179 .attributes(&[OpAttributeSpec::new(
3180 "output_rows",
3181 OpAttributeKind::SignedInteger,
3182 )]);
3183
3184 pub const MOE_COMBINE: OperationContract = OperationContract::new(
3185 "oa::FnMatrix::moeCombine",
3186 0x7a67fc99b9305ad3,
3187 &[
3188 OpValueKind::Matrix,
3189 OpValueKind::Matrix,
3190 OpValueKind::Matrix,
3191 OpValueKind::Matrix,
3192 ],
3193 &[OpValueKind::Matrix],
3194 )
3195 .with_shape_rule(OpShapeRule::Explicit)
3196 .with_dtype_rule(OpDTypeRule::MatchInput)
3197 .with_differentiation(OpDifferentiation::Reverse)
3198 .with_lowering(OpLowering::Dispatch)
3199 .with_fusion_class(OpFusionClass::Reduce)
3200 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3201
3202 pub const MOE_COMBINE_BACKWARD: OperationContract = OperationContract::new(
3203 "oa::ml::matrix::moe_combine_backward",
3204 0xfe09fec67063bc67,
3205 &[
3206 OpValueKind::Matrix,
3207 OpValueKind::Matrix,
3208 OpValueKind::Matrix,
3209 OpValueKind::Matrix,
3210 OpValueKind::Matrix,
3211 ],
3212 &[OpValueKind::Matrix, OpValueKind::Matrix],
3213 )
3214 .with_shape_rule(OpShapeRule::Explicit)
3215 .with_dtype_rule(OpDTypeRule::Explicit)
3216 .with_differentiation(OpDifferentiation::None)
3217 .with_lowering(OpLowering::Dispatch)
3218 .with_fusion_class(OpFusionClass::Pointwise)
3219 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3220
3221 pub const GROUPED_LINEAR_M: OperationContract = OperationContract::new(
3222 "oa::FnMatrix::groupedLinearM",
3223 0x7cf759c33fb999da,
3224 &[
3225 OpValueKind::Matrix,
3226 OpValueKind::Matrix,
3227 OpValueKind::Matrix,
3228 OpValueKind::Matrix,
3229 ],
3230 &[OpValueKind::Matrix],
3231 )
3232 .with_shape_rule(OpShapeRule::Explicit)
3233 .with_dtype_rule(OpDTypeRule::MatchInput)
3234 .with_differentiation(OpDifferentiation::Reverse)
3235 .with_lowering(OpLowering::Dispatch)
3236 .with_fusion_class(OpFusionClass::Gemm)
3237 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3238
3239 pub const GROUPED_LINEAR_M_BACKWARD: OperationContract = OperationContract::new(
3240 "oa::ml::matrix::grouped_linear_m_backward",
3241 0xc9d890787409e70e,
3242 &[
3243 OpValueKind::Matrix,
3244 OpValueKind::Matrix,
3245 OpValueKind::Matrix,
3246 OpValueKind::Matrix,
3247 ],
3248 &[
3249 OpValueKind::Matrix,
3250 OpValueKind::Matrix,
3251 OpValueKind::Matrix,
3252 ],
3253 )
3254 .with_shape_rule(OpShapeRule::Explicit)
3255 .with_dtype_rule(OpDTypeRule::Explicit)
3256 .with_differentiation(OpDifferentiation::None)
3257 .with_lowering(OpLowering::Dispatch)
3258 .with_fusion_class(OpFusionClass::Gemm)
3259 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3260
3261 pub const SILU_MUL: OperationContract = OperationContract::new(
3262 "oa::ml::matrix::silu_mul",
3263 0xa2d6269a319aaf85,
3264 &[OpValueKind::Matrix],
3265 &[OpValueKind::Matrix],
3266 )
3267 .with_shape_rule(OpShapeRule::Explicit)
3268 .with_dtype_rule(OpDTypeRule::MatchInput)
3269 .with_differentiation(OpDifferentiation::Reverse)
3270 .with_lowering(OpLowering::Dispatch)
3271 .with_fusion_class(OpFusionClass::Pointwise)
3272 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3273 .attributes(&[OpAttributeSpec::new(
3274 "intermediate_size",
3275 OpAttributeKind::SignedInteger,
3276 )]);
3277
3278 pub const SILU_MUL_BACKWARD: OperationContract = OperationContract::new(
3279 "oa::ml::matrix::silu_mul_backward",
3280 0xac564f63aa9aa767,
3281 &[OpValueKind::Matrix, OpValueKind::Matrix],
3282 &[OpValueKind::Matrix],
3283 )
3284 .with_shape_rule(OpShapeRule::Explicit)
3285 .with_dtype_rule(OpDTypeRule::MatchInput)
3286 .with_differentiation(OpDifferentiation::None)
3287 .with_lowering(OpLowering::Dispatch)
3288 .with_fusion_class(OpFusionClass::Pointwise)
3289 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3290 .attributes(&[OpAttributeSpec::new(
3291 "intermediate_size",
3292 OpAttributeKind::SignedInteger,
3293 )]);
3294
3295 pub const GROUPED_GEMM_M: OperationContract = OperationContract::new(
3296 "oa::FnMatrix::groupedGemmM",
3297 0x41bf1a8777791aa4,
3298 &[
3299 OpValueKind::Matrix,
3300 OpValueKind::Matrix,
3301 OpValueKind::Matrix,
3302 ],
3303 &[OpValueKind::Matrix],
3304 )
3305 .with_shape_rule(OpShapeRule::Explicit)
3306 .with_dtype_rule(OpDTypeRule::MatchInput)
3307 .with_differentiation(OpDifferentiation::Reverse)
3308 .with_lowering(OpLowering::Dispatch)
3309 .with_fusion_class(OpFusionClass::Gemm)
3310 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3311
3312 pub const GROUPED_GEMM_M_BACKWARD: OperationContract = OperationContract::new(
3313 "oa::ml::matrix::grouped_gemm_m_backward",
3314 0x332edc72cfc82196,
3315 &[
3316 OpValueKind::Matrix,
3317 OpValueKind::Matrix,
3318 OpValueKind::Matrix,
3319 OpValueKind::Matrix,
3320 ],
3321 &[OpValueKind::Matrix, OpValueKind::Matrix],
3322 )
3323 .with_shape_rule(OpShapeRule::Explicit)
3324 .with_dtype_rule(OpDTypeRule::Explicit)
3325 .with_differentiation(OpDifferentiation::None)
3326 .with_lowering(OpLowering::Dispatch)
3327 .with_fusion_class(OpFusionClass::Gemm)
3328 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3329
3330 pub const LINEAR_MATCH: OperationContract = OperationContract::new(
3331 "oa::FnFlow::linearMatch",
3332 0xcfe4ec732dcdbc85,
3333 &[
3334 OpValueKind::Matrix,
3335 OpValueKind::Matrix,
3336 OpValueKind::Matrix,
3337 ],
3338 &[OpValueKind::Matrix, OpValueKind::Matrix],
3339 )
3340 .with_shape_rule(OpShapeRule::Explicit)
3341 .with_dtype_rule(OpDTypeRule::MatchInput)
3342 .with_differentiation(OpDifferentiation::Reverse)
3343 .with_lowering(OpLowering::Dispatch)
3344 .with_fusion_class(OpFusionClass::Gemm)
3345 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3346
3347 pub const EULER_STEP: OperationContract = OperationContract::new(
3348 "oa::FnFlow::eulerStep",
3349 0x2bbebf2f4a7c59ed,
3350 &[OpValueKind::Matrix, OpValueKind::Matrix],
3351 &[OpValueKind::Matrix],
3352 )
3353 .with_shape_rule(OpShapeRule::Explicit)
3354 .with_dtype_rule(OpDTypeRule::MatchInput)
3355 .with_differentiation(OpDifferentiation::Reverse)
3356 .with_lowering(OpLowering::Dispatch)
3357 .with_fusion_class(OpFusionClass::Pointwise)
3358 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3359 .attributes(&[OpAttributeSpec::new("deltaTime", OpAttributeKind::Float)]);
3360
3361 pub const MASKED_MSE: OperationContract = OperationContract::new(
3362 "oa::FnFlow::maskedMse",
3363 0xcf731247fdf59482,
3364 &[
3365 OpValueKind::Matrix,
3366 OpValueKind::Matrix,
3367 OpValueKind::Matrix,
3368 ],
3369 &[OpValueKind::Matrix],
3370 )
3371 .with_shape_rule(OpShapeRule::Explicit)
3372 .with_dtype_rule(OpDTypeRule::MatchInput)
3373 .with_differentiation(OpDifferentiation::Reverse)
3374 .with_lowering(OpLowering::Dispatch)
3375 .with_fusion_class(OpFusionClass::Gather)
3376 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3377
3378 pub const MASKED_MSE_BACKWARD: OperationContract = OperationContract::new(
3379 "oa::ml::flow::masked_mse_backward",
3380 0xc5ad3a3e72fd782c,
3381 &[
3382 OpValueKind::Matrix,
3383 OpValueKind::Matrix,
3384 OpValueKind::Matrix,
3385 OpValueKind::Matrix,
3386 OpValueKind::Matrix,
3387 ],
3388 &[OpValueKind::Matrix],
3389 )
3390 .with_shape_rule(OpShapeRule::Explicit)
3391 .with_dtype_rule(OpDTypeRule::MatchInput)
3392 .with_differentiation(OpDifferentiation::None)
3393 .with_lowering(OpLowering::Dispatch)
3394 .with_fusion_class(OpFusionClass::Gather)
3395 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3396
3397 pub const GAE: OperationContract = OperationContract::new(
3398 "oa::FnAdvantage::gae",
3399 0x836ee6d423f8c9b2,
3400 &[
3401 OpValueKind::Matrix,
3402 OpValueKind::Matrix,
3403 OpValueKind::Matrix,
3404 OpValueKind::Matrix,
3405 OpValueKind::Matrix,
3406 ],
3407 &[OpValueKind::Matrix, OpValueKind::Matrix],
3408 )
3409 .with_shape_rule(OpShapeRule::Explicit)
3410 .with_dtype_rule(OpDTypeRule::Explicit)
3411 .with_differentiation(OpDifferentiation::None)
3412 .with_lowering(OpLowering::Dispatch)
3413 .with_fusion_class(OpFusionClass::Reduce)
3414 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3415 .attributes(&[
3416 OpAttributeSpec::new("gamma", OpAttributeKind::Float),
3417 OpAttributeSpec::new("lambda", OpAttributeKind::Float),
3418 ]);
3419
3420 pub const APPEND: OperationContract = OperationContract::new(
3421 "oa::ml::rollout::append",
3422 0x79be05efa39b93b5,
3423 &[
3424 OpValueKind::Matrix,
3425 OpValueKind::Matrix,
3426 OpValueKind::Matrix,
3427 OpValueKind::Matrix,
3428 OpValueKind::Matrix,
3429 OpValueKind::Matrix,
3430 OpValueKind::Matrix,
3431 OpValueKind::Matrix,
3432 ],
3433 &[],
3434 )
3435 .variadic_inputs(OpValueKind::Matrix, 9)
3436 .variadic_outputs(OpValueKind::Matrix, 9)
3437 .aligned_variadic_aliases()
3438 .with_shape_rule(OpShapeRule::Explicit)
3439 .with_dtype_rule(OpDTypeRule::Explicit)
3440 .with_differentiation(OpDifferentiation::None)
3441 .with_lowering(OpLowering::Dispatch)
3442 .with_fusion_class(OpFusionClass::Gather)
3443 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3444 .attributes(&[
3445 OpAttributeSpec::new("step", OpAttributeKind::UnsignedInteger),
3446 OpAttributeSpec::new("environments", OpAttributeKind::UnsignedInteger),
3447 OpAttributeSpec::new("observation_elements", OpAttributeKind::UnsignedInteger),
3448 ]);
3449
3450 pub const RESET: OperationContract = OperationContract::new(
3451 "oa::ml::rollout::reset",
3452 0xbe7d229361f79ac8,
3453 &[OpValueKind::Matrix],
3454 &[OpValueKind::Matrix],
3455 )
3456 .with_shape_rule(OpShapeRule::MatchInput)
3457 .with_dtype_rule(OpDTypeRule::Explicit)
3458 .with_differentiation(OpDifferentiation::None)
3459 .with_lowering(OpLowering::Dispatch)
3460 .with_fusion_class(OpFusionClass::Gather)
3461 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3462 .mutated_inputs(0x01)
3463 .alias(0, 0);
3464
3465 pub const APPEND_BATCH: OperationContract = OperationContract::new(
3466 "oa::ml::replay::append_batch",
3467 0x3db1826c907bcb40,
3468 &[
3469 OpValueKind::Matrix,
3470 OpValueKind::Matrix,
3471 OpValueKind::Matrix,
3472 OpValueKind::Matrix,
3473 OpValueKind::Matrix,
3474 OpValueKind::Matrix,
3475 ],
3476 &[],
3477 )
3478 .variadic_inputs(OpValueKind::Matrix, 6)
3479 .variadic_outputs(OpValueKind::Matrix, 6)
3480 .aligned_variadic_aliases()
3481 .with_shape_rule(OpShapeRule::Explicit)
3482 .with_dtype_rule(OpDTypeRule::Explicit)
3483 .with_differentiation(OpDifferentiation::None)
3484 .with_lowering(OpLowering::Dispatch)
3485 .with_fusion_class(OpFusionClass::Effect)
3486 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3487 .attributes(&[
3488 OpAttributeSpec::new("cursor", OpAttributeKind::UnsignedInteger),
3489 OpAttributeSpec::new("capacity", OpAttributeKind::UnsignedInteger),
3490 OpAttributeSpec::new("batch", OpAttributeKind::UnsignedInteger),
3491 OpAttributeSpec::new("observation_elements", OpAttributeKind::UnsignedInteger),
3492 OpAttributeSpec::new("action_elements", OpAttributeKind::UnsignedInteger),
3493 ]);
3494
3495 pub const SAMPLE: OperationContract = OperationContract::new(
3496 "oa::ml::replay::sample",
3497 0x86a7ff2dd37d229e,
3498 &[
3499 OpValueKind::Matrix,
3500 OpValueKind::Matrix,
3501 OpValueKind::Matrix,
3502 OpValueKind::Matrix,
3503 OpValueKind::Matrix,
3504 OpValueKind::Matrix,
3505 ],
3506 &[
3507 OpValueKind::Matrix,
3508 OpValueKind::Matrix,
3509 OpValueKind::Matrix,
3510 OpValueKind::Matrix,
3511 OpValueKind::Matrix,
3512 OpValueKind::Matrix,
3513 OpValueKind::Matrix,
3514 ],
3515 )
3516 .with_shape_rule(OpShapeRule::Explicit)
3517 .with_dtype_rule(OpDTypeRule::Explicit)
3518 .with_differentiation(OpDifferentiation::None)
3519 .with_lowering(OpLowering::Dispatch)
3520 .with_fusion_class(OpFusionClass::Effect)
3521 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3522 .attributes(&[
3523 OpAttributeSpec::new("size", OpAttributeKind::UnsignedInteger),
3524 OpAttributeSpec::new("batch", OpAttributeKind::UnsignedInteger),
3525 OpAttributeSpec::new("observation_elements", OpAttributeKind::UnsignedInteger),
3526 OpAttributeSpec::new("action_elements", OpAttributeKind::UnsignedInteger),
3527 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
3528 ]);
3529
3530 pub const RMS_NORM_GATED: OperationContract = OperationContract::new(
3531 "oa::FnMatrix::rmsNormGated",
3532 0xa1f7075db6d90d1a,
3533 &[
3534 OpValueKind::Matrix,
3535 OpValueKind::Matrix,
3536 OpValueKind::Matrix,
3537 OpValueKind::Matrix,
3538 ],
3539 &[OpValueKind::Matrix],
3540 )
3541 .with_shape_rule(OpShapeRule::MatchInput)
3542 .with_dtype_rule(OpDTypeRule::MatchInput)
3543 .with_differentiation(OpDifferentiation::Reverse)
3544 .with_lowering(OpLowering::Dispatch)
3545 .with_fusion_class(OpFusionClass::Reduce)
3546 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3547 .with_control_flow(OpControlFlow::Conditional)
3548 .attributes(&[
3549 OpAttributeSpec::new("eps", OpAttributeKind::Float),
3550 OpAttributeSpec::new("normBeforeGate", OpAttributeKind::Boolean),
3551 ])
3552 .optional_inputs(0x04);
3553
3554 pub const RMS_NORM_GATED_BACKWARD: OperationContract = OperationContract::new(
3555 "oa::ml::matrix::rms_norm_gated_backward",
3556 0x35c5925d8b0ce817,
3557 &[
3558 OpValueKind::Matrix,
3559 OpValueKind::Matrix,
3560 OpValueKind::Matrix,
3561 OpValueKind::Matrix,
3562 OpValueKind::Matrix,
3563 ],
3564 &[
3565 OpValueKind::Matrix,
3566 OpValueKind::Matrix,
3567 OpValueKind::Matrix,
3568 OpValueKind::Matrix,
3569 ],
3570 )
3571 .with_shape_rule(OpShapeRule::Explicit)
3572 .with_dtype_rule(OpDTypeRule::MatchInput)
3573 .with_differentiation(OpDifferentiation::None)
3574 .with_lowering(OpLowering::Dispatch)
3575 .with_fusion_class(OpFusionClass::Reduce)
3576 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3577 .attributes(&[
3578 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
3579 OpAttributeSpec::new("has_bias", OpAttributeKind::Boolean),
3580 ])
3581 .optional_inputs(0x04);
3582
3583 pub const MAMBA3_PREPROCESS: OperationContract = OperationContract::new(
3584 "oa::FnMatrix::mamba3Preprocess",
3585 0x384b61c4a5e048d4,
3586 &[OpValueKind::Matrix, OpValueKind::Matrix],
3587 &[
3588 OpValueKind::Matrix,
3589 OpValueKind::Matrix,
3590 OpValueKind::Matrix,
3591 OpValueKind::Matrix,
3592 OpValueKind::Matrix,
3593 OpValueKind::Matrix,
3594 OpValueKind::Matrix,
3595 OpValueKind::Matrix,
3596 ],
3597 )
3598 .with_shape_rule(OpShapeRule::Explicit)
3599 .with_dtype_rule(OpDTypeRule::MatchInput)
3600 .with_differentiation(OpDifferentiation::Reverse)
3601 .with_lowering(OpLowering::Dispatch)
3602 .with_fusion_class(OpFusionClass::Opaque)
3603 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3604 .attributes(&[OpAttributeSpec::new(
3605 "configIdentity",
3606 OpAttributeKind::UnsignedInteger,
3607 )]);
3608
3609 pub const MAMBA3_PREPROCESS_BACKWARD: OperationContract = OperationContract::new(
3610 "oa::ml::matrix::mamba3_preprocess_backward",
3611 0xa2b7a378c3b11aa7,
3612 &[],
3613 &[OpValueKind::Matrix, OpValueKind::Matrix],
3614 )
3615 .variadic_inputs(OpValueKind::Matrix, 10)
3616 .with_shape_rule(OpShapeRule::Explicit)
3617 .with_dtype_rule(OpDTypeRule::MatchInput)
3618 .with_differentiation(OpDifferentiation::None)
3619 .with_lowering(OpLowering::Dispatch)
3620 .with_fusion_class(OpFusionClass::Pointwise)
3621 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3622 .attributes(&[OpAttributeSpec::new(
3623 "config_identity",
3624 OpAttributeKind::UnsignedInteger,
3625 )]);
3626
3627 pub const MAMBA3_SISO: OperationContract = OperationContract::new(
3628 "oa::FnMatrix::mamba3Siso",
3629 0xf14385c4eabea494,
3630 &[],
3631 &[OpValueKind::Matrix],
3632 )
3633 .variadic_inputs(OpValueKind::Matrix, 11)
3634 .with_shape_rule(OpShapeRule::Explicit)
3635 .with_dtype_rule(OpDTypeRule::MatchInput)
3636 .with_differentiation(OpDifferentiation::Reverse)
3637 .with_lowering(OpLowering::Dispatch)
3638 .with_fusion_class(OpFusionClass::Opaque)
3639 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3640 .with_control_flow(OpControlFlow::Conditional)
3641 .attributes(&[OpAttributeSpec::new(
3642 "configIdentity",
3643 OpAttributeKind::UnsignedInteger,
3644 )]);
3645
3646 pub const MAMBA3_SISO_BACKWARD: OperationContract = OperationContract::new(
3647 "oa::ml::matrix::mamba3_siso_backward",
3648 0xbd83e82c011d84ef,
3649 &[],
3650 &[],
3651 )
3652 .variadic_inputs(OpValueKind::Matrix, 12)
3653 .variadic_outputs(OpValueKind::Matrix, 11)
3654 .with_shape_rule(OpShapeRule::Explicit)
3655 .with_dtype_rule(OpDTypeRule::MatchInput)
3656 .with_differentiation(OpDifferentiation::None)
3657 .with_lowering(OpLowering::Dispatch)
3658 .with_fusion_class(OpFusionClass::Pointwise)
3659 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3660 .attributes(&[OpAttributeSpec::new(
3661 "config_identity",
3662 OpAttributeKind::UnsignedInteger,
3663 )]);
3664
3665 pub const MAMBA3_SISO_STEP: OperationContract = OperationContract::new(
3666 "oa::ml::matrix::mamba3_siso_step",
3667 0xe5a24724274f2f42,
3668 &[
3669 OpValueKind::Matrix,
3670 OpValueKind::Matrix,
3671 OpValueKind::Matrix,
3672 OpValueKind::Matrix,
3673 ],
3674 &[
3675 OpValueKind::Matrix,
3676 OpValueKind::Matrix,
3677 OpValueKind::Matrix,
3678 OpValueKind::Matrix,
3679 OpValueKind::Matrix,
3680 ],
3681 )
3682 .variadic_inputs(OpValueKind::Matrix, 11)
3683 .with_shape_rule(OpShapeRule::Explicit)
3684 .with_dtype_rule(OpDTypeRule::MatchInput)
3685 .with_differentiation(OpDifferentiation::None)
3686 .with_lowering(OpLowering::Dispatch)
3687 .with_fusion_class(OpFusionClass::Opaque)
3688 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3689 .attributes(&[OpAttributeSpec::new(
3690 "config_identity",
3691 OpAttributeKind::UnsignedInteger,
3692 )])
3693 .mutated_inputs(0x0f)
3694 .alias(1, 0)
3695 .alias(2, 1)
3696 .alias(3, 2)
3697 .alias(4, 3);
3698
3699 pub const MAMBA3_MIMO: OperationContract = OperationContract::new(
3700 "oa::FnMatrix::mamba3Mimo",
3701 0xae1302f7b6d827b6,
3702 &[],
3703 &[OpValueKind::Matrix],
3704 )
3705 .variadic_inputs(OpValueKind::Matrix, 15)
3706 .with_shape_rule(OpShapeRule::Explicit)
3707 .with_dtype_rule(OpDTypeRule::MatchInput)
3708 .with_differentiation(OpDifferentiation::Reverse)
3709 .with_lowering(OpLowering::Dispatch)
3710 .with_fusion_class(OpFusionClass::Opaque)
3711 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3712 .attributes(&[OpAttributeSpec::new(
3713 "configIdentity",
3714 OpAttributeKind::UnsignedInteger,
3715 )]);
3716
3717 pub const MAMBA3_MIMO_BACKWARD: OperationContract = OperationContract::new(
3718 "oa::ml::matrix::mamba3_mimo_backward",
3719 0xe66da138080f8bfe,
3720 &[],
3721 &[],
3722 )
3723 .variadic_inputs(OpValueKind::Matrix, 16)
3724 .variadic_outputs(OpValueKind::Matrix, 15)
3725 .with_shape_rule(OpShapeRule::Explicit)
3726 .with_dtype_rule(OpDTypeRule::MatchInput)
3727 .with_differentiation(OpDifferentiation::None)
3728 .with_lowering(OpLowering::Dispatch)
3729 .with_fusion_class(OpFusionClass::Pointwise)
3730 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3731 .attributes(&[OpAttributeSpec::new(
3732 "config_identity",
3733 OpAttributeKind::UnsignedInteger,
3734 )]);
3735
3736 pub const MAMBA3_MIMO_STEP: OperationContract = OperationContract::new(
3737 "oa::ml::matrix::mamba3_mimo_step",
3738 0x849b464e8a372cb7,
3739 &[
3740 OpValueKind::Matrix,
3741 OpValueKind::Matrix,
3742 OpValueKind::Matrix,
3743 OpValueKind::Matrix,
3744 ],
3745 &[
3746 OpValueKind::Matrix,
3747 OpValueKind::Matrix,
3748 OpValueKind::Matrix,
3749 OpValueKind::Matrix,
3750 OpValueKind::Matrix,
3751 ],
3752 )
3753 .variadic_inputs(OpValueKind::Matrix, 15)
3754 .with_shape_rule(OpShapeRule::Explicit)
3755 .with_dtype_rule(OpDTypeRule::MatchInput)
3756 .with_differentiation(OpDifferentiation::None)
3757 .with_lowering(OpLowering::Dispatch)
3758 .with_fusion_class(OpFusionClass::Opaque)
3759 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3760 .attributes(&[OpAttributeSpec::new(
3761 "config_identity",
3762 OpAttributeKind::UnsignedInteger,
3763 )])
3764 .mutated_inputs(0x0f)
3765 .alias(1, 0)
3766 .alias(2, 1)
3767 .alias(3, 2)
3768 .alias(4, 3);
3769
3770 pub const VQ_ASSIGN: OperationContract = OperationContract::new(
3771 "oa::FnMatrix::vqAssign",
3772 0x4ab4980dab05e5b9,
3773 &[OpValueKind::Matrix, OpValueKind::Matrix],
3774 &[OpValueKind::Matrix, OpValueKind::Matrix],
3775 )
3776 .with_shape_rule(OpShapeRule::Explicit)
3777 .with_dtype_rule(OpDTypeRule::Explicit)
3778 .with_differentiation(OpDifferentiation::None)
3779 .with_lowering(OpLowering::Dispatch)
3780 .with_fusion_class(OpFusionClass::Pointwise)
3781 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3782
3783 pub const VQ_LOOKUP: OperationContract = OperationContract::new(
3784 "oa::ml::matrix::vq_lookup",
3785 0x9fb232c3a2b947f9,
3786 &[OpValueKind::Matrix, OpValueKind::Matrix],
3787 &[OpValueKind::Matrix],
3788 )
3789 .with_shape_rule(OpShapeRule::Explicit)
3790 .with_dtype_rule(OpDTypeRule::Explicit)
3791 .with_differentiation(OpDifferentiation::None)
3792 .with_lowering(OpLowering::Dispatch)
3793 .with_fusion_class(OpFusionClass::Gather)
3794 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
3795
3796 pub const VQ_EMA_UPDATE: OperationContract = OperationContract::new(
3797 "oa::ml::matrix::vq_ema_update",
3798 0x957de7392cad618e,
3799 &[
3800 OpValueKind::Matrix,
3801 OpValueKind::Matrix,
3802 OpValueKind::Matrix,
3803 OpValueKind::Matrix,
3804 OpValueKind::Matrix,
3805 ],
3806 &[
3807 OpValueKind::Matrix,
3808 OpValueKind::Matrix,
3809 OpValueKind::Matrix,
3810 ],
3811 )
3812 .with_shape_rule(OpShapeRule::Explicit)
3813 .with_dtype_rule(OpDTypeRule::Explicit)
3814 .with_differentiation(OpDifferentiation::None)
3815 .with_lowering(OpLowering::Dispatch)
3816 .with_fusion_class(OpFusionClass::Effect)
3817 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3818 .attributes(&[
3819 OpAttributeSpec::new("decay", OpAttributeKind::Float),
3820 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
3821 OpAttributeSpec::new("dead_threshold", OpAttributeKind::Float),
3822 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
3823 OpAttributeSpec::new("normalize", OpAttributeKind::Boolean),
3824 ]);
3825
3826 pub const TRADING_RESET: OperationContract = OperationContract::new(
3827 "oa::ml::environment::trading_reset",
3828 0x989639196949a1c2,
3829 &[
3830 OpValueKind::Matrix,
3831 OpValueKind::Matrix,
3832 OpValueKind::Matrix,
3833 ],
3834 &[],
3835 )
3836 .variadic_inputs(OpValueKind::Matrix, 4)
3837 .variadic_outputs(OpValueKind::Matrix, 4)
3838 .aligned_variadic_aliases()
3839 .with_shape_rule(OpShapeRule::Explicit)
3840 .with_dtype_rule(OpDTypeRule::Explicit)
3841 .with_differentiation(OpDifferentiation::None)
3842 .with_lowering(OpLowering::Dispatch)
3843 .with_fusion_class(OpFusionClass::Effect)
3844 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3845 .attributes(&[
3846 OpAttributeSpec::new("config_identity", OpAttributeKind::UnsignedInteger),
3847 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
3848 OpAttributeSpec::new("only_completed", OpAttributeKind::Boolean),
3849 ]);
3850
3851 pub const TRADING_STEP: OperationContract = OperationContract::new(
3852 "oa::ml::environment::trading_step",
3853 0x7c21a1ba60a64390,
3854 &[
3855 OpValueKind::Matrix,
3856 OpValueKind::Matrix,
3857 OpValueKind::Matrix,
3858 OpValueKind::Matrix,
3859 OpValueKind::Matrix,
3860 ],
3861 &[],
3862 )
3863 .variadic_inputs(OpValueKind::Matrix, 7)
3864 .variadic_outputs(OpValueKind::Matrix, 7)
3865 .aligned_variadic_aliases()
3866 .with_shape_rule(OpShapeRule::Explicit)
3867 .with_dtype_rule(OpDTypeRule::Explicit)
3868 .with_differentiation(OpDifferentiation::None)
3869 .with_lowering(OpLowering::Dispatch)
3870 .with_fusion_class(OpFusionClass::Effect)
3871 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3872 .attributes(&[
3873 OpAttributeSpec::new("config_identity", OpAttributeKind::UnsignedInteger),
3874 OpAttributeSpec::new("force_end", OpAttributeKind::Boolean),
3875 ]);
3876
3877 pub const CAUSAL_LINEAR_ATTENTION: OperationContract = OperationContract::new(
3878 "oa::ml::matrix::causal_linear_attention",
3879 0x40652f68c3ea5653,
3880 &[
3881 OpValueKind::Matrix,
3882 OpValueKind::Matrix,
3883 OpValueKind::Matrix,
3884 ],
3885 &[OpValueKind::Matrix, OpValueKind::Matrix],
3886 )
3887 .with_shape_rule(OpShapeRule::Explicit)
3888 .with_dtype_rule(OpDTypeRule::MatchInput)
3889 .with_differentiation(OpDifferentiation::Reverse)
3890 .with_lowering(OpLowering::Dispatch)
3891 .with_fusion_class(OpFusionClass::Attention)
3892 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3893 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
3894
3895 pub const CAUSAL_LINEAR_ATTENTION_BACKWARD: OperationContract = OperationContract::new(
3896 "oa::ml::matrix::causal_linear_attention_backward",
3897 0x8e0e5c33a56b6aad,
3898 &[
3899 OpValueKind::Matrix,
3900 OpValueKind::Matrix,
3901 OpValueKind::Matrix,
3902 OpValueKind::Matrix,
3903 OpValueKind::Matrix,
3904 OpValueKind::Matrix,
3905 ],
3906 &[
3907 OpValueKind::Matrix,
3908 OpValueKind::Matrix,
3909 OpValueKind::Matrix,
3910 ],
3911 )
3912 .with_shape_rule(OpShapeRule::Explicit)
3913 .with_dtype_rule(OpDTypeRule::MatchInput)
3914 .with_differentiation(OpDifferentiation::None)
3915 .with_lowering(OpLowering::Dispatch)
3916 .with_fusion_class(OpFusionClass::Attention)
3917 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3918 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
3919
3920 pub const MINIBATCH: OperationContract = OperationContract::new(
3921 "oa::ml::rollout::minibatch",
3922 0x5a68fc67c2b5bc55,
3923 &[
3924 OpValueKind::Matrix,
3925 OpValueKind::Matrix,
3926 OpValueKind::Matrix,
3927 OpValueKind::Matrix,
3928 OpValueKind::Matrix,
3929 ],
3930 &[
3931 OpValueKind::Matrix,
3932 OpValueKind::Matrix,
3933 OpValueKind::Matrix,
3934 OpValueKind::Matrix,
3935 OpValueKind::Matrix,
3936 ],
3937 )
3938 .with_shape_rule(OpShapeRule::Explicit)
3939 .with_dtype_rule(OpDTypeRule::Explicit)
3940 .with_differentiation(OpDifferentiation::None)
3941 .with_lowering(OpLowering::Dispatch)
3942 .with_fusion_class(OpFusionClass::Reduce)
3943 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3944 .attributes(&[
3945 OpAttributeSpec::new("start", OpAttributeKind::UnsignedInteger),
3946 OpAttributeSpec::new("count", OpAttributeKind::UnsignedInteger),
3947 ]);
3948
3949 pub const MINIBATCH_CURSOR: OperationContract = OperationContract::new(
3950 "oa::ml::rollout::minibatch_cursor",
3951 0xbdde7490a36a910a,
3952 &[
3953 OpValueKind::Matrix,
3954 OpValueKind::Matrix,
3955 OpValueKind::Matrix,
3956 OpValueKind::Matrix,
3957 OpValueKind::Matrix,
3958 OpValueKind::Matrix,
3959 ],
3960 &[
3961 OpValueKind::Matrix,
3962 OpValueKind::Matrix,
3963 OpValueKind::Matrix,
3964 OpValueKind::Matrix,
3965 OpValueKind::Matrix,
3966 ],
3967 )
3968 .with_shape_rule(OpShapeRule::Explicit)
3969 .with_dtype_rule(OpDTypeRule::Explicit)
3970 .with_differentiation(OpDifferentiation::None)
3971 .with_lowering(OpLowering::Dispatch)
3972 .with_fusion_class(OpFusionClass::Reduce)
3973 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3974 .attributes(&[OpAttributeSpec::new(
3975 "count",
3976 OpAttributeKind::UnsignedInteger,
3977 )]);
3978
3979 pub const TRAINING_ACCUMULATE: OperationContract = OperationContract::new(
3980 "oa::ml::matrix::training_accumulate",
3981 0x01aea39bc0e0f0e2,
3982 &[
3983 OpValueKind::Matrix,
3984 OpValueKind::Matrix,
3985 OpValueKind::Matrix,
3986 ],
3987 &[OpValueKind::Matrix],
3988 )
3989 .with_shape_rule(OpShapeRule::Explicit)
3990 .with_dtype_rule(OpDTypeRule::Explicit)
3991 .with_differentiation(OpDifferentiation::None)
3992 .with_lowering(OpLowering::Dispatch)
3993 .with_fusion_class(OpFusionClass::Pointwise)
3994 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
3995 .attributes(&[OpAttributeSpec::new("scale", OpAttributeKind::Float)])
3996 .mutated_inputs(0x01)
3997 .alias(0, 0);
3998
3999 pub const APPEND_CURSOR: OperationContract = OperationContract::new(
4000 "oa::ml::rollout::append_cursor",
4001 0x1f3e438dd0b38d79,
4002 &[
4003 OpValueKind::Matrix,
4004 OpValueKind::Matrix,
4005 OpValueKind::Matrix,
4006 OpValueKind::Matrix,
4007 OpValueKind::Matrix,
4008 OpValueKind::Matrix,
4009 OpValueKind::Matrix,
4010 OpValueKind::Matrix,
4011 ],
4012 &[],
4013 )
4014 .variadic_inputs(OpValueKind::Matrix, 10)
4015 .variadic_outputs(OpValueKind::Matrix, 10)
4016 .aligned_variadic_aliases()
4017 .with_shape_rule(OpShapeRule::Explicit)
4018 .with_dtype_rule(OpDTypeRule::Explicit)
4019 .with_differentiation(OpDifferentiation::None)
4020 .with_lowering(OpLowering::Dispatch)
4021 .with_fusion_class(OpFusionClass::Gather)
4022 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4023 .attributes(&[
4024 OpAttributeSpec::new("step", OpAttributeKind::UnsignedInteger),
4025 OpAttributeSpec::new("environments", OpAttributeKind::UnsignedInteger),
4026 OpAttributeSpec::new("observation_elements", OpAttributeKind::UnsignedInteger),
4027 ]);
4028
4029 pub const TRADING_RESET_CURSOR: OperationContract = OperationContract::new(
4030 "oa::ml::environment::trading_reset_cursor",
4031 0xb171900e6be59576,
4032 &[
4033 OpValueKind::Matrix,
4034 OpValueKind::Matrix,
4035 OpValueKind::Matrix,
4036 OpValueKind::Matrix,
4037 ],
4038 &[],
4039 )
4040 .variadic_inputs(OpValueKind::Matrix, 4)
4041 .variadic_outputs(OpValueKind::Matrix, 4)
4042 .aligned_variadic_aliases()
4043 .with_shape_rule(OpShapeRule::Explicit)
4044 .with_dtype_rule(OpDTypeRule::Explicit)
4045 .with_differentiation(OpDifferentiation::None)
4046 .with_lowering(OpLowering::Dispatch)
4047 .with_fusion_class(OpFusionClass::Effect)
4048 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4049 .attributes(&[
4050 OpAttributeSpec::new("config_identity", OpAttributeKind::UnsignedInteger),
4051 OpAttributeSpec::new("only_completed", OpAttributeKind::Boolean),
4052 ]);
4053
4054 pub const TRADING_STEP_CURSOR: OperationContract = OperationContract::new(
4055 "oa::ml::environment::trading_step_cursor",
4056 0x6d475955ce85b623,
4057 &[
4058 OpValueKind::Matrix,
4059 OpValueKind::Matrix,
4060 OpValueKind::Matrix,
4061 OpValueKind::Matrix,
4062 OpValueKind::Matrix,
4063 OpValueKind::Matrix,
4064 ],
4065 &[],
4066 )
4067 .variadic_inputs(OpValueKind::Matrix, 7)
4068 .variadic_outputs(OpValueKind::Matrix, 7)
4069 .aligned_variadic_aliases()
4070 .with_shape_rule(OpShapeRule::Explicit)
4071 .with_dtype_rule(OpDTypeRule::Explicit)
4072 .with_differentiation(OpDifferentiation::None)
4073 .with_lowering(OpLowering::Dispatch)
4074 .with_fusion_class(OpFusionClass::Effect)
4075 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4076 .attributes(&[OpAttributeSpec::new(
4077 "config_identity",
4078 OpAttributeKind::UnsignedInteger,
4079 )]);
4080
4081 pub const SAMPLE_CATEGORICAL_CURSOR: OperationContract = OperationContract::new(
4082 "oa::ml::matrix::sample_categorical_cursor",
4083 0x0f0da87ec6f7e144,
4084 &[OpValueKind::Matrix, OpValueKind::Matrix],
4085 &[OpValueKind::Matrix],
4086 )
4087 .with_shape_rule(OpShapeRule::Explicit)
4088 .with_dtype_rule(OpDTypeRule::Explicit)
4089 .with_differentiation(OpDifferentiation::None)
4090 .with_lowering(OpLowering::Dispatch)
4091 .with_fusion_class(OpFusionClass::Effect)
4092 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4093
4094 pub const TRADING_CURSOR_ADVANCE: OperationContract = OperationContract::new(
4095 "oa::ml::environment::trading_cursor_advance",
4096 0x204693981baccc4b,
4097 &[OpValueKind::Matrix],
4098 &[OpValueKind::Matrix],
4099 )
4100 .with_shape_rule(OpShapeRule::Explicit)
4101 .with_dtype_rule(OpDTypeRule::Explicit)
4102 .with_differentiation(OpDifferentiation::None)
4103 .with_lowering(OpLowering::Dispatch)
4104 .with_fusion_class(OpFusionClass::Effect)
4105 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4106 .attributes(&[
4107 OpAttributeSpec::new("horizon", OpAttributeKind::UnsignedInteger),
4108 OpAttributeSpec::new("continuing", OpAttributeKind::Boolean),
4109 ])
4110 .mutated_inputs(0x01)
4111 .alias(0, 0);
4112
4113 pub const NEXT_OBSERVATION_APPEND: OperationContract = OperationContract::new(
4114 "oa::ml::rollout::next_observation_append",
4115 0xb3b9ea167442e58d,
4116 &[
4117 OpValueKind::Matrix,
4118 OpValueKind::Matrix,
4119 OpValueKind::Matrix,
4120 ],
4121 &[OpValueKind::Matrix],
4122 )
4123 .with_shape_rule(OpShapeRule::Explicit)
4124 .with_dtype_rule(OpDTypeRule::MatchInput)
4125 .with_differentiation(OpDifferentiation::None)
4126 .with_lowering(OpLowering::Dispatch)
4127 .with_fusion_class(OpFusionClass::Gather)
4128 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4129 .attributes(&[
4130 OpAttributeSpec::new("step", OpAttributeKind::UnsignedInteger),
4131 OpAttributeSpec::new("observation_count", OpAttributeKind::UnsignedInteger),
4132 ])
4133 .mutated_inputs(0x01)
4134 .alias(0, 0);
4135
4136 pub const COMPUTE_SCALE_Q4: OperationContract = OperationContract::new(
4137 "oa::FnMatrix::computeScaleQ4",
4138 0xf729f31cacf6baa3,
4139 &[OpValueKind::Matrix],
4140 &[OpValueKind::Matrix],
4141 )
4142 .with_shape_rule(OpShapeRule::Explicit)
4143 .with_dtype_rule(OpDTypeRule::Explicit)
4144 .with_differentiation(OpDifferentiation::None)
4145 .with_lowering(OpLowering::Dispatch)
4146 .with_fusion_class(OpFusionClass::Pointwise)
4147 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4148
4149 pub const QUANTIZE_Q4: OperationContract = OperationContract::new(
4150 "oa::FnMatrix::quantizeQ4",
4151 0x99a1eb781a46a7f9,
4152 &[OpValueKind::Matrix, OpValueKind::Matrix],
4153 &[OpValueKind::Matrix],
4154 )
4155 .with_shape_rule(OpShapeRule::Explicit)
4156 .with_dtype_rule(OpDTypeRule::Explicit)
4157 .with_differentiation(OpDifferentiation::None)
4158 .with_lowering(OpLowering::Dispatch)
4159 .with_fusion_class(OpFusionClass::Pointwise)
4160 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4161
4162 pub const DEQUANTIZE_Q4: OperationContract = OperationContract::new(
4163 "oa::ml::matrix::dequantize_q4",
4164 0x3ac07b4466a5d23c,
4165 &[OpValueKind::Matrix, OpValueKind::Matrix],
4166 &[OpValueKind::Matrix],
4167 )
4168 .with_shape_rule(OpShapeRule::Explicit)
4169 .with_dtype_rule(OpDTypeRule::Explicit)
4170 .with_differentiation(OpDifferentiation::None)
4171 .with_lowering(OpLowering::Dispatch)
4172 .with_fusion_class(OpFusionClass::Pointwise)
4173 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4174
4175 pub const COMPUTE_SCALE_Q8: OperationContract = OperationContract::new(
4176 "oa::FnMatrix::computeScaleQ8",
4177 0xc1b4b88e68cc179f,
4178 &[OpValueKind::Matrix],
4179 &[OpValueKind::Matrix],
4180 )
4181 .with_shape_rule(OpShapeRule::Explicit)
4182 .with_dtype_rule(OpDTypeRule::Explicit)
4183 .with_differentiation(OpDifferentiation::None)
4184 .with_lowering(OpLowering::Dispatch)
4185 .with_fusion_class(OpFusionClass::Pointwise)
4186 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4187
4188 pub const QUANTIZE_Q8: OperationContract = OperationContract::new(
4189 "oa::FnMatrix::quantizeQ8",
4190 0x9f6b0f8c95650dc5,
4191 &[OpValueKind::Matrix, OpValueKind::Matrix],
4192 &[OpValueKind::Matrix],
4193 )
4194 .with_shape_rule(OpShapeRule::Explicit)
4195 .with_dtype_rule(OpDTypeRule::Explicit)
4196 .with_differentiation(OpDifferentiation::None)
4197 .with_lowering(OpLowering::Dispatch)
4198 .with_fusion_class(OpFusionClass::Pointwise)
4199 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4200
4201 pub const DEQUANTIZE_Q8: OperationContract = OperationContract::new(
4202 "oa::ml::matrix::dequantize_q8",
4203 0x5be77741a373d1e7,
4204 &[OpValueKind::Matrix, OpValueKind::Matrix],
4205 &[OpValueKind::Matrix],
4206 )
4207 .with_shape_rule(OpShapeRule::Explicit)
4208 .with_dtype_rule(OpDTypeRule::Explicit)
4209 .with_differentiation(OpDifferentiation::None)
4210 .with_lowering(OpLowering::Dispatch)
4211 .with_fusion_class(OpFusionClass::Pointwise)
4212 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4213
4214 pub const MATMUL_NT_Q4: OperationContract = OperationContract::new(
4215 "oa::ml::matrix::matmul_nt_q4",
4216 0xf7676122be8e9cb1,
4217 &[
4218 OpValueKind::Matrix,
4219 OpValueKind::Matrix,
4220 OpValueKind::Matrix,
4221 ],
4222 &[OpValueKind::Matrix],
4223 )
4224 .with_shape_rule(OpShapeRule::Explicit)
4225 .with_dtype_rule(OpDTypeRule::Explicit)
4226 .with_differentiation(OpDifferentiation::None)
4227 .with_lowering(OpLowering::Dispatch)
4228 .with_fusion_class(OpFusionClass::Gemm)
4229 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4230
4231 pub const MATMUL_NT_Q8: OperationContract = OperationContract::new(
4232 "oa::ml::matrix::matmul_nt_q8",
4233 0x0c3a4956b5642e2a,
4234 &[
4235 OpValueKind::Matrix,
4236 OpValueKind::Matrix,
4237 OpValueKind::Matrix,
4238 ],
4239 &[OpValueKind::Matrix],
4240 )
4241 .with_shape_rule(OpShapeRule::Explicit)
4242 .with_dtype_rule(OpDTypeRule::Explicit)
4243 .with_differentiation(OpDifferentiation::None)
4244 .with_lowering(OpLowering::Dispatch)
4245 .with_fusion_class(OpFusionClass::Gemm)
4246 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4247
4248 pub const MAX_POOL_3D: OperationContract = OperationContract::new(
4249 "oa::ml::matrix::max_pool_3d",
4250 0xd1686a2512e5c1d6,
4251 &[OpValueKind::Matrix],
4252 &[OpValueKind::Matrix, OpValueKind::Matrix],
4253 )
4254 .with_shape_rule(OpShapeRule::Explicit)
4255 .with_dtype_rule(OpDTypeRule::Explicit)
4256 .with_differentiation(OpDifferentiation::Reverse)
4257 .with_lowering(OpLowering::Dispatch)
4258 .with_fusion_class(OpFusionClass::Conv)
4259 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4260 .attributes(&[
4261 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
4262 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4263 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4264 ]);
4265
4266 pub const MAX_POOL_3D_BACKWARD: OperationContract = OperationContract::new(
4267 "oa::ml::matrix::max_pool_3d_backward",
4268 0x80ef2ae64d2a306b,
4269 &[
4270 OpValueKind::Matrix,
4271 OpValueKind::Matrix,
4272 OpValueKind::Matrix,
4273 ],
4274 &[OpValueKind::Matrix],
4275 )
4276 .with_shape_rule(OpShapeRule::Explicit)
4277 .with_dtype_rule(OpDTypeRule::Explicit)
4278 .with_differentiation(OpDifferentiation::None)
4279 .with_lowering(OpLowering::Dispatch)
4280 .with_fusion_class(OpFusionClass::Conv)
4281 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4282 .attributes(&[
4283 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
4284 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4285 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4286 ]);
4287
4288 pub const AVG_POOL_3D: OperationContract = OperationContract::new(
4289 "oa::ml::matrix::avg_pool_3d",
4290 0xdbc3abdda96df779,
4291 &[OpValueKind::Matrix],
4292 &[OpValueKind::Matrix],
4293 )
4294 .with_shape_rule(OpShapeRule::Explicit)
4295 .with_dtype_rule(OpDTypeRule::MatchInput)
4296 .with_differentiation(OpDifferentiation::Reverse)
4297 .with_lowering(OpLowering::Dispatch)
4298 .with_fusion_class(OpFusionClass::Conv)
4299 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4300 .attributes(&[
4301 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
4302 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4303 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4304 ]);
4305
4306 pub const AVG_POOL_3D_BACKWARD: OperationContract = OperationContract::new(
4307 "oa::ml::matrix::avg_pool_3d_backward",
4308 0x029115c7867314cf,
4309 &[OpValueKind::Matrix, OpValueKind::Matrix],
4310 &[OpValueKind::Matrix],
4311 )
4312 .with_shape_rule(OpShapeRule::Explicit)
4313 .with_dtype_rule(OpDTypeRule::MatchInput)
4314 .with_differentiation(OpDifferentiation::None)
4315 .with_lowering(OpLowering::Dispatch)
4316 .with_fusion_class(OpFusionClass::Conv)
4317 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4318 .attributes(&[
4319 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
4320 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4321 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4322 ]);
4323
4324 pub const ADAPTIVE_MAX_POOL_2D: OperationContract = OperationContract::new(
4325 "oa::ml::matrix::adaptive_max_pool_2d",
4326 0xa9158aba43fcf8fa,
4327 &[OpValueKind::Matrix],
4328 &[OpValueKind::Matrix, OpValueKind::Matrix],
4329 )
4330 .with_shape_rule(OpShapeRule::Explicit)
4331 .with_dtype_rule(OpDTypeRule::Explicit)
4332 .with_differentiation(OpDifferentiation::Reverse)
4333 .with_lowering(OpLowering::Dispatch)
4334 .with_fusion_class(OpFusionClass::Conv)
4335 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4336 .attributes(&[
4337 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
4338 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
4339 ]);
4340
4341 pub const ADAPTIVE_MAX_POOL_2D_BACKWARD: OperationContract = OperationContract::new(
4342 "oa::ml::matrix::adaptive_max_pool_2d_backward",
4343 0x2dd99a4222e22ba2,
4344 &[
4345 OpValueKind::Matrix,
4346 OpValueKind::Matrix,
4347 OpValueKind::Matrix,
4348 ],
4349 &[OpValueKind::Matrix],
4350 )
4351 .with_shape_rule(OpShapeRule::Explicit)
4352 .with_dtype_rule(OpDTypeRule::Explicit)
4353 .with_differentiation(OpDifferentiation::None)
4354 .with_lowering(OpLowering::Dispatch)
4355 .with_fusion_class(OpFusionClass::Conv)
4356 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4357 .attributes(&[
4358 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
4359 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
4360 ]);
4361
4362 pub const ADAPTIVE_MAX_POOL_3D: OperationContract = OperationContract::new(
4363 "oa::ml::matrix::adaptive_max_pool_3d",
4364 0xfe5e587c7b947616,
4365 &[OpValueKind::Matrix],
4366 &[OpValueKind::Matrix, OpValueKind::Matrix],
4367 )
4368 .with_shape_rule(OpShapeRule::Explicit)
4369 .with_dtype_rule(OpDTypeRule::Explicit)
4370 .with_differentiation(OpDifferentiation::Reverse)
4371 .with_lowering(OpLowering::Dispatch)
4372 .with_fusion_class(OpFusionClass::Conv)
4373 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4374 .attributes(&[
4375 OpAttributeSpec::new("output_depth", OpAttributeKind::UnsignedInteger),
4376 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
4377 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
4378 ]);
4379
4380 pub const ADAPTIVE_MAX_POOL_3D_BACKWARD: OperationContract = OperationContract::new(
4381 "oa::ml::matrix::adaptive_max_pool_3d_backward",
4382 0x6f45dc3279e484f1,
4383 &[
4384 OpValueKind::Matrix,
4385 OpValueKind::Matrix,
4386 OpValueKind::Matrix,
4387 ],
4388 &[OpValueKind::Matrix],
4389 )
4390 .with_shape_rule(OpShapeRule::Explicit)
4391 .with_dtype_rule(OpDTypeRule::Explicit)
4392 .with_differentiation(OpDifferentiation::None)
4393 .with_lowering(OpLowering::Dispatch)
4394 .with_fusion_class(OpFusionClass::Conv)
4395 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4396 .attributes(&[
4397 OpAttributeSpec::new("output_depth", OpAttributeKind::UnsignedInteger),
4398 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
4399 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
4400 ]);
4401
4402 pub const ADAPTIVE_AVG_POOL_3D: OperationContract = OperationContract::new(
4403 "oa::ml::matrix::adaptive_avg_pool_3d",
4404 0x7335fb47ec54e909,
4405 &[OpValueKind::Matrix],
4406 &[OpValueKind::Matrix],
4407 )
4408 .with_shape_rule(OpShapeRule::Explicit)
4409 .with_dtype_rule(OpDTypeRule::MatchInput)
4410 .with_differentiation(OpDifferentiation::Reverse)
4411 .with_lowering(OpLowering::Dispatch)
4412 .with_fusion_class(OpFusionClass::Conv)
4413 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4414 .attributes(&[
4415 OpAttributeSpec::new("output_depth", OpAttributeKind::UnsignedInteger),
4416 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
4417 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
4418 ]);
4419
4420 pub const ADAPTIVE_AVG_POOL_3D_BACKWARD: OperationContract = OperationContract::new(
4421 "oa::ml::matrix::adaptive_avg_pool_3d_backward",
4422 0x06a050243d65f945,
4423 &[OpValueKind::Matrix, OpValueKind::Matrix],
4424 &[OpValueKind::Matrix],
4425 )
4426 .with_shape_rule(OpShapeRule::Explicit)
4427 .with_dtype_rule(OpDTypeRule::MatchInput)
4428 .with_differentiation(OpDifferentiation::None)
4429 .with_lowering(OpLowering::Dispatch)
4430 .with_fusion_class(OpFusionClass::Conv)
4431 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4432 .attributes(&[
4433 OpAttributeSpec::new("output_depth", OpAttributeKind::UnsignedInteger),
4434 OpAttributeSpec::new("output_height", OpAttributeKind::UnsignedInteger),
4435 OpAttributeSpec::new("output_width", OpAttributeKind::UnsignedInteger),
4436 ]);
4437
4438 pub const MAX_UNPOOL_1D: OperationContract = OperationContract::new(
4439 "oa::ml::matrix::max_unpool_1d",
4440 0x1b74f5303c5a5657,
4441 &[OpValueKind::Matrix, OpValueKind::Matrix],
4442 &[OpValueKind::Matrix],
4443 )
4444 .with_shape_rule(OpShapeRule::Explicit)
4445 .with_dtype_rule(OpDTypeRule::Explicit)
4446 .with_differentiation(OpDifferentiation::Reverse)
4447 .with_lowering(OpLowering::Dispatch)
4448 .with_fusion_class(OpFusionClass::Conv)
4449 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4450 .attributes(&[
4451 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
4452 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4453 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4454 ]);
4455
4456 pub const MAX_UNPOOL_1D_BACKWARD: OperationContract = OperationContract::new(
4457 "oa::ml::matrix::max_unpool_1d_backward",
4458 0x26aa0b3d9e23dbf6,
4459 &[OpValueKind::Matrix, OpValueKind::Matrix],
4460 &[OpValueKind::Matrix],
4461 )
4462 .with_shape_rule(OpShapeRule::Explicit)
4463 .with_dtype_rule(OpDTypeRule::Explicit)
4464 .with_differentiation(OpDifferentiation::None)
4465 .with_lowering(OpLowering::Dispatch)
4466 .with_fusion_class(OpFusionClass::Conv)
4467 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4468
4469 pub const MAX_UNPOOL_2D: OperationContract = OperationContract::new(
4470 "oa::ml::matrix::max_unpool_2d",
4471 0xbeb2045e64e7e4ee,
4472 &[OpValueKind::Matrix, OpValueKind::Matrix],
4473 &[OpValueKind::Matrix],
4474 )
4475 .with_shape_rule(OpShapeRule::Explicit)
4476 .with_dtype_rule(OpDTypeRule::Explicit)
4477 .with_differentiation(OpDifferentiation::Reverse)
4478 .with_lowering(OpLowering::Dispatch)
4479 .with_fusion_class(OpFusionClass::Conv)
4480 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4481 .attributes(&[
4482 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
4483 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4484 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4485 ]);
4486
4487 pub const MAX_UNPOOL_2D_BACKWARD: OperationContract = OperationContract::new(
4488 "oa::ml::matrix::max_unpool_2d_backward",
4489 0xc8c91c2e317fabcb,
4490 &[OpValueKind::Matrix, OpValueKind::Matrix],
4491 &[OpValueKind::Matrix],
4492 )
4493 .with_shape_rule(OpShapeRule::Explicit)
4494 .with_dtype_rule(OpDTypeRule::Explicit)
4495 .with_differentiation(OpDifferentiation::None)
4496 .with_lowering(OpLowering::Dispatch)
4497 .with_fusion_class(OpFusionClass::Conv)
4498 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
4499
4500 pub const CONV_3D_TRANSPOSE: OperationContract = OperationContract::new(
4501 "oa::ml::matrix::conv_3d_transpose",
4502 0x07ce1cfd1d11cd53,
4503 &[
4504 OpValueKind::Matrix,
4505 OpValueKind::Matrix,
4506 OpValueKind::Matrix,
4507 ],
4508 &[OpValueKind::Matrix],
4509 )
4510 .with_shape_rule(OpShapeRule::Explicit)
4511 .with_dtype_rule(OpDTypeRule::MatchInput)
4512 .with_differentiation(OpDifferentiation::Reverse)
4513 .with_lowering(OpLowering::Dispatch)
4514 .with_fusion_class(OpFusionClass::Conv)
4515 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4516 .attributes(&[
4517 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4518 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4519 ]);
4520
4521 pub const CONV_3D_TRANSPOSE_BACKWARD: OperationContract = OperationContract::new(
4522 "oa::ml::matrix::conv_3d_transpose_backward",
4523 0xe4d86967a08de8e5,
4524 &[
4525 OpValueKind::Matrix,
4526 OpValueKind::Matrix,
4527 OpValueKind::Matrix,
4528 ],
4529 &[
4530 OpValueKind::Matrix,
4531 OpValueKind::Matrix,
4532 OpValueKind::Matrix,
4533 ],
4534 )
4535 .with_shape_rule(OpShapeRule::Explicit)
4536 .with_dtype_rule(OpDTypeRule::MatchInput)
4537 .with_differentiation(OpDifferentiation::None)
4538 .with_lowering(OpLowering::Dispatch)
4539 .with_fusion_class(OpFusionClass::Conv)
4540 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4541 .attributes(&[
4542 OpAttributeSpec::new("stride", OpAttributeKind::UnsignedInteger),
4543 OpAttributeSpec::new("padding", OpAttributeKind::UnsignedInteger),
4544 ]);
4545
4546 pub const CTC: OperationContract = OperationContract::new(
4547 "oa::ml::loss::ctc",
4548 0x781ac33df2699194,
4549 &[
4550 OpValueKind::Matrix,
4551 OpValueKind::Matrix,
4552 OpValueKind::Matrix,
4553 OpValueKind::Matrix,
4554 ],
4555 &[OpValueKind::Matrix],
4556 )
4557 .with_shape_rule(OpShapeRule::Explicit)
4558 .with_dtype_rule(OpDTypeRule::Explicit)
4559 .with_differentiation(OpDifferentiation::Reverse)
4560 .with_lowering(OpLowering::Dispatch)
4561 .with_fusion_class(OpFusionClass::Reduce)
4562 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4563 .attributes(&[OpAttributeSpec::new(
4564 "blank",
4565 OpAttributeKind::UnsignedInteger,
4566 )]);
4567
4568 pub const CTC_BACKWARD: OperationContract = OperationContract::new(
4569 "oa::ml::loss::ctc_backward",
4570 0xf298e1b5a5e77053,
4571 &[
4572 OpValueKind::Matrix,
4573 OpValueKind::Matrix,
4574 OpValueKind::Matrix,
4575 OpValueKind::Matrix,
4576 ],
4577 &[OpValueKind::Matrix],
4578 )
4579 .with_shape_rule(OpShapeRule::Explicit)
4580 .with_dtype_rule(OpDTypeRule::Explicit)
4581 .with_differentiation(OpDifferentiation::None)
4582 .with_lowering(OpLowering::Dispatch)
4583 .with_fusion_class(OpFusionClass::Reduce)
4584 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4585 .attributes(&[OpAttributeSpec::new(
4586 "blank",
4587 OpAttributeKind::UnsignedInteger,
4588 )]);
4589
4590 pub const TOPK_ACCURACY_COUNT: OperationContract = OperationContract::new(
4591 "oa::ml::matrix::topk_accuracy_count",
4592 0xef824e9af469d794,
4593 &[OpValueKind::Matrix, OpValueKind::Matrix],
4594 &[OpValueKind::Matrix, OpValueKind::Matrix],
4595 )
4596 .with_shape_rule(OpShapeRule::Explicit)
4597 .with_dtype_rule(OpDTypeRule::Explicit)
4598 .with_differentiation(OpDifferentiation::None)
4599 .with_lowering(OpLowering::Dispatch)
4600 .with_fusion_class(OpFusionClass::Reduce)
4601 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4602 .attributes(&[OpAttributeSpec::new("k", OpAttributeKind::UnsignedInteger)]);
4603
4604 pub const NORMALIZE_OBSERVATION: OperationContract = OperationContract::new(
4605 "oa::FnEnvironment::normalizeObservation",
4606 0xc852f265d7ab215e,
4607 &[
4608 OpValueKind::Matrix,
4609 OpValueKind::Matrix,
4610 OpValueKind::Matrix,
4611 ],
4612 &[OpValueKind::Matrix],
4613 )
4614 .with_shape_rule(OpShapeRule::Explicit)
4615 .with_dtype_rule(OpDTypeRule::MatchInput)
4616 .with_differentiation(OpDifferentiation::Reverse)
4617 .with_lowering(OpLowering::Dispatch)
4618 .with_fusion_class(OpFusionClass::Opaque)
4619 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4620 .attributes(&[
4621 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
4622 OpAttributeSpec::new("clip", OpAttributeKind::Float),
4623 ]);
4624
4625 pub const SCALE_ACTION: OperationContract = OperationContract::new(
4626 "oa::FnEnvironment::scaleAction",
4627 0x5f16164045761764,
4628 &[OpValueKind::Matrix],
4629 &[OpValueKind::Matrix],
4630 )
4631 .with_shape_rule(OpShapeRule::MatchInput)
4632 .with_dtype_rule(OpDTypeRule::MatchInput)
4633 .with_differentiation(OpDifferentiation::Reverse)
4634 .with_lowering(OpLowering::Dispatch)
4635 .with_fusion_class(OpFusionClass::Opaque)
4636 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4637 .with_control_flow(OpControlFlow::Conditional)
4638 .attributes(&[
4639 OpAttributeSpec::new("sourceMinimum", OpAttributeKind::Float),
4640 OpAttributeSpec::new("sourceMaximum", OpAttributeKind::Float),
4641 OpAttributeSpec::new("targetMinimum", OpAttributeKind::Float),
4642 OpAttributeSpec::new("targetMaximum", OpAttributeKind::Float),
4643 OpAttributeSpec::new("clamp", OpAttributeKind::Boolean),
4644 ]);
4645
4646 pub const CLIP_REWARD: OperationContract = OperationContract::new(
4647 "oa::FnEnvironment::clipReward",
4648 0x1687c940a3f83351,
4649 &[OpValueKind::Matrix],
4650 &[OpValueKind::Matrix],
4651 )
4652 .with_shape_rule(OpShapeRule::MatchInput)
4653 .with_dtype_rule(OpDTypeRule::MatchInput)
4654 .with_differentiation(OpDifferentiation::Reverse)
4655 .with_lowering(OpLowering::Dispatch)
4656 .with_fusion_class(OpFusionClass::Opaque)
4657 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4658 .attributes(&[
4659 OpAttributeSpec::new("minimum", OpAttributeKind::Float),
4660 OpAttributeSpec::new("maximum", OpAttributeKind::Float),
4661 ]);
4662
4663 pub const NORMALIZE: OperationContract = OperationContract::new(
4664 "oa::FnAdvantage::normalize",
4665 0x30b63bd0b398e59f,
4666 &[OpValueKind::Matrix],
4667 &[OpValueKind::Matrix],
4668 )
4669 .with_shape_rule(OpShapeRule::MatchInput)
4670 .with_dtype_rule(OpDTypeRule::MatchInput)
4671 .with_differentiation(OpDifferentiation::Reverse)
4672 .with_lowering(OpLowering::Dispatch)
4673 .with_fusion_class(OpFusionClass::Opaque)
4674 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4675 .attributes(&[OpAttributeSpec::new("epsilon", OpAttributeKind::Float)]);
4676
4677 pub const PPO: OperationContract = OperationContract::new(
4678 "oa::FnLoss::ppo",
4679 0xcb94e587a2d545d5,
4680 &[
4681 OpValueKind::Matrix,
4682 OpValueKind::Matrix,
4683 OpValueKind::Matrix,
4684 OpValueKind::Matrix,
4685 OpValueKind::Matrix,
4686 OpValueKind::Matrix,
4687 ],
4688 &[
4689 OpValueKind::Matrix,
4690 OpValueKind::Matrix,
4691 OpValueKind::Matrix,
4692 OpValueKind::Matrix,
4693 ],
4694 )
4695 .with_shape_rule(OpShapeRule::Explicit)
4696 .with_dtype_rule(OpDTypeRule::Explicit)
4697 .with_differentiation(OpDifferentiation::Reverse)
4698 .with_lowering(OpLowering::Dispatch)
4699 .with_fusion_class(OpFusionClass::Opaque)
4700 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4701 .attributes(&[
4702 OpAttributeSpec::new("clipEpsilon", OpAttributeKind::Float),
4703 OpAttributeSpec::new("valueCoefficient", OpAttributeKind::Float),
4704 OpAttributeSpec::new("entropyCoefficient", OpAttributeKind::Float),
4705 ]);
4706
4707 pub const DQN: OperationContract = OperationContract::new(
4708 "oa::FnLoss::dqn",
4709 0x4f8b3117cac95c49,
4710 &[
4711 OpValueKind::Matrix,
4712 OpValueKind::Matrix,
4713 OpValueKind::Matrix,
4714 OpValueKind::Matrix,
4715 OpValueKind::Matrix,
4716 OpValueKind::Matrix,
4717 ],
4718 &[
4719 OpValueKind::Matrix,
4720 OpValueKind::Matrix,
4721 OpValueKind::Matrix,
4722 ],
4723 )
4724 .with_shape_rule(OpShapeRule::Explicit)
4725 .with_dtype_rule(OpDTypeRule::Explicit)
4726 .with_differentiation(OpDifferentiation::Reverse)
4727 .with_lowering(OpLowering::Dispatch)
4728 .with_fusion_class(OpFusionClass::Opaque)
4729 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4730 .attributes(&[OpAttributeSpec::new("discount", OpAttributeKind::Float)]);
4731
4732 pub const SAC_CRITIC: OperationContract = OperationContract::new(
4733 "oa::FnLoss::sacCritic",
4734 0xeca089d97df6b3aa,
4735 &[
4736 OpValueKind::Matrix,
4737 OpValueKind::Matrix,
4738 OpValueKind::Matrix,
4739 OpValueKind::Matrix,
4740 OpValueKind::Matrix,
4741 OpValueKind::Matrix,
4742 OpValueKind::Matrix,
4743 OpValueKind::Matrix,
4744 ],
4745 &[
4746 OpValueKind::Matrix,
4747 OpValueKind::Matrix,
4748 OpValueKind::Matrix,
4749 OpValueKind::Matrix,
4750 ],
4751 )
4752 .with_shape_rule(OpShapeRule::Explicit)
4753 .with_dtype_rule(OpDTypeRule::Explicit)
4754 .with_differentiation(OpDifferentiation::Reverse)
4755 .with_lowering(OpLowering::Dispatch)
4756 .with_fusion_class(OpFusionClass::Opaque)
4757 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4758 .attributes(&[
4759 OpAttributeSpec::new("discount", OpAttributeKind::Float),
4760 OpAttributeSpec::new("entropyCoefficient", OpAttributeKind::Float),
4761 ]);
4762
4763 pub const SAC_ACTOR: OperationContract = OperationContract::new(
4764 "oa::FnLoss::sacActor",
4765 0x4b3c11aa36173394,
4766 &[
4767 OpValueKind::Matrix,
4768 OpValueKind::Matrix,
4769 OpValueKind::Matrix,
4770 ],
4771 &[OpValueKind::Matrix],
4772 )
4773 .with_shape_rule(OpShapeRule::Explicit)
4774 .with_dtype_rule(OpDTypeRule::MatchInput)
4775 .with_differentiation(OpDifferentiation::Reverse)
4776 .with_lowering(OpLowering::Dispatch)
4777 .with_fusion_class(OpFusionClass::Opaque)
4778 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4779 .attributes(&[OpAttributeSpec::new(
4780 "entropyCoefficient",
4781 OpAttributeKind::Float,
4782 )]);
4783
4784 pub const SAMPLE_CATEGORICAL: OperationContract = OperationContract::new(
4785 "oa::FnPolicy::sampleCategorical",
4786 0x20eafc0202fd9d2a,
4787 &[OpValueKind::Matrix, OpValueKind::Matrix],
4788 &[
4789 OpValueKind::Matrix,
4790 OpValueKind::Matrix,
4791 OpValueKind::Matrix,
4792 OpValueKind::Matrix,
4793 ],
4794 )
4795 .with_shape_rule(OpShapeRule::Explicit)
4796 .with_dtype_rule(OpDTypeRule::Explicit)
4797 .with_differentiation(OpDifferentiation::Reverse)
4798 .with_lowering(OpLowering::Dispatch)
4799 .with_fusion_class(OpFusionClass::Opaque)
4800 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4801 .attributes(&[OpAttributeSpec::new(
4802 "seed",
4803 OpAttributeKind::UnsignedInteger,
4804 )])
4805 .alias(3, 1);
4806
4807 pub const EVALUATE_CATEGORICAL: OperationContract = OperationContract::new(
4808 "oa::FnPolicy::evaluateCategorical",
4809 0x6e7a487c46f3cce6,
4810 &[
4811 OpValueKind::Matrix,
4812 OpValueKind::Matrix,
4813 OpValueKind::Matrix,
4814 ],
4815 &[
4816 OpValueKind::Matrix,
4817 OpValueKind::Matrix,
4818 OpValueKind::Matrix,
4819 OpValueKind::Matrix,
4820 ],
4821 )
4822 .with_shape_rule(OpShapeRule::Explicit)
4823 .with_dtype_rule(OpDTypeRule::Explicit)
4824 .with_differentiation(OpDifferentiation::Reverse)
4825 .with_lowering(OpLowering::Dispatch)
4826 .with_fusion_class(OpFusionClass::Opaque)
4827 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4828 .alias(0, 1)
4829 .alias(3, 2);
4830
4831 pub const SAMPLE_TANH_NORMAL: OperationContract = OperationContract::new(
4832 "oa::FnPolicy::sampleTanhNormal",
4833 0x66874b2a4f85e53c,
4834 &[
4835 OpValueKind::Matrix,
4836 OpValueKind::Matrix,
4837 OpValueKind::Matrix,
4838 ],
4839 &[
4840 OpValueKind::Matrix,
4841 OpValueKind::Matrix,
4842 OpValueKind::Matrix,
4843 OpValueKind::Matrix,
4844 OpValueKind::Matrix,
4845 ],
4846 )
4847 .with_shape_rule(OpShapeRule::Explicit)
4848 .with_dtype_rule(OpDTypeRule::MatchInput)
4849 .with_differentiation(OpDifferentiation::Reverse)
4850 .with_lowering(OpLowering::Dispatch)
4851 .with_fusion_class(OpFusionClass::Opaque)
4852 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4853 .attributes(&[
4854 OpAttributeSpec::new("minimum", OpAttributeKind::Float),
4855 OpAttributeSpec::new("maximum", OpAttributeKind::Float),
4856 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
4857 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
4858 ])
4859 .alias(4, 2);
4860
4861 pub const EVALUATE_TANH_NORMAL: OperationContract = OperationContract::new(
4862 "oa::FnPolicy::evaluateTanhNormal",
4863 0x3579ae127f8758e8,
4864 &[
4865 OpValueKind::Matrix,
4866 OpValueKind::Matrix,
4867 OpValueKind::Matrix,
4868 OpValueKind::Matrix,
4869 ],
4870 &[
4871 OpValueKind::Matrix,
4872 OpValueKind::Matrix,
4873 OpValueKind::Matrix,
4874 OpValueKind::Matrix,
4875 OpValueKind::Matrix,
4876 ],
4877 )
4878 .with_shape_rule(OpShapeRule::Explicit)
4879 .with_dtype_rule(OpDTypeRule::MatchInput)
4880 .with_differentiation(OpDifferentiation::Reverse)
4881 .with_lowering(OpLowering::Dispatch)
4882 .with_fusion_class(OpFusionClass::Opaque)
4883 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4884 .attributes(&[
4885 OpAttributeSpec::new("minimum", OpAttributeKind::Float),
4886 OpAttributeSpec::new("maximum", OpAttributeKind::Float),
4887 OpAttributeSpec::new("epsilon", OpAttributeKind::Float),
4888 ])
4889 .alias(1, 2)
4890 .alias(4, 3);
4891
4892 pub const QUANTIZE: OperationContract = OperationContract::new(
4893 "oa::FnMatrix::quantize",
4894 0x2c2075ebb3df2391,
4895 &[OpValueKind::Matrix],
4896 &[OpValueKind::QuantMatrix],
4897 )
4898 .with_shape_rule(OpShapeRule::MatchInput)
4899 .with_dtype_rule(OpDTypeRule::Explicit)
4900 .with_differentiation(OpDifferentiation::None)
4901 .with_lowering(OpLowering::Dispatch)
4902 .with_fusion_class(OpFusionClass::Opaque)
4903 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4904 .with_control_flow(OpControlFlow::Conditional)
4905 .attributes(&[OpAttributeSpec::new("quantization", OpAttributeKind::Enum)]);
4906
4907 pub const DEQUANTIZE: OperationContract = OperationContract::new(
4908 "oa::FnMatrix::dequantize",
4909 0x265692803d596359,
4910 &[OpValueKind::QuantMatrix],
4911 &[OpValueKind::Matrix],
4912 )
4913 .with_shape_rule(OpShapeRule::MatchInput)
4914 .with_dtype_rule(OpDTypeRule::Explicit)
4915 .with_differentiation(OpDifferentiation::None)
4916 .with_lowering(OpLowering::Dispatch)
4917 .with_fusion_class(OpFusionClass::Opaque)
4918 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4919 .with_control_flow(OpControlFlow::Conditional)
4920 .attributes(&[OpAttributeSpec::new("quantization", OpAttributeKind::Enum)]);
4921
4922 pub const MATMUL_NT_QUANTIZED: OperationContract = OperationContract::new(
4923 "oa::FnMatrix::matMulNtQuantized",
4924 0x5d0edf95db46aa53,
4925 &[OpValueKind::Matrix, OpValueKind::QuantMatrix],
4926 &[OpValueKind::Matrix],
4927 )
4928 .with_shape_rule(OpShapeRule::MatmulNt)
4929 .with_dtype_rule(OpDTypeRule::Explicit)
4930 .with_differentiation(OpDifferentiation::None)
4931 .with_lowering(OpLowering::Dispatch)
4932 .with_fusion_class(OpFusionClass::Opaque)
4933 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4934 .with_control_flow(OpControlFlow::Conditional)
4935 .attributes(&[OpAttributeSpec::new("quantization", OpAttributeKind::Enum)]);
4936}
4937
4938pub mod audio {
4940 use super::*;
4941
4942 pub const NORMALIZE: OperationContract = OperationContract::new(
4943 "oa::FnAudio::normalize",
4944 0x30b364147b54c946,
4945 &[OpValueKind::Audio],
4946 &[OpValueKind::Audio],
4947 )
4948 .with_shape_rule(OpShapeRule::MatchInput)
4949 .with_dtype_rule(OpDTypeRule::MatchInput)
4950 .with_differentiation(OpDifferentiation::None)
4951 .with_lowering(OpLowering::Dispatch)
4952 .with_fusion_class(OpFusionClass::Effect)
4953 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4954 .attributes(&[
4955 OpAttributeSpec::new("targetDb", OpAttributeKind::Float),
4956 OpAttributeSpec::new("mode", OpAttributeKind::UnsignedInteger),
4957 ]);
4958
4959 pub const RESAMPLE: OperationContract = OperationContract::new(
4960 "oa::FnAudio::resample",
4961 0xf0ebfe5b70df774a,
4962 &[OpValueKind::Audio],
4963 &[OpValueKind::Audio],
4964 )
4965 .with_shape_rule(OpShapeRule::Explicit)
4966 .with_dtype_rule(OpDTypeRule::MatchInput)
4967 .with_differentiation(OpDifferentiation::None)
4968 .with_lowering(OpLowering::Dispatch)
4969 .with_fusion_class(OpFusionClass::Gather)
4970 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4971 .attributes(&[
4972 OpAttributeSpec::new("outRate", OpAttributeKind::UnsignedInteger),
4973 OpAttributeSpec::new("filterHalfWidth", OpAttributeKind::UnsignedInteger),
4974 ]);
4975
4976 pub const GAIN: OperationContract = OperationContract::new(
4977 "oa::FnAudio::gain",
4978 0x6d4e321743df9305,
4979 &[OpValueKind::Audio],
4980 &[OpValueKind::Audio],
4981 )
4982 .with_shape_rule(OpShapeRule::MatchInput)
4983 .with_dtype_rule(OpDTypeRule::MatchInput)
4984 .with_differentiation(OpDifferentiation::None)
4985 .with_lowering(OpLowering::Dispatch)
4986 .with_fusion_class(OpFusionClass::Pointwise)
4987 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
4988 .attributes(&[OpAttributeSpec::new("gainDb", OpAttributeKind::Float)]);
4989
4990 pub const CLIP: OperationContract = OperationContract::new(
4991 "oa::FnAudio::clip",
4992 0x2dfa67eb7d61140a,
4993 &[OpValueKind::Audio],
4994 &[OpValueKind::Audio],
4995 )
4996 .with_shape_rule(OpShapeRule::MatchInput)
4997 .with_dtype_rule(OpDTypeRule::MatchInput)
4998 .with_differentiation(OpDifferentiation::None)
4999 .with_lowering(OpLowering::Dispatch)
5000 .with_fusion_class(OpFusionClass::Pointwise)
5001 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5002 .attributes(&[
5003 OpAttributeSpec::new("min", OpAttributeKind::Float),
5004 OpAttributeSpec::new("max", OpAttributeKind::Float),
5005 ]);
5006
5007 pub const SATURATE: OperationContract = OperationContract::new(
5008 "oa::FnAudio::saturate",
5009 0xe598248ac65c32c5,
5010 &[OpValueKind::Audio],
5011 &[OpValueKind::Audio],
5012 )
5013 .with_shape_rule(OpShapeRule::MatchInput)
5014 .with_dtype_rule(OpDTypeRule::MatchInput)
5015 .with_differentiation(OpDifferentiation::None)
5016 .with_lowering(OpLowering::Dispatch)
5017 .with_fusion_class(OpFusionClass::Pointwise)
5018 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5019 .attributes(&[
5020 OpAttributeSpec::new("driveDb", OpAttributeKind::Float),
5021 OpAttributeSpec::new("mix", OpAttributeKind::Float),
5022 ]);
5023
5024 pub const BIQUAD: OperationContract = OperationContract::new(
5025 "oa::FnAudio::biquad",
5026 0x23fd6d9e94c95487,
5027 &[OpValueKind::Audio],
5028 &[OpValueKind::Audio],
5029 )
5030 .with_shape_rule(OpShapeRule::MatchInput)
5031 .with_dtype_rule(OpDTypeRule::MatchInput)
5032 .with_differentiation(OpDifferentiation::None)
5033 .with_lowering(OpLowering::Dispatch)
5034 .with_fusion_class(OpFusionClass::Scan)
5035 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5036 .attributes(&[
5037 OpAttributeSpec::new("b0", OpAttributeKind::Float),
5038 OpAttributeSpec::new("b1", OpAttributeKind::Float),
5039 OpAttributeSpec::new("b2", OpAttributeKind::Float),
5040 OpAttributeSpec::new("a1", OpAttributeKind::Float),
5041 OpAttributeSpec::new("a2", OpAttributeKind::Float),
5042 ]);
5043
5044 pub const REVERB: OperationContract = OperationContract::new(
5045 "oa::FnAudio::reverb",
5046 0xcc6a9fdc21b539fb,
5047 &[OpValueKind::Audio],
5048 &[OpValueKind::Audio],
5049 )
5050 .with_shape_rule(OpShapeRule::Explicit)
5051 .with_dtype_rule(OpDTypeRule::MatchInput)
5052 .with_differentiation(OpDifferentiation::None)
5053 .with_lowering(OpLowering::Dispatch)
5054 .with_fusion_class(OpFusionClass::Effect)
5055 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5056 .attributes(&[
5057 OpAttributeSpec::new("decaySeconds", OpAttributeKind::Float),
5058 OpAttributeSpec::new("wet", OpAttributeKind::Float),
5059 ]);
5060
5061 pub const SOS_FILTER: OperationContract = OperationContract::new(
5062 "oa::FnAudio::sosFilter",
5063 0x23be119427a61f79,
5064 &[OpValueKind::Audio],
5065 &[OpValueKind::Audio],
5066 )
5067 .with_shape_rule(OpShapeRule::MatchInput)
5068 .with_dtype_rule(OpDTypeRule::MatchInput)
5069 .with_differentiation(OpDifferentiation::None)
5070 .with_lowering(OpLowering::Dispatch)
5071 .with_fusion_class(OpFusionClass::Scan)
5072 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5073 .attributes(&[
5074 OpAttributeSpec::new("sectionCount", OpAttributeKind::UnsignedInteger),
5075 OpAttributeSpec::new("coefficientHash", OpAttributeKind::UnsignedInteger),
5076 ]);
5077
5078 pub const PRE_EMPHASIS: OperationContract = OperationContract::new(
5079 "oa::FnAudio::preEmphasis",
5080 0x5dbc1e205f05bf1c,
5081 &[OpValueKind::Audio],
5082 &[OpValueKind::Audio],
5083 )
5084 .with_shape_rule(OpShapeRule::MatchInput)
5085 .with_dtype_rule(OpDTypeRule::MatchInput)
5086 .with_differentiation(OpDifferentiation::None)
5087 .with_lowering(OpLowering::Dispatch)
5088 .with_fusion_class(OpFusionClass::Pointwise)
5089 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5090 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
5091
5092 pub const TO_MONO: OperationContract = OperationContract::new(
5093 "oa::FnAudio::toMono",
5094 0x53dfa71239b47ce0,
5095 &[OpValueKind::Audio],
5096 &[OpValueKind::Audio],
5097 )
5098 .with_shape_rule(OpShapeRule::Explicit)
5099 .with_dtype_rule(OpDTypeRule::MatchInput)
5100 .with_differentiation(OpDifferentiation::None)
5101 .with_lowering(OpLowering::Dispatch)
5102 .with_fusion_class(OpFusionClass::Pointwise)
5103 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5104
5105 pub const FADE: OperationContract = OperationContract::new(
5106 "oa::FnAudio::fade",
5107 0x529b3b27f5964679,
5108 &[OpValueKind::Audio],
5109 &[OpValueKind::Audio],
5110 )
5111 .with_shape_rule(OpShapeRule::MatchInput)
5112 .with_dtype_rule(OpDTypeRule::MatchInput)
5113 .with_differentiation(OpDifferentiation::None)
5114 .with_lowering(OpLowering::Dispatch)
5115 .with_fusion_class(OpFusionClass::Pointwise)
5116 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5117 .attributes(&[
5118 OpAttributeSpec::new("fadeInSamples", OpAttributeKind::UnsignedInteger),
5119 OpAttributeSpec::new("fadeOutSamples", OpAttributeKind::UnsignedInteger),
5120 ]);
5121
5122 pub const MIX: OperationContract = OperationContract::new(
5123 "oa::FnAudio::mix",
5124 0xe0dc93d833b2fefe,
5125 &[OpValueKind::Audio, OpValueKind::Audio],
5126 &[OpValueKind::Audio],
5127 )
5128 .with_shape_rule(OpShapeRule::MatchInput)
5129 .with_dtype_rule(OpDTypeRule::MatchInput)
5130 .with_differentiation(OpDifferentiation::None)
5131 .with_lowering(OpLowering::Dispatch)
5132 .with_fusion_class(OpFusionClass::Pointwise)
5133 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5134 .attributes(&[
5135 OpAttributeSpec::new("gainA", OpAttributeKind::Float),
5136 OpAttributeSpec::new("gainB", OpAttributeKind::Float),
5137 ]);
5138
5139 pub const AMPLITUDE_TO_DB: OperationContract = OperationContract::new(
5140 "oa::FnAudio::amplitudeToDb",
5141 0x6915266b03878965,
5142 &[OpValueKind::Audio],
5143 &[OpValueKind::Matrix],
5144 )
5145 .with_shape_rule(OpShapeRule::MatchInput)
5146 .with_dtype_rule(OpDTypeRule::MatchInput)
5147 .with_differentiation(OpDifferentiation::None)
5148 .with_lowering(OpLowering::Dispatch)
5149 .with_fusion_class(OpFusionClass::Pointwise)
5150 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5151 .attributes(&[OpAttributeSpec::new("floorDb", OpAttributeKind::Float)]);
5152
5153 pub const WAVEFORM_ENVELOPE: OperationContract = OperationContract::new(
5154 "oa::FnAudio::waveformEnvelope",
5155 0x1396920e96be303b,
5156 &[OpValueKind::Audio],
5157 &[OpValueKind::Matrix],
5158 )
5159 .with_shape_rule(OpShapeRule::Explicit)
5160 .with_dtype_rule(OpDTypeRule::MatchInput)
5161 .with_differentiation(OpDifferentiation::None)
5162 .with_lowering(OpLowering::Dispatch)
5163 .with_fusion_class(OpFusionClass::Pointwise)
5164 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5165 .attributes(&[OpAttributeSpec::new(
5166 "bins",
5167 OpAttributeKind::UnsignedInteger,
5168 )]);
5169
5170 pub const STFT: OperationContract = OperationContract::new(
5171 "oa::FnAudio::stft",
5172 0x5b3d5e57c8c64cfa,
5173 &[OpValueKind::Audio],
5174 &[OpValueKind::Matrix],
5175 )
5176 .with_shape_rule(OpShapeRule::Explicit)
5177 .with_dtype_rule(OpDTypeRule::MatchInput)
5178 .with_differentiation(OpDifferentiation::None)
5179 .with_lowering(OpLowering::Dispatch)
5180 .with_fusion_class(OpFusionClass::Effect)
5181 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5182 .attributes(&[
5183 OpAttributeSpec::new("fftSize", OpAttributeKind::UnsignedInteger),
5184 OpAttributeSpec::new("hopSize", OpAttributeKind::UnsignedInteger),
5185 OpAttributeSpec::new("winSize", OpAttributeKind::UnsignedInteger),
5186 OpAttributeSpec::new("window", OpAttributeKind::UnsignedInteger),
5187 OpAttributeSpec::new("center", OpAttributeKind::Boolean),
5188 ]);
5189
5190 pub const STFT_COMPLEX: OperationContract = OperationContract::new(
5191 "oa::audio::stft_complex",
5192 0x48b250bc5761b8fe,
5193 &[OpValueKind::Audio],
5194 &[OpValueKind::Matrix],
5195 )
5196 .with_shape_rule(OpShapeRule::Explicit)
5197 .with_dtype_rule(OpDTypeRule::MatchInput)
5198 .with_differentiation(OpDifferentiation::Reverse)
5199 .with_lowering(OpLowering::Dispatch)
5200 .with_fusion_class(OpFusionClass::Effect)
5201 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5202 .attributes(&[
5203 OpAttributeSpec::new("fftSize", OpAttributeKind::UnsignedInteger),
5204 OpAttributeSpec::new("hopSize", OpAttributeKind::UnsignedInteger),
5205 OpAttributeSpec::new("winSize", OpAttributeKind::UnsignedInteger),
5206 OpAttributeSpec::new("window", OpAttributeKind::UnsignedInteger),
5207 OpAttributeSpec::new("center", OpAttributeKind::Boolean),
5208 ]);
5209
5210 pub const ISTFT: OperationContract = OperationContract::new(
5211 "oa::audio::istft",
5212 0x101dd193d1458452,
5213 &[OpValueKind::Matrix],
5214 &[OpValueKind::Audio],
5215 )
5216 .with_shape_rule(OpShapeRule::Explicit)
5217 .with_dtype_rule(OpDTypeRule::MatchInput)
5218 .with_differentiation(OpDifferentiation::Reverse)
5219 .with_lowering(OpLowering::Dispatch)
5220 .with_fusion_class(OpFusionClass::Effect)
5221 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5222 .attributes(&[
5223 OpAttributeSpec::new("fftSize", OpAttributeKind::UnsignedInteger),
5224 OpAttributeSpec::new("hopSize", OpAttributeKind::UnsignedInteger),
5225 OpAttributeSpec::new("winSize", OpAttributeKind::UnsignedInteger),
5226 OpAttributeSpec::new("window", OpAttributeKind::UnsignedInteger),
5227 OpAttributeSpec::new("center", OpAttributeKind::Boolean),
5228 ]);
5229
5230 pub const MEL_SPECTROGRAM: OperationContract = OperationContract::new(
5231 "oa::FnAudio::melSpectrogram",
5232 0xf629d11d0b35e9bb,
5233 &[OpValueKind::Audio],
5234 &[OpValueKind::Matrix],
5235 )
5236 .with_shape_rule(OpShapeRule::Explicit)
5237 .with_dtype_rule(OpDTypeRule::MatchInput)
5238 .with_differentiation(OpDifferentiation::None)
5239 .with_lowering(OpLowering::Dispatch)
5240 .with_fusion_class(OpFusionClass::Effect)
5241 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5242 .attributes(&[
5243 OpAttributeSpec::new("fftSize", OpAttributeKind::UnsignedInteger),
5244 OpAttributeSpec::new("hopSize", OpAttributeKind::UnsignedInteger),
5245 OpAttributeSpec::new("numMels", OpAttributeKind::UnsignedInteger),
5246 OpAttributeSpec::new("fMin", OpAttributeKind::Float),
5247 OpAttributeSpec::new("fMax", OpAttributeKind::Float),
5248 OpAttributeSpec::new("logScale", OpAttributeKind::Boolean),
5249 OpAttributeSpec::new("normalize", OpAttributeKind::Boolean),
5250 ]);
5251
5252 pub const MFCC: OperationContract = OperationContract::new(
5253 "oa::FnAudio::mfcc",
5254 0xdb0047ed6a8efa1f,
5255 &[OpValueKind::Audio],
5256 &[OpValueKind::Matrix],
5257 )
5258 .with_shape_rule(OpShapeRule::Explicit)
5259 .with_dtype_rule(OpDTypeRule::MatchInput)
5260 .with_differentiation(OpDifferentiation::None)
5261 .with_lowering(OpLowering::Dispatch)
5262 .with_fusion_class(OpFusionClass::Effect)
5263 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5264 .attributes(&[
5265 OpAttributeSpec::new("numCoeffs", OpAttributeKind::UnsignedInteger),
5266 OpAttributeSpec::new("fftSize", OpAttributeKind::UnsignedInteger),
5267 OpAttributeSpec::new("hopSize", OpAttributeKind::UnsignedInteger),
5268 OpAttributeSpec::new("numMels", OpAttributeKind::UnsignedInteger),
5269 OpAttributeSpec::new("fMin", OpAttributeKind::Float),
5270 OpAttributeSpec::new("fMax", OpAttributeKind::Float),
5271 OpAttributeSpec::new("logScale", OpAttributeKind::Boolean),
5272 OpAttributeSpec::new("normalize", OpAttributeKind::Boolean),
5273 ]);
5274}
5275
5276pub mod crypto {
5278 use super::*;
5279
5280 pub mod hash {
5281 use super::*;
5282
5283 pub const SHAKE128: OperationContract = OperationContract::new(
5284 "oa::FnHash::shake128",
5285 0xbd9efbc7ff544223,
5286 &[OpValueKind::Matrix],
5287 &[OpValueKind::Matrix],
5288 )
5289 .with_shape_rule(OpShapeRule::Explicit)
5290 .with_dtype_rule(OpDTypeRule::MatchInput)
5291 .with_differentiation(OpDifferentiation::None)
5292 .with_lowering(OpLowering::Dispatch)
5293 .with_fusion_class(OpFusionClass::Effect)
5294 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5295 .attributes(&[OpAttributeSpec::new(
5296 "outputLength",
5297 OpAttributeKind::UnsignedInteger,
5298 )]);
5299
5300 pub const SHAKE256: OperationContract = OperationContract::new(
5301 "oa::FnHash::shake256",
5302 0x500f43f9653f5459,
5303 &[OpValueKind::Matrix],
5304 &[OpValueKind::Matrix],
5305 )
5306 .with_shape_rule(OpShapeRule::Explicit)
5307 .with_dtype_rule(OpDTypeRule::MatchInput)
5308 .with_differentiation(OpDifferentiation::None)
5309 .with_lowering(OpLowering::Dispatch)
5310 .with_fusion_class(OpFusionClass::Effect)
5311 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5312 .attributes(&[OpAttributeSpec::new(
5313 "outputLength",
5314 OpAttributeKind::UnsignedInteger,
5315 )]);
5316
5317 pub const KECCAK_F1600: OperationContract = OperationContract::new(
5318 "oa::FnHash::keccakF1600",
5319 0x01141f39576e17bc,
5320 &[OpValueKind::Matrix],
5321 &[OpValueKind::Matrix],
5322 )
5323 .with_shape_rule(OpShapeRule::MatchInput)
5324 .with_dtype_rule(OpDTypeRule::MatchInput)
5325 .with_differentiation(OpDifferentiation::None)
5326 .with_lowering(OpLowering::Dispatch)
5327 .with_fusion_class(OpFusionClass::Effect)
5328 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5329
5330 pub const MERKLE_ROOT: OperationContract = OperationContract::new(
5331 "oa::FnHash::merkleRoot",
5332 0xc92e4bfbdbcc4d22,
5333 &[OpValueKind::Matrix],
5334 &[OpValueKind::Matrix],
5335 )
5336 .with_shape_rule(OpShapeRule::Explicit)
5337 .with_dtype_rule(OpDTypeRule::MatchInput)
5338 .with_differentiation(OpDifferentiation::None)
5339 .with_lowering(OpLowering::Dispatch)
5340 .with_fusion_class(OpFusionClass::Effect)
5341 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5342 .with_control_flow(OpControlFlow::Loop);
5343
5344 pub const SHA224: OperationContract = OperationContract::new(
5345 "oa::crypto::hash::sha224",
5346 0xa9edb01257e6d4ac,
5347 &[OpValueKind::Matrix],
5348 &[OpValueKind::Matrix],
5349 )
5350 .with_shape_rule(OpShapeRule::Explicit)
5351 .with_dtype_rule(OpDTypeRule::Explicit)
5352 .with_differentiation(OpDifferentiation::None)
5353 .with_lowering(OpLowering::Dispatch)
5354 .with_fusion_class(OpFusionClass::Effect)
5355 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5356
5357 pub const SHA256: OperationContract = OperationContract::new(
5358 "oa::crypto::hash::sha256",
5359 0x0b065b9dfe33b5fd,
5360 &[OpValueKind::Matrix],
5361 &[OpValueKind::Matrix],
5362 )
5363 .with_shape_rule(OpShapeRule::Explicit)
5364 .with_dtype_rule(OpDTypeRule::Explicit)
5365 .with_differentiation(OpDifferentiation::None)
5366 .with_lowering(OpLowering::Dispatch)
5367 .with_fusion_class(OpFusionClass::Effect)
5368 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5369
5370 pub const SHA384: OperationContract = OperationContract::new(
5371 "oa::crypto::hash::sha384",
5372 0xac557ed2ef16871d,
5373 &[OpValueKind::Matrix],
5374 &[OpValueKind::Matrix],
5375 )
5376 .with_shape_rule(OpShapeRule::Explicit)
5377 .with_dtype_rule(OpDTypeRule::Explicit)
5378 .with_differentiation(OpDifferentiation::None)
5379 .with_lowering(OpLowering::Dispatch)
5380 .with_fusion_class(OpFusionClass::Effect)
5381 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5382
5383 pub const SHA512: OperationContract = OperationContract::new(
5384 "oa::crypto::hash::sha512",
5385 0x1614e98a0a709ca9,
5386 &[OpValueKind::Matrix],
5387 &[OpValueKind::Matrix],
5388 )
5389 .with_shape_rule(OpShapeRule::Explicit)
5390 .with_dtype_rule(OpDTypeRule::Explicit)
5391 .with_differentiation(OpDifferentiation::None)
5392 .with_lowering(OpLowering::Dispatch)
5393 .with_fusion_class(OpFusionClass::Effect)
5394 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5395
5396 pub const SHA512_224: OperationContract = OperationContract::new(
5397 "oa::crypto::hash::sha512_224",
5398 0x84b37ac2a2e70731,
5399 &[OpValueKind::Matrix],
5400 &[OpValueKind::Matrix],
5401 )
5402 .with_shape_rule(OpShapeRule::Explicit)
5403 .with_dtype_rule(OpDTypeRule::Explicit)
5404 .with_differentiation(OpDifferentiation::None)
5405 .with_lowering(OpLowering::Dispatch)
5406 .with_fusion_class(OpFusionClass::Effect)
5407 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5408
5409 pub const SHA512_256: OperationContract = OperationContract::new(
5410 "oa::crypto::hash::sha512_256",
5411 0xd944530da015695a,
5412 &[OpValueKind::Matrix],
5413 &[OpValueKind::Matrix],
5414 )
5415 .with_shape_rule(OpShapeRule::Explicit)
5416 .with_dtype_rule(OpDTypeRule::Explicit)
5417 .with_differentiation(OpDifferentiation::None)
5418 .with_lowering(OpLowering::Dispatch)
5419 .with_fusion_class(OpFusionClass::Effect)
5420 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5421
5422 pub const SHA3_224: OperationContract = OperationContract::new(
5423 "oa::crypto::hash::sha3_224",
5424 0x5720a5baae1f5a8b,
5425 &[OpValueKind::Matrix],
5426 &[OpValueKind::Matrix],
5427 )
5428 .with_shape_rule(OpShapeRule::Explicit)
5429 .with_dtype_rule(OpDTypeRule::Explicit)
5430 .with_differentiation(OpDifferentiation::None)
5431 .with_lowering(OpLowering::Dispatch)
5432 .with_fusion_class(OpFusionClass::Effect)
5433 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5434
5435 pub const SHA3_256: OperationContract = OperationContract::new(
5436 "oa::crypto::hash::sha3_256",
5437 0x76d9a0e7c6e27ed7,
5438 &[OpValueKind::Matrix],
5439 &[OpValueKind::Matrix],
5440 )
5441 .with_shape_rule(OpShapeRule::Explicit)
5442 .with_dtype_rule(OpDTypeRule::Explicit)
5443 .with_differentiation(OpDifferentiation::None)
5444 .with_lowering(OpLowering::Dispatch)
5445 .with_fusion_class(OpFusionClass::Effect)
5446 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5447
5448 pub const SHA3_384: OperationContract = OperationContract::new(
5449 "oa::crypto::hash::sha3_384",
5450 0x6852d648a8c2d8e7,
5451 &[OpValueKind::Matrix],
5452 &[OpValueKind::Matrix],
5453 )
5454 .with_shape_rule(OpShapeRule::Explicit)
5455 .with_dtype_rule(OpDTypeRule::Explicit)
5456 .with_differentiation(OpDifferentiation::None)
5457 .with_lowering(OpLowering::Dispatch)
5458 .with_fusion_class(OpFusionClass::Effect)
5459 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5460
5461 pub const SHA3_512: OperationContract = OperationContract::new(
5462 "oa::crypto::hash::sha3_512",
5463 0x9811a20e3396bdce,
5464 &[OpValueKind::Matrix],
5465 &[OpValueKind::Matrix],
5466 )
5467 .with_shape_rule(OpShapeRule::Explicit)
5468 .with_dtype_rule(OpDTypeRule::Explicit)
5469 .with_differentiation(OpDifferentiation::None)
5470 .with_lowering(OpLowering::Dispatch)
5471 .with_fusion_class(OpFusionClass::Effect)
5472 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5473
5474 pub const MERKLE_PROOFS: OperationContract = OperationContract::new(
5475 "oa::crypto::hash::merkle_proofs",
5476 0xb6411e72954d6e16,
5477 &[OpValueKind::Matrix, OpValueKind::Matrix],
5478 &[OpValueKind::Matrix],
5479 )
5480 .with_shape_rule(OpShapeRule::Explicit)
5481 .with_dtype_rule(OpDTypeRule::Explicit)
5482 .with_differentiation(OpDifferentiation::None)
5483 .with_lowering(OpLowering::Dispatch)
5484 .with_fusion_class(OpFusionClass::Effect)
5485 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5486
5487 pub const VERIFY_MERKLE_PROOFS: OperationContract = OperationContract::new(
5488 "oa::crypto::hash::verify_merkle_proofs",
5489 0x6245685dcf163ed2,
5490 &[
5491 OpValueKind::Matrix,
5492 OpValueKind::Matrix,
5493 OpValueKind::Matrix,
5494 ],
5495 &[OpValueKind::Matrix],
5496 )
5497 .with_shape_rule(OpShapeRule::Explicit)
5498 .with_dtype_rule(OpDTypeRule::Explicit)
5499 .with_differentiation(OpDifferentiation::None)
5500 .with_lowering(OpLowering::Dispatch)
5501 .with_fusion_class(OpFusionClass::Effect)
5502 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5503 .attributes(&[OpAttributeSpec::new(
5504 "leaf_count",
5505 OpAttributeKind::UnsignedInteger,
5506 )]);
5507
5508 pub const POSEIDON2_BABYBEAR16: OperationContract = OperationContract::new(
5509 "oa::crypto::hash::poseidon2_babybear16",
5510 0xe278ade953a849dc,
5511 &[OpValueKind::Matrix],
5512 &[OpValueKind::Matrix],
5513 )
5514 .with_shape_rule(OpShapeRule::Explicit)
5515 .with_dtype_rule(OpDTypeRule::Explicit)
5516 .with_differentiation(OpDifferentiation::None)
5517 .with_lowering(OpLowering::Dispatch)
5518 .with_fusion_class(OpFusionClass::Effect)
5519 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5520 .attributes(&[OpAttributeSpec::new(
5521 "output_length",
5522 OpAttributeKind::UnsignedInteger,
5523 )]);
5524
5525 pub const POSEIDON2_BABYBEAR16_PERMUTE: OperationContract = OperationContract::new(
5526 "oa::crypto::hash::poseidon2_babybear16_permute",
5527 0xd3967922b0b9c95a,
5528 &[OpValueKind::Matrix],
5529 &[OpValueKind::Matrix],
5530 )
5531 .with_shape_rule(OpShapeRule::Explicit)
5532 .with_dtype_rule(OpDTypeRule::Explicit)
5533 .with_differentiation(OpDifferentiation::None)
5534 .with_lowering(OpLowering::Dispatch)
5535 .with_fusion_class(OpFusionClass::Effect)
5536 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5537
5538 pub const POSEIDON2_BABYBEAR24: OperationContract = OperationContract::new(
5539 "oa::crypto::hash::poseidon2_babybear24",
5540 0x11db3c7a2eb7f83a,
5541 &[OpValueKind::Matrix],
5542 &[OpValueKind::Matrix],
5543 )
5544 .with_shape_rule(OpShapeRule::Explicit)
5545 .with_dtype_rule(OpDTypeRule::Explicit)
5546 .with_differentiation(OpDifferentiation::None)
5547 .with_lowering(OpLowering::Dispatch)
5548 .with_fusion_class(OpFusionClass::Effect)
5549 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5550 .attributes(&[OpAttributeSpec::new(
5551 "output_length",
5552 OpAttributeKind::UnsignedInteger,
5553 )]);
5554
5555 pub const POSEIDON2_BABYBEAR24_PERMUTE: OperationContract = OperationContract::new(
5556 "oa::crypto::hash::poseidon2_babybear24_permute",
5557 0x1499b286dd3e28fc,
5558 &[OpValueKind::Matrix],
5559 &[OpValueKind::Matrix],
5560 )
5561 .with_shape_rule(OpShapeRule::Explicit)
5562 .with_dtype_rule(OpDTypeRule::Explicit)
5563 .with_differentiation(OpDifferentiation::None)
5564 .with_lowering(OpLowering::Dispatch)
5565 .with_fusion_class(OpFusionClass::Effect)
5566 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5567
5568 pub const POSEIDON2_KOALABEAR16: OperationContract = OperationContract::new(
5569 "oa::crypto::hash::poseidon2_koalabear16",
5570 0xd389f2479e2f6651,
5571 &[OpValueKind::Matrix],
5572 &[OpValueKind::Matrix],
5573 )
5574 .with_shape_rule(OpShapeRule::Explicit)
5575 .with_dtype_rule(OpDTypeRule::Explicit)
5576 .with_differentiation(OpDifferentiation::None)
5577 .with_lowering(OpLowering::Dispatch)
5578 .with_fusion_class(OpFusionClass::Effect)
5579 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5580 .attributes(&[OpAttributeSpec::new(
5581 "output_length",
5582 OpAttributeKind::UnsignedInteger,
5583 )]);
5584
5585 pub const POSEIDON2_KOALABEAR16_PERMUTE: OperationContract = OperationContract::new(
5586 "oa::crypto::hash::poseidon2_koalabear16_permute",
5587 0x60d44c7387ebf75d,
5588 &[OpValueKind::Matrix],
5589 &[OpValueKind::Matrix],
5590 )
5591 .with_shape_rule(OpShapeRule::Explicit)
5592 .with_dtype_rule(OpDTypeRule::Explicit)
5593 .with_differentiation(OpDifferentiation::None)
5594 .with_lowering(OpLowering::Dispatch)
5595 .with_fusion_class(OpFusionClass::Effect)
5596 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5597
5598 pub const POSEIDON2_KOALABEAR24: OperationContract = OperationContract::new(
5599 "oa::crypto::hash::poseidon2_koalabear24",
5600 0x6268c99ce8f6d2c7,
5601 &[OpValueKind::Matrix],
5602 &[OpValueKind::Matrix],
5603 )
5604 .with_shape_rule(OpShapeRule::Explicit)
5605 .with_dtype_rule(OpDTypeRule::Explicit)
5606 .with_differentiation(OpDifferentiation::None)
5607 .with_lowering(OpLowering::Dispatch)
5608 .with_fusion_class(OpFusionClass::Effect)
5609 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5610 .attributes(&[OpAttributeSpec::new(
5611 "output_length",
5612 OpAttributeKind::UnsignedInteger,
5613 )]);
5614
5615 pub const POSEIDON2_KOALABEAR24_PERMUTE: OperationContract = OperationContract::new(
5616 "oa::crypto::hash::poseidon2_koalabear24_permute",
5617 0xabdec67e0639c7dd,
5618 &[OpValueKind::Matrix],
5619 &[OpValueKind::Matrix],
5620 )
5621 .with_shape_rule(OpShapeRule::Explicit)
5622 .with_dtype_rule(OpDTypeRule::Explicit)
5623 .with_differentiation(OpDifferentiation::None)
5624 .with_lowering(OpLowering::Dispatch)
5625 .with_fusion_class(OpFusionClass::Effect)
5626 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
5627 }
5628
5629 pub mod bigint {
5630 use super::*;
5631
5632 pub const ADD: OperationContract = OperationContract::new(
5633 "oa::crypto::bigint::add",
5634 0xe45af01ff46862ec,
5635 &[OpValueKind::Matrix, OpValueKind::Matrix],
5636 &[OpValueKind::Matrix],
5637 )
5638 .with_shape_rule(OpShapeRule::Explicit)
5639 .with_dtype_rule(OpDTypeRule::Explicit)
5640 .with_differentiation(OpDifferentiation::None)
5641 .with_lowering(OpLowering::Dispatch)
5642 .with_fusion_class(OpFusionClass::Effect)
5643 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5644 .attributes(&[OpAttributeSpec::new(
5645 "width_bits",
5646 OpAttributeKind::UnsignedInteger,
5647 )]);
5648
5649 pub const SUBTRACT: OperationContract = OperationContract::new(
5650 "oa::crypto::bigint::subtract",
5651 0xd458c0ec04031dad,
5652 &[OpValueKind::Matrix, OpValueKind::Matrix],
5653 &[OpValueKind::Matrix],
5654 )
5655 .with_shape_rule(OpShapeRule::Explicit)
5656 .with_dtype_rule(OpDTypeRule::Explicit)
5657 .with_differentiation(OpDifferentiation::None)
5658 .with_lowering(OpLowering::Dispatch)
5659 .with_fusion_class(OpFusionClass::Effect)
5660 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5661 .attributes(&[OpAttributeSpec::new(
5662 "width_bits",
5663 OpAttributeKind::UnsignedInteger,
5664 )]);
5665
5666 pub const MULTIPLY_LOW: OperationContract = OperationContract::new(
5667 "oa::crypto::bigint::multiply_low",
5668 0xaa153c3d7072673c,
5669 &[OpValueKind::Matrix, OpValueKind::Matrix],
5670 &[OpValueKind::Matrix],
5671 )
5672 .with_shape_rule(OpShapeRule::Explicit)
5673 .with_dtype_rule(OpDTypeRule::Explicit)
5674 .with_differentiation(OpDifferentiation::None)
5675 .with_lowering(OpLowering::Dispatch)
5676 .with_fusion_class(OpFusionClass::Effect)
5677 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5678 .attributes(&[OpAttributeSpec::new(
5679 "width_bits",
5680 OpAttributeKind::UnsignedInteger,
5681 )]);
5682
5683 pub const MULTIPLY_WIDE: OperationContract = OperationContract::new(
5684 "oa::crypto::bigint::multiply_wide",
5685 0xbf3d81cec8af9834,
5686 &[OpValueKind::Matrix, OpValueKind::Matrix],
5687 &[OpValueKind::Matrix],
5688 )
5689 .with_shape_rule(OpShapeRule::Explicit)
5690 .with_dtype_rule(OpDTypeRule::Explicit)
5691 .with_differentiation(OpDifferentiation::None)
5692 .with_lowering(OpLowering::Dispatch)
5693 .with_fusion_class(OpFusionClass::Effect)
5694 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5695 .attributes(&[OpAttributeSpec::new(
5696 "width_bits",
5697 OpAttributeKind::UnsignedInteger,
5698 )]);
5699
5700 pub const BIT_AND: OperationContract = OperationContract::new(
5701 "oa::crypto::bigint::bit_and",
5702 0xdc040b36ff910780,
5703 &[OpValueKind::Matrix, OpValueKind::Matrix],
5704 &[OpValueKind::Matrix],
5705 )
5706 .with_shape_rule(OpShapeRule::Explicit)
5707 .with_dtype_rule(OpDTypeRule::Explicit)
5708 .with_differentiation(OpDifferentiation::None)
5709 .with_lowering(OpLowering::Dispatch)
5710 .with_fusion_class(OpFusionClass::Effect)
5711 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5712 .attributes(&[OpAttributeSpec::new(
5713 "width_bits",
5714 OpAttributeKind::UnsignedInteger,
5715 )]);
5716
5717 pub const BIT_OR: OperationContract = OperationContract::new(
5718 "oa::crypto::bigint::bit_or",
5719 0xba087fa880caa672,
5720 &[OpValueKind::Matrix, OpValueKind::Matrix],
5721 &[OpValueKind::Matrix],
5722 )
5723 .with_shape_rule(OpShapeRule::Explicit)
5724 .with_dtype_rule(OpDTypeRule::Explicit)
5725 .with_differentiation(OpDifferentiation::None)
5726 .with_lowering(OpLowering::Dispatch)
5727 .with_fusion_class(OpFusionClass::Effect)
5728 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5729 .attributes(&[OpAttributeSpec::new(
5730 "width_bits",
5731 OpAttributeKind::UnsignedInteger,
5732 )]);
5733
5734 pub const BIT_XOR: OperationContract = OperationContract::new(
5735 "oa::crypto::bigint::bit_xor",
5736 0xe88edde571b8e35f,
5737 &[OpValueKind::Matrix, OpValueKind::Matrix],
5738 &[OpValueKind::Matrix],
5739 )
5740 .with_shape_rule(OpShapeRule::Explicit)
5741 .with_dtype_rule(OpDTypeRule::Explicit)
5742 .with_differentiation(OpDifferentiation::None)
5743 .with_lowering(OpLowering::Dispatch)
5744 .with_fusion_class(OpFusionClass::Effect)
5745 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5746 .attributes(&[OpAttributeSpec::new(
5747 "width_bits",
5748 OpAttributeKind::UnsignedInteger,
5749 )]);
5750
5751 pub const COMPARE: OperationContract = OperationContract::new(
5752 "oa::crypto::bigint::compare",
5753 0x5e02665ada69cbad,
5754 &[OpValueKind::Matrix, OpValueKind::Matrix],
5755 &[OpValueKind::Matrix],
5756 )
5757 .with_shape_rule(OpShapeRule::Explicit)
5758 .with_dtype_rule(OpDTypeRule::Explicit)
5759 .with_differentiation(OpDifferentiation::None)
5760 .with_lowering(OpLowering::Dispatch)
5761 .with_fusion_class(OpFusionClass::Effect)
5762 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5763 .attributes(&[OpAttributeSpec::new(
5764 "width_bits",
5765 OpAttributeKind::UnsignedInteger,
5766 )]);
5767
5768 pub const DIV_REM: OperationContract = OperationContract::new(
5769 "oa::crypto::bigint::div_rem",
5770 0x258cba987c4ae606,
5771 &[OpValueKind::Matrix, OpValueKind::Matrix],
5772 &[
5773 OpValueKind::Matrix,
5774 OpValueKind::Matrix,
5775 OpValueKind::Matrix,
5776 ],
5777 )
5778 .with_shape_rule(OpShapeRule::Explicit)
5779 .with_dtype_rule(OpDTypeRule::Explicit)
5780 .with_differentiation(OpDifferentiation::None)
5781 .with_lowering(OpLowering::Dispatch)
5782 .with_fusion_class(OpFusionClass::Effect)
5783 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5784 .attributes(&[OpAttributeSpec::new(
5785 "width_bits",
5786 OpAttributeKind::UnsignedInteger,
5787 )]);
5788
5789 pub const SHIFT_LEFT: OperationContract = OperationContract::new(
5790 "oa::crypto::bigint::shift_left",
5791 0xb7e6415c9d31f366,
5792 &[OpValueKind::Matrix],
5793 &[OpValueKind::Matrix],
5794 )
5795 .with_shape_rule(OpShapeRule::Explicit)
5796 .with_dtype_rule(OpDTypeRule::Explicit)
5797 .with_differentiation(OpDifferentiation::None)
5798 .with_lowering(OpLowering::Dispatch)
5799 .with_fusion_class(OpFusionClass::Effect)
5800 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5801 .attributes(&[
5802 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
5803 OpAttributeSpec::new("shift", OpAttributeKind::UnsignedInteger),
5804 ]);
5805
5806 pub const SHIFT_RIGHT: OperationContract = OperationContract::new(
5807 "oa::crypto::bigint::shift_right",
5808 0x4871217499b9dafb,
5809 &[OpValueKind::Matrix],
5810 &[OpValueKind::Matrix],
5811 )
5812 .with_shape_rule(OpShapeRule::Explicit)
5813 .with_dtype_rule(OpDTypeRule::Explicit)
5814 .with_differentiation(OpDifferentiation::None)
5815 .with_lowering(OpLowering::Dispatch)
5816 .with_fusion_class(OpFusionClass::Effect)
5817 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5818 .attributes(&[
5819 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
5820 OpAttributeSpec::new("shift", OpAttributeKind::UnsignedInteger),
5821 ]);
5822
5823 pub const REDUCE_MOD: OperationContract = OperationContract::new(
5824 "oa::crypto::bigint::reduce_mod",
5825 0xfa1930c6591f7d83,
5826 &[OpValueKind::Matrix, OpValueKind::Matrix],
5827 &[OpValueKind::Matrix, OpValueKind::Matrix],
5828 )
5829 .with_shape_rule(OpShapeRule::Explicit)
5830 .with_dtype_rule(OpDTypeRule::Explicit)
5831 .with_differentiation(OpDifferentiation::None)
5832 .with_lowering(OpLowering::Dispatch)
5833 .with_fusion_class(OpFusionClass::Effect)
5834 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5835 .attributes(&[OpAttributeSpec::new(
5836 "width_bits",
5837 OpAttributeKind::UnsignedInteger,
5838 )]);
5839
5840 pub const ADD_MOD: OperationContract = OperationContract::new(
5841 "oa::crypto::bigint::add_mod",
5842 0xf5124902d1b60cb8,
5843 &[
5844 OpValueKind::Matrix,
5845 OpValueKind::Matrix,
5846 OpValueKind::Matrix,
5847 ],
5848 &[OpValueKind::Matrix, OpValueKind::Matrix],
5849 )
5850 .with_shape_rule(OpShapeRule::Explicit)
5851 .with_dtype_rule(OpDTypeRule::Explicit)
5852 .with_differentiation(OpDifferentiation::None)
5853 .with_lowering(OpLowering::Dispatch)
5854 .with_fusion_class(OpFusionClass::Effect)
5855 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5856 .attributes(&[OpAttributeSpec::new(
5857 "width_bits",
5858 OpAttributeKind::UnsignedInteger,
5859 )]);
5860
5861 pub const SUBTRACT_MOD: OperationContract = OperationContract::new(
5862 "oa::crypto::bigint::subtract_mod",
5863 0xa2c2b1f12182c9b2,
5864 &[
5865 OpValueKind::Matrix,
5866 OpValueKind::Matrix,
5867 OpValueKind::Matrix,
5868 ],
5869 &[OpValueKind::Matrix, OpValueKind::Matrix],
5870 )
5871 .with_shape_rule(OpShapeRule::Explicit)
5872 .with_dtype_rule(OpDTypeRule::Explicit)
5873 .with_differentiation(OpDifferentiation::None)
5874 .with_lowering(OpLowering::Dispatch)
5875 .with_fusion_class(OpFusionClass::Effect)
5876 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5877 .attributes(&[OpAttributeSpec::new(
5878 "width_bits",
5879 OpAttributeKind::UnsignedInteger,
5880 )]);
5881
5882 pub const MULTIPLY_MOD: OperationContract = OperationContract::new(
5883 "oa::crypto::bigint::multiply_mod",
5884 0x521494ebd3bed0f6,
5885 &[
5886 OpValueKind::Matrix,
5887 OpValueKind::Matrix,
5888 OpValueKind::Matrix,
5889 ],
5890 &[OpValueKind::Matrix, OpValueKind::Matrix],
5891 )
5892 .with_shape_rule(OpShapeRule::Explicit)
5893 .with_dtype_rule(OpDTypeRule::Explicit)
5894 .with_differentiation(OpDifferentiation::None)
5895 .with_lowering(OpLowering::Dispatch)
5896 .with_fusion_class(OpFusionClass::Effect)
5897 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5898 .attributes(&[OpAttributeSpec::new(
5899 "width_bits",
5900 OpAttributeKind::UnsignedInteger,
5901 )]);
5902
5903 pub const SQUARE_MOD: OperationContract = OperationContract::new(
5904 "oa::crypto::bigint::square_mod",
5905 0x18b05d4301761449,
5906 &[OpValueKind::Matrix, OpValueKind::Matrix],
5907 &[OpValueKind::Matrix, OpValueKind::Matrix],
5908 )
5909 .with_shape_rule(OpShapeRule::Explicit)
5910 .with_dtype_rule(OpDTypeRule::Explicit)
5911 .with_differentiation(OpDifferentiation::None)
5912 .with_lowering(OpLowering::Dispatch)
5913 .with_fusion_class(OpFusionClass::Effect)
5914 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5915 .attributes(&[OpAttributeSpec::new(
5916 "width_bits",
5917 OpAttributeKind::UnsignedInteger,
5918 )]);
5919
5920 pub const INVERSE_MOD: OperationContract = OperationContract::new(
5921 "oa::crypto::bigint::inverse_mod",
5922 0x59d63e5bedb1c89f,
5923 &[OpValueKind::Matrix, OpValueKind::Matrix],
5924 &[OpValueKind::Matrix, OpValueKind::Matrix],
5925 )
5926 .with_shape_rule(OpShapeRule::Explicit)
5927 .with_dtype_rule(OpDTypeRule::Explicit)
5928 .with_differentiation(OpDifferentiation::None)
5929 .with_lowering(OpLowering::Dispatch)
5930 .with_fusion_class(OpFusionClass::Effect)
5931 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5932 .attributes(&[OpAttributeSpec::new(
5933 "width_bits",
5934 OpAttributeKind::UnsignedInteger,
5935 )]);
5936
5937 pub const POW_MOD: OperationContract = OperationContract::new(
5938 "oa::crypto::bigint::pow_mod",
5939 0xb742ef6a6374b9e2,
5940 &[
5941 OpValueKind::Matrix,
5942 OpValueKind::Matrix,
5943 OpValueKind::Matrix,
5944 ],
5945 &[OpValueKind::Matrix, OpValueKind::Matrix],
5946 )
5947 .with_shape_rule(OpShapeRule::Explicit)
5948 .with_dtype_rule(OpDTypeRule::Explicit)
5949 .with_differentiation(OpDifferentiation::None)
5950 .with_lowering(OpLowering::Dispatch)
5951 .with_fusion_class(OpFusionClass::Effect)
5952 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5953 .attributes(&[OpAttributeSpec::new(
5954 "width_bits",
5955 OpAttributeKind::UnsignedInteger,
5956 )]);
5957
5958 pub const TO_MONTGOMERY: OperationContract = OperationContract::new(
5959 "oa::crypto::bigint::to_montgomery",
5960 0x79c81dd634540088,
5961 &[OpValueKind::Matrix, OpValueKind::Matrix],
5962 &[OpValueKind::Matrix, OpValueKind::Matrix],
5963 )
5964 .with_shape_rule(OpShapeRule::Explicit)
5965 .with_dtype_rule(OpDTypeRule::Explicit)
5966 .with_differentiation(OpDifferentiation::None)
5967 .with_lowering(OpLowering::Dispatch)
5968 .with_fusion_class(OpFusionClass::Effect)
5969 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5970 .attributes(&[OpAttributeSpec::new(
5971 "width_bits",
5972 OpAttributeKind::UnsignedInteger,
5973 )]);
5974
5975 pub const FROM_MONTGOMERY: OperationContract = OperationContract::new(
5976 "oa::crypto::bigint::from_montgomery",
5977 0x06df1bed0e96f370,
5978 &[OpValueKind::Matrix, OpValueKind::Matrix],
5979 &[OpValueKind::Matrix, OpValueKind::Matrix],
5980 )
5981 .with_shape_rule(OpShapeRule::Explicit)
5982 .with_dtype_rule(OpDTypeRule::Explicit)
5983 .with_differentiation(OpDifferentiation::None)
5984 .with_lowering(OpLowering::Dispatch)
5985 .with_fusion_class(OpFusionClass::Effect)
5986 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
5987 .attributes(&[OpAttributeSpec::new(
5988 "width_bits",
5989 OpAttributeKind::UnsignedInteger,
5990 )]);
5991
5992 pub const MONTGOMERY_MULTIPLY: OperationContract = OperationContract::new(
5993 "oa::crypto::bigint::montgomery_multiply",
5994 0x9147709fc8002281,
5995 &[
5996 OpValueKind::Matrix,
5997 OpValueKind::Matrix,
5998 OpValueKind::Matrix,
5999 ],
6000 &[OpValueKind::Matrix, OpValueKind::Matrix],
6001 )
6002 .with_shape_rule(OpShapeRule::Explicit)
6003 .with_dtype_rule(OpDTypeRule::Explicit)
6004 .with_differentiation(OpDifferentiation::None)
6005 .with_lowering(OpLowering::Dispatch)
6006 .with_fusion_class(OpFusionClass::Effect)
6007 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6008 .attributes(&[OpAttributeSpec::new(
6009 "width_bits",
6010 OpAttributeKind::UnsignedInteger,
6011 )]);
6012
6013 pub const BARRETT_MULTIPLY: OperationContract = OperationContract::new(
6014 "oa::crypto::bigint::barrett_multiply",
6015 0x5e38b25955739e89,
6016 &[
6017 OpValueKind::Matrix,
6018 OpValueKind::Matrix,
6019 OpValueKind::Matrix,
6020 ],
6021 &[OpValueKind::Matrix, OpValueKind::Matrix],
6022 )
6023 .with_shape_rule(OpShapeRule::Explicit)
6024 .with_dtype_rule(OpDTypeRule::Explicit)
6025 .with_differentiation(OpDifferentiation::None)
6026 .with_lowering(OpLowering::Dispatch)
6027 .with_fusion_class(OpFusionClass::Effect)
6028 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6029 .attributes(&[OpAttributeSpec::new(
6030 "width_bits",
6031 OpAttributeKind::UnsignedInteger,
6032 )]);
6033
6034 pub const MULTIPLY_HIGH: OperationContract = OperationContract::new(
6035 "oa::crypto::bigint::multiply_high",
6036 0x1618a6e51a322025,
6037 &[OpValueKind::Matrix, OpValueKind::Matrix],
6038 &[OpValueKind::Matrix],
6039 )
6040 .with_shape_rule(OpShapeRule::Explicit)
6041 .with_dtype_rule(OpDTypeRule::Explicit)
6042 .with_differentiation(OpDifferentiation::None)
6043 .with_lowering(OpLowering::Dispatch)
6044 .with_fusion_class(OpFusionClass::Effect)
6045 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6046 .attributes(&[OpAttributeSpec::new(
6047 "width_bits",
6048 OpAttributeKind::UnsignedInteger,
6049 )]);
6050
6051 pub const SQUARE_WIDE: OperationContract = OperationContract::new(
6052 "oa::crypto::bigint::square_wide",
6053 0x1a738fe2f9317a41,
6054 &[OpValueKind::Matrix],
6055 &[OpValueKind::Matrix],
6056 )
6057 .with_shape_rule(OpShapeRule::Explicit)
6058 .with_dtype_rule(OpDTypeRule::Explicit)
6059 .with_differentiation(OpDifferentiation::None)
6060 .with_lowering(OpLowering::Dispatch)
6061 .with_fusion_class(OpFusionClass::Effect)
6062 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6063 .attributes(&[OpAttributeSpec::new(
6064 "width_bits",
6065 OpAttributeKind::UnsignedInteger,
6066 )]);
6067
6068 pub const BIT_NOT: OperationContract = OperationContract::new(
6069 "oa::crypto::bigint::bit_not",
6070 0x6634eca83863bb53,
6071 &[OpValueKind::Matrix],
6072 &[OpValueKind::Matrix],
6073 )
6074 .with_shape_rule(OpShapeRule::Explicit)
6075 .with_dtype_rule(OpDTypeRule::Explicit)
6076 .with_differentiation(OpDifferentiation::None)
6077 .with_lowering(OpLowering::Dispatch)
6078 .with_fusion_class(OpFusionClass::Effect)
6079 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6080 .attributes(&[OpAttributeSpec::new(
6081 "width_bits",
6082 OpAttributeKind::UnsignedInteger,
6083 )]);
6084
6085 pub const LEADING_ZEROS: OperationContract = OperationContract::new(
6086 "oa::crypto::bigint::leading_zeros",
6087 0xd250b4aff6506484,
6088 &[OpValueKind::Matrix],
6089 &[OpValueKind::Matrix],
6090 )
6091 .with_shape_rule(OpShapeRule::Explicit)
6092 .with_dtype_rule(OpDTypeRule::Explicit)
6093 .with_differentiation(OpDifferentiation::None)
6094 .with_lowering(OpLowering::Dispatch)
6095 .with_fusion_class(OpFusionClass::Effect)
6096 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6097 .attributes(&[OpAttributeSpec::new(
6098 "width_bits",
6099 OpAttributeKind::UnsignedInteger,
6100 )]);
6101
6102 pub const ADD_SCALAR: OperationContract = OperationContract::new(
6103 "oa::crypto::bigint::add_scalar",
6104 0x3c732afcbc35d007,
6105 &[OpValueKind::Matrix],
6106 &[OpValueKind::Matrix],
6107 )
6108 .with_shape_rule(OpShapeRule::Explicit)
6109 .with_dtype_rule(OpDTypeRule::Explicit)
6110 .with_differentiation(OpDifferentiation::None)
6111 .with_lowering(OpLowering::Dispatch)
6112 .with_fusion_class(OpFusionClass::Effect)
6113 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6114 .attributes(&[
6115 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6116 OpAttributeSpec::new("scalar", OpAttributeKind::UnsignedInteger),
6117 ]);
6118
6119 pub const COMPARE_SCALAR: OperationContract = OperationContract::new(
6120 "oa::crypto::bigint::compare_scalar",
6121 0x70ed90573e5ad882,
6122 &[OpValueKind::Matrix],
6123 &[OpValueKind::Matrix],
6124 )
6125 .with_shape_rule(OpShapeRule::Explicit)
6126 .with_dtype_rule(OpDTypeRule::Explicit)
6127 .with_differentiation(OpDifferentiation::None)
6128 .with_lowering(OpLowering::Dispatch)
6129 .with_fusion_class(OpFusionClass::Effect)
6130 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6131 .attributes(&[
6132 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6133 OpAttributeSpec::new("scalar", OpAttributeKind::UnsignedInteger),
6134 ]);
6135
6136 pub const DIV_REM_MIXED: OperationContract = OperationContract::new(
6137 "oa::crypto::bigint::div_rem_mixed",
6138 0x62d14712e381e542,
6139 &[OpValueKind::Matrix, OpValueKind::Matrix],
6140 &[
6141 OpValueKind::Matrix,
6142 OpValueKind::Matrix,
6143 OpValueKind::Matrix,
6144 ],
6145 )
6146 .with_shape_rule(OpShapeRule::Explicit)
6147 .with_dtype_rule(OpDTypeRule::Explicit)
6148 .with_differentiation(OpDifferentiation::None)
6149 .with_lowering(OpLowering::Dispatch)
6150 .with_fusion_class(OpFusionClass::Effect)
6151 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6152 .attributes(&[
6153 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6154 OpAttributeSpec::new("quotient_words", OpAttributeKind::UnsignedInteger),
6155 ]);
6156
6157 pub const DIV_REM_NARROW: OperationContract = OperationContract::new(
6158 "oa::crypto::bigint::div_rem_narrow",
6159 0x0e0499d436e666e6,
6160 &[OpValueKind::Matrix, OpValueKind::Matrix],
6161 &[
6162 OpValueKind::Matrix,
6163 OpValueKind::Matrix,
6164 OpValueKind::Matrix,
6165 ],
6166 )
6167 .with_shape_rule(OpShapeRule::Explicit)
6168 .with_dtype_rule(OpDTypeRule::Explicit)
6169 .with_differentiation(OpDifferentiation::None)
6170 .with_lowering(OpLowering::Dispatch)
6171 .with_fusion_class(OpFusionClass::Effect)
6172 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6173 .attributes(&[OpAttributeSpec::new(
6174 "width_bits",
6175 OpAttributeKind::UnsignedInteger,
6176 )]);
6177
6178 pub const DIV_REM_SCALAR: OperationContract = OperationContract::new(
6179 "oa::crypto::bigint::div_rem_scalar",
6180 0x6b5295ef89611354,
6181 &[OpValueKind::Matrix],
6182 &[
6183 OpValueKind::Matrix,
6184 OpValueKind::Matrix,
6185 OpValueKind::Matrix,
6186 ],
6187 )
6188 .with_shape_rule(OpShapeRule::Explicit)
6189 .with_dtype_rule(OpDTypeRule::Explicit)
6190 .with_differentiation(OpDifferentiation::None)
6191 .with_lowering(OpLowering::Dispatch)
6192 .with_fusion_class(OpFusionClass::Effect)
6193 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6194 .attributes(&[
6195 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6196 OpAttributeSpec::new("scalar", OpAttributeKind::UnsignedInteger),
6197 ]);
6198
6199 pub const DIV_REM_WIDE: OperationContract = OperationContract::new(
6200 "oa::crypto::bigint::div_rem_wide",
6201 0x9581d4ea9aae4e1b,
6202 &[OpValueKind::Matrix, OpValueKind::Matrix],
6203 &[
6204 OpValueKind::Matrix,
6205 OpValueKind::Matrix,
6206 OpValueKind::Matrix,
6207 ],
6208 )
6209 .with_shape_rule(OpShapeRule::Explicit)
6210 .with_dtype_rule(OpDTypeRule::Explicit)
6211 .with_differentiation(OpDifferentiation::None)
6212 .with_lowering(OpLowering::Dispatch)
6213 .with_fusion_class(OpFusionClass::Effect)
6214 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6215 .attributes(&[OpAttributeSpec::new(
6216 "width_bits",
6217 OpAttributeKind::UnsignedInteger,
6218 )]);
6219
6220 pub const FROM_U32: OperationContract = OperationContract::new(
6221 "oa::crypto::bigint::from_u32",
6222 0xe0e5102c5407582e,
6223 &[OpValueKind::Matrix],
6224 &[OpValueKind::Matrix],
6225 )
6226 .with_shape_rule(OpShapeRule::Explicit)
6227 .with_dtype_rule(OpDTypeRule::Explicit)
6228 .with_differentiation(OpDifferentiation::None)
6229 .with_lowering(OpLowering::Dispatch)
6230 .with_fusion_class(OpFusionClass::Effect)
6231 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6232 .attributes(&[
6233 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6234 OpAttributeSpec::new("output_words", OpAttributeKind::UnsignedInteger),
6235 ]);
6236
6237 pub const FROM_U64: OperationContract = OperationContract::new(
6238 "oa::crypto::bigint::from_u64",
6239 0x11efb26f6525436c,
6240 &[OpValueKind::Matrix],
6241 &[OpValueKind::Matrix],
6242 )
6243 .with_shape_rule(OpShapeRule::Explicit)
6244 .with_dtype_rule(OpDTypeRule::Explicit)
6245 .with_differentiation(OpDifferentiation::None)
6246 .with_lowering(OpLowering::Dispatch)
6247 .with_fusion_class(OpFusionClass::Effect)
6248 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6249 .attributes(&[
6250 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6251 OpAttributeSpec::new("output_words", OpAttributeKind::UnsignedInteger),
6252 ]);
6253
6254 pub const MULTIPLY_SCALAR: OperationContract = OperationContract::new(
6255 "oa::crypto::bigint::multiply_scalar",
6256 0xb9084e26678935a6,
6257 &[OpValueKind::Matrix],
6258 &[OpValueKind::Matrix],
6259 )
6260 .with_shape_rule(OpShapeRule::Explicit)
6261 .with_dtype_rule(OpDTypeRule::Explicit)
6262 .with_differentiation(OpDifferentiation::None)
6263 .with_lowering(OpLowering::Dispatch)
6264 .with_fusion_class(OpFusionClass::Effect)
6265 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6266 .attributes(&[
6267 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6268 OpAttributeSpec::new("scalar", OpAttributeKind::UnsignedInteger),
6269 ]);
6270
6271 pub const REDUCE_MONTGOMERY: OperationContract = OperationContract::new(
6272 "oa::crypto::bigint::reduce_montgomery",
6273 0xe3d4000caeb79627,
6274 &[OpValueKind::Matrix, OpValueKind::Matrix],
6275 &[OpValueKind::Matrix, OpValueKind::Matrix],
6276 )
6277 .with_shape_rule(OpShapeRule::Explicit)
6278 .with_dtype_rule(OpDTypeRule::Explicit)
6279 .with_differentiation(OpDifferentiation::None)
6280 .with_lowering(OpLowering::Dispatch)
6281 .with_fusion_class(OpFusionClass::Effect)
6282 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6283 .attributes(&[OpAttributeSpec::new(
6284 "width_bits",
6285 OpAttributeKind::UnsignedInteger,
6286 )]);
6287
6288 pub const SUBTRACT_SCALAR: OperationContract = OperationContract::new(
6289 "oa::crypto::bigint::subtract_scalar",
6290 0x94e4db62d8c56151,
6291 &[OpValueKind::Matrix],
6292 &[OpValueKind::Matrix],
6293 )
6294 .with_shape_rule(OpShapeRule::Explicit)
6295 .with_dtype_rule(OpDTypeRule::Explicit)
6296 .with_differentiation(OpDifferentiation::None)
6297 .with_lowering(OpLowering::Dispatch)
6298 .with_fusion_class(OpFusionClass::Effect)
6299 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6300 .attributes(&[
6301 OpAttributeSpec::new("width_bits", OpAttributeKind::UnsignedInteger),
6302 OpAttributeSpec::new("scalar", OpAttributeKind::UnsignedInteger),
6303 ]);
6304
6305 pub const TO_U32: OperationContract = OperationContract::new(
6306 "oa::crypto::bigint::to_u32",
6307 0xc86dd9722a0d5c3b,
6308 &[OpValueKind::Matrix],
6309 &[OpValueKind::Matrix, OpValueKind::Matrix],
6310 )
6311 .with_shape_rule(OpShapeRule::Explicit)
6312 .with_dtype_rule(OpDTypeRule::Explicit)
6313 .with_differentiation(OpDifferentiation::None)
6314 .with_lowering(OpLowering::Dispatch)
6315 .with_fusion_class(OpFusionClass::Effect)
6316 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6317 .attributes(&[OpAttributeSpec::new(
6318 "width_bits",
6319 OpAttributeKind::UnsignedInteger,
6320 )]);
6321
6322 pub const TO_U64: OperationContract = OperationContract::new(
6323 "oa::crypto::bigint::to_u64",
6324 0xc5736bd1271cf355,
6325 &[OpValueKind::Matrix],
6326 &[OpValueKind::Matrix, OpValueKind::Matrix],
6327 )
6328 .with_shape_rule(OpShapeRule::Explicit)
6329 .with_dtype_rule(OpDTypeRule::Explicit)
6330 .with_differentiation(OpDifferentiation::None)
6331 .with_lowering(OpLowering::Dispatch)
6332 .with_fusion_class(OpFusionClass::Effect)
6333 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6334 .attributes(&[OpAttributeSpec::new(
6335 "width_bits",
6336 OpAttributeKind::UnsignedInteger,
6337 )]);
6338
6339 pub const SETUP_BARRETT: OperationContract = OperationContract::new(
6340 "oa::crypto::bigint::setup_barrett",
6341 0x06db47a02ca29f20,
6342 &[OpValueKind::Matrix],
6343 &[OpValueKind::Matrix, OpValueKind::Matrix],
6344 )
6345 .with_shape_rule(OpShapeRule::Explicit)
6346 .with_dtype_rule(OpDTypeRule::Explicit)
6347 .with_differentiation(OpDifferentiation::None)
6348 .with_lowering(OpLowering::Dispatch)
6349 .with_fusion_class(OpFusionClass::Effect)
6350 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6351 .attributes(&[OpAttributeSpec::new(
6352 "width_bits",
6353 OpAttributeKind::UnsignedInteger,
6354 )]);
6355
6356 pub const REDUCE_BARRETT: OperationContract = OperationContract::new(
6357 "oa::crypto::bigint::reduce_barrett",
6358 0x8e5e124b3cd08744,
6359 &[OpValueKind::Matrix, OpValueKind::Matrix],
6360 &[OpValueKind::Matrix, OpValueKind::Matrix],
6361 )
6362 .with_shape_rule(OpShapeRule::Explicit)
6363 .with_dtype_rule(OpDTypeRule::Explicit)
6364 .with_differentiation(OpDifferentiation::None)
6365 .with_lowering(OpLowering::Dispatch)
6366 .with_fusion_class(OpFusionClass::Effect)
6367 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6368 .attributes(&[OpAttributeSpec::new(
6369 "width_bits",
6370 OpAttributeKind::UnsignedInteger,
6371 )]);
6372 }
6373
6374 pub mod ntt {
6375 use super::*;
6376
6377 pub const NTT_TWIDDLES: OperationContract = OperationContract::new(
6378 "oa::crypto::ntt::ntt_twiddles",
6379 0x913b786a86988b4c,
6380 &[],
6381 &[OpValueKind::Matrix, OpValueKind::Matrix],
6382 )
6383 .with_shape_rule(OpShapeRule::Explicit)
6384 .with_dtype_rule(OpDTypeRule::Explicit)
6385 .with_differentiation(OpDifferentiation::None)
6386 .with_lowering(OpLowering::Dispatch)
6387 .with_fusion_class(OpFusionClass::Effect)
6388 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6389 .attributes(&[
6390 OpAttributeSpec::new("modulus", OpAttributeKind::UnsignedInteger),
6391 OpAttributeSpec::new("length", OpAttributeKind::UnsignedInteger),
6392 ]);
6393
6394 pub const NTT_REORDER: OperationContract = OperationContract::new(
6395 "oa::crypto::ntt::ntt_reorder",
6396 0xda48f9b39a4db871,
6397 &[OpValueKind::Matrix],
6398 &[OpValueKind::Matrix],
6399 )
6400 .with_shape_rule(OpShapeRule::Explicit)
6401 .with_dtype_rule(OpDTypeRule::Explicit)
6402 .with_differentiation(OpDifferentiation::None)
6403 .with_lowering(OpLowering::Dispatch)
6404 .with_fusion_class(OpFusionClass::Effect)
6405 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6406 .attributes(&[
6407 OpAttributeSpec::new("modulus", OpAttributeKind::UnsignedInteger),
6408 OpAttributeSpec::new("length", OpAttributeKind::UnsignedInteger),
6409 OpAttributeSpec::new("montgomery", OpAttributeKind::UnsignedInteger),
6410 ]);
6411
6412 pub const NTT_STAGE: OperationContract = OperationContract::new(
6413 "oa::crypto::ntt::ntt_stage",
6414 0xbc80857e94eced3b,
6415 &[OpValueKind::Matrix, OpValueKind::Matrix],
6416 &[OpValueKind::Matrix],
6417 )
6418 .with_shape_rule(OpShapeRule::Explicit)
6419 .with_dtype_rule(OpDTypeRule::Explicit)
6420 .with_differentiation(OpDifferentiation::None)
6421 .with_lowering(OpLowering::Dispatch)
6422 .with_fusion_class(OpFusionClass::Effect)
6423 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6424 .attributes(&[
6425 OpAttributeSpec::new("modulus", OpAttributeKind::UnsignedInteger),
6426 OpAttributeSpec::new("length", OpAttributeKind::UnsignedInteger),
6427 OpAttributeSpec::new("span", OpAttributeKind::UnsignedInteger),
6428 OpAttributeSpec::new("inverse", OpAttributeKind::UnsignedInteger),
6429 OpAttributeSpec::new("montgomery", OpAttributeKind::UnsignedInteger),
6430 ]);
6431
6432 pub const NTT_POINTWISE: OperationContract = OperationContract::new(
6433 "oa::crypto::ntt::ntt_pointwise",
6434 0x61a17c32454270bc,
6435 &[OpValueKind::Matrix, OpValueKind::Matrix],
6436 &[OpValueKind::Matrix],
6437 )
6438 .with_shape_rule(OpShapeRule::Explicit)
6439 .with_dtype_rule(OpDTypeRule::Explicit)
6440 .with_differentiation(OpDifferentiation::None)
6441 .with_lowering(OpLowering::Dispatch)
6442 .with_fusion_class(OpFusionClass::Effect)
6443 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6444 .attributes(&[
6445 OpAttributeSpec::new("modulus", OpAttributeKind::UnsignedInteger),
6446 OpAttributeSpec::new("length", OpAttributeKind::UnsignedInteger),
6447 OpAttributeSpec::new("montgomery", OpAttributeKind::UnsignedInteger),
6448 ]);
6449
6450 pub const NTT_TRANSFORM: OperationContract = OperationContract::new(
6451 "oa::crypto::ntt::ntt_transform",
6452 0x42043a7e7b805b45,
6453 &[OpValueKind::Matrix, OpValueKind::Matrix],
6454 &[OpValueKind::Matrix],
6455 )
6456 .with_shape_rule(OpShapeRule::Explicit)
6457 .with_dtype_rule(OpDTypeRule::Explicit)
6458 .with_differentiation(OpDifferentiation::None)
6459 .with_lowering(OpLowering::Dispatch)
6460 .with_fusion_class(OpFusionClass::Effect)
6461 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6462 .attributes(&[
6463 OpAttributeSpec::new("modulus", OpAttributeKind::UnsignedInteger),
6464 OpAttributeSpec::new("length", OpAttributeKind::UnsignedInteger),
6465 OpAttributeSpec::new("inverse", OpAttributeKind::UnsignedInteger),
6466 OpAttributeSpec::new("montgomery", OpAttributeKind::UnsignedInteger),
6467 ]);
6468
6469 pub const NTT_STAGE_FUSED: OperationContract = OperationContract::new(
6470 "oa::crypto::ntt::ntt_stage_fused",
6471 0x32123dddccba2f79,
6472 &[OpValueKind::Matrix, OpValueKind::Matrix],
6473 &[OpValueKind::Matrix],
6474 )
6475 .with_shape_rule(OpShapeRule::Explicit)
6476 .with_dtype_rule(OpDTypeRule::Explicit)
6477 .with_differentiation(OpDifferentiation::None)
6478 .with_lowering(OpLowering::Dispatch)
6479 .with_fusion_class(OpFusionClass::Effect)
6480 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6481 .attributes(&[
6482 OpAttributeSpec::new("modulus", OpAttributeKind::UnsignedInteger),
6483 OpAttributeSpec::new("length", OpAttributeKind::UnsignedInteger),
6484 OpAttributeSpec::new("inverse", OpAttributeKind::UnsignedInteger),
6485 ]);
6486 }
6487
6488 pub mod merkle {
6489 use super::*;
6490
6491 pub const MERKLE_TREE_REDUCE: OperationContract = OperationContract::new(
6492 "oa::crypto::merkle::merkle_tree_reduce",
6493 0x31bc16b150cfdf10,
6494 &[OpValueKind::Matrix],
6495 &[OpValueKind::Matrix],
6496 )
6497 .with_shape_rule(OpShapeRule::Explicit)
6498 .with_dtype_rule(OpDTypeRule::Explicit)
6499 .with_differentiation(OpDifferentiation::None)
6500 .with_lowering(OpLowering::Dispatch)
6501 .with_fusion_class(OpFusionClass::Effect)
6502 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6503 .attributes(&[
6504 OpAttributeSpec::new("leaf_count", OpAttributeKind::UnsignedInteger),
6505 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6506 ]);
6507
6508 pub const MERKLE_FRAME_INIT: OperationContract = OperationContract::new(
6509 "oa::crypto::merkle::merkle_frame_init",
6510 0xc6301d252d67b32e,
6511 &[OpValueKind::Matrix],
6512 &[OpValueKind::Matrix],
6513 )
6514 .with_shape_rule(OpShapeRule::Explicit)
6515 .with_dtype_rule(OpDTypeRule::Explicit)
6516 .with_differentiation(OpDifferentiation::None)
6517 .with_lowering(OpLowering::Dispatch)
6518 .with_fusion_class(OpFusionClass::Effect)
6519 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6520 .attributes(&[
6521 OpAttributeSpec::new("leaf_count", OpAttributeKind::UnsignedInteger),
6522 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6523 ]);
6524
6525 pub const MERKLE_FRAME_APPEND: OperationContract = OperationContract::new(
6526 "oa::crypto::merkle::merkle_frame_append",
6527 0x6fff156c86d51779,
6528 &[
6529 OpValueKind::Matrix,
6530 OpValueKind::Matrix,
6531 OpValueKind::Matrix,
6532 ],
6533 &[OpValueKind::Matrix],
6534 )
6535 .with_shape_rule(OpShapeRule::Explicit)
6536 .with_dtype_rule(OpDTypeRule::Explicit)
6537 .with_differentiation(OpDifferentiation::None)
6538 .with_lowering(OpLowering::Dispatch)
6539 .with_fusion_class(OpFusionClass::Effect)
6540 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6541 .attributes(&[
6542 OpAttributeSpec::new("leaf_count", OpAttributeKind::UnsignedInteger),
6543 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6544 OpAttributeSpec::new("level", OpAttributeKind::UnsignedInteger),
6545 ])
6546 .mutated_inputs(0x04)
6547 .alias(0, 2);
6548
6549 pub const MERKLE_FRAME_VERIFY: OperationContract = OperationContract::new(
6550 "oa::crypto::merkle::merkle_frame_verify",
6551 0x606bc6bd8a20f2ac,
6552 &[
6553 OpValueKind::Matrix,
6554 OpValueKind::Matrix,
6555 OpValueKind::Matrix,
6556 ],
6557 &[OpValueKind::Matrix],
6558 )
6559 .with_shape_rule(OpShapeRule::Explicit)
6560 .with_dtype_rule(OpDTypeRule::Explicit)
6561 .with_differentiation(OpDifferentiation::None)
6562 .with_lowering(OpLowering::Dispatch)
6563 .with_fusion_class(OpFusionClass::Effect)
6564 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6565 .attributes(&[
6566 OpAttributeSpec::new("leaf_count", OpAttributeKind::UnsignedInteger),
6567 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6568 ]);
6569
6570 pub const MERKLE_SUBTREE_REDUCE: OperationContract = OperationContract::new(
6571 "oa::crypto::merkle::merkle_subtree_reduce",
6572 0x92afa705bbc4c88f,
6573 &[OpValueKind::Matrix],
6574 &[OpValueKind::Matrix],
6575 )
6576 .with_shape_rule(OpShapeRule::Explicit)
6577 .with_dtype_rule(OpDTypeRule::Explicit)
6578 .with_differentiation(OpDifferentiation::None)
6579 .with_lowering(OpLowering::Dispatch)
6580 .with_fusion_class(OpFusionClass::Effect)
6581 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6582 .attributes(&[
6583 OpAttributeSpec::new("leaf_count", OpAttributeKind::UnsignedInteger),
6584 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6585 ]);
6586 }
6587
6588 pub mod pqc {
6589 use super::*;
6590
6591 pub(crate) const ML_DSA_44_PUBLIC_KEY_SIZE: usize = 1312;
6592 pub(crate) const ML_DSA_44_SIGNATURE_SIZE: usize = 2420;
6593 pub(crate) const ML_DSA_65_PUBLIC_KEY_SIZE: usize = 1952;
6594 pub(crate) const ML_DSA_65_SIGNATURE_SIZE: usize = 3309;
6595 pub(crate) const ML_DSA_87_PUBLIC_KEY_SIZE: usize = 2592;
6596 pub(crate) const ML_DSA_87_SIGNATURE_SIZE: usize = 4627;
6597
6598 pub const ML_DSA_65_VERIFY_BATCH: OperationContract = OperationContract::new(
6599 "oa::crypto::pqc::ml_dsa_65_verify_batch",
6600 0xa1b5a8d75d623915,
6601 &[
6602 OpValueKind::Matrix,
6603 OpValueKind::Matrix,
6604 OpValueKind::Matrix,
6605 OpValueKind::Matrix,
6606 OpValueKind::Matrix,
6607 ],
6608 &[OpValueKind::Matrix],
6609 )
6610 .with_shape_rule(OpShapeRule::Explicit)
6611 .with_dtype_rule(OpDTypeRule::Explicit)
6612 .with_differentiation(OpDifferentiation::None)
6613 .with_lowering(OpLowering::Dispatch)
6614 .with_fusion_class(OpFusionClass::Effect)
6615 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6616 .attributes(&[
6617 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6618 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6619 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6620 ]);
6621
6622 pub const ML_DSA_44_VERIFY_BATCH: OperationContract = OperationContract::new(
6623 "oa::crypto::pqc::ml_dsa_44_verify_batch",
6624 0xbf20c4567b04ebd4,
6625 &[
6626 OpValueKind::Matrix,
6627 OpValueKind::Matrix,
6628 OpValueKind::Matrix,
6629 OpValueKind::Matrix,
6630 OpValueKind::Matrix,
6631 ],
6632 &[OpValueKind::Matrix],
6633 )
6634 .with_shape_rule(OpShapeRule::Explicit)
6635 .with_dtype_rule(OpDTypeRule::Explicit)
6636 .with_differentiation(OpDifferentiation::None)
6637 .with_lowering(OpLowering::Dispatch)
6638 .with_fusion_class(OpFusionClass::Effect)
6639 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6640 .attributes(&[
6641 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6642 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6643 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6644 ]);
6645
6646 pub const ML_DSA_87_VERIFY_BATCH: OperationContract = OperationContract::new(
6647 "oa::crypto::pqc::ml_dsa_87_verify_batch",
6648 0x73966f94411e7fe6,
6649 &[
6650 OpValueKind::Matrix,
6651 OpValueKind::Matrix,
6652 OpValueKind::Matrix,
6653 OpValueKind::Matrix,
6654 OpValueKind::Matrix,
6655 ],
6656 &[OpValueKind::Matrix],
6657 )
6658 .with_shape_rule(OpShapeRule::Explicit)
6659 .with_dtype_rule(OpDTypeRule::Explicit)
6660 .with_differentiation(OpDifferentiation::None)
6661 .with_lowering(OpLowering::Dispatch)
6662 .with_fusion_class(OpFusionClass::Effect)
6663 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6664 .attributes(&[
6665 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6666 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6667 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6668 ]);
6669
6670 pub const ML_DSA_65_VERIFY_PREHASHED_BATCH: OperationContract = OperationContract::new(
6671 "oa::crypto::pqc::ml_dsa_65_verify_prehashed_batch",
6672 0x2bd52b673d44e501,
6673 &[
6674 OpValueKind::Matrix,
6675 OpValueKind::Matrix,
6676 OpValueKind::Matrix,
6677 OpValueKind::Matrix,
6678 OpValueKind::Matrix,
6679 ],
6680 &[OpValueKind::Matrix],
6681 )
6682 .with_shape_rule(OpShapeRule::Explicit)
6683 .with_dtype_rule(OpDTypeRule::Explicit)
6684 .with_differentiation(OpDifferentiation::None)
6685 .with_lowering(OpLowering::Dispatch)
6686 .with_fusion_class(OpFusionClass::Effect)
6687 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6688 .attributes(&[
6689 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6690 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6691 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6692 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6693 ]);
6694
6695 pub const ML_DSA_44_VERIFY_PREHASHED_BATCH: OperationContract = OperationContract::new(
6696 "oa::crypto::pqc::ml_dsa_44_verify_prehashed_batch",
6697 0xe0bfb329fc1a0840,
6698 &[
6699 OpValueKind::Matrix,
6700 OpValueKind::Matrix,
6701 OpValueKind::Matrix,
6702 OpValueKind::Matrix,
6703 OpValueKind::Matrix,
6704 ],
6705 &[OpValueKind::Matrix],
6706 )
6707 .with_shape_rule(OpShapeRule::Explicit)
6708 .with_dtype_rule(OpDTypeRule::Explicit)
6709 .with_differentiation(OpDifferentiation::None)
6710 .with_lowering(OpLowering::Dispatch)
6711 .with_fusion_class(OpFusionClass::Effect)
6712 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6713 .attributes(&[
6714 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6715 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6716 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6717 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6718 ]);
6719
6720 pub const ML_DSA_87_VERIFY_PREHASHED_BATCH: OperationContract = OperationContract::new(
6721 "oa::crypto::pqc::ml_dsa_87_verify_prehashed_batch",
6722 0x9e0e6c4de8c28774,
6723 &[
6724 OpValueKind::Matrix,
6725 OpValueKind::Matrix,
6726 OpValueKind::Matrix,
6727 OpValueKind::Matrix,
6728 OpValueKind::Matrix,
6729 ],
6730 &[OpValueKind::Matrix],
6731 )
6732 .with_shape_rule(OpShapeRule::Explicit)
6733 .with_dtype_rule(OpDTypeRule::Explicit)
6734 .with_differentiation(OpDifferentiation::None)
6735 .with_lowering(OpLowering::Dispatch)
6736 .with_fusion_class(OpFusionClass::Effect)
6737 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6738 .attributes(&[
6739 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6740 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6741 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6742 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6743 ]);
6744
6745 pub const ML_DSA_65_VERIFY_HASH_MESSAGE_BATCH: OperationContract = OperationContract::new(
6746 "oa::crypto::pqc::ml_dsa_65_verify_hash_message_batch",
6747 0xddbb9993fedbcc7c,
6748 &[
6749 OpValueKind::Matrix,
6750 OpValueKind::Matrix,
6751 OpValueKind::Matrix,
6752 OpValueKind::Matrix,
6753 OpValueKind::Matrix,
6754 ],
6755 &[OpValueKind::Matrix],
6756 )
6757 .with_shape_rule(OpShapeRule::Explicit)
6758 .with_dtype_rule(OpDTypeRule::Explicit)
6759 .with_differentiation(OpDifferentiation::None)
6760 .with_lowering(OpLowering::Dispatch)
6761 .with_fusion_class(OpFusionClass::Effect)
6762 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6763 .attributes(&[
6764 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6765 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6766 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6767 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6768 ]);
6769
6770 pub const ML_DSA_44_VERIFY_HASH_MESSAGE_BATCH: OperationContract = OperationContract::new(
6771 "oa::crypto::pqc::ml_dsa_44_verify_hash_message_batch",
6772 0x48d7b7228ad739a3,
6773 &[
6774 OpValueKind::Matrix,
6775 OpValueKind::Matrix,
6776 OpValueKind::Matrix,
6777 OpValueKind::Matrix,
6778 OpValueKind::Matrix,
6779 ],
6780 &[OpValueKind::Matrix],
6781 )
6782 .with_shape_rule(OpShapeRule::Explicit)
6783 .with_dtype_rule(OpDTypeRule::Explicit)
6784 .with_differentiation(OpDifferentiation::None)
6785 .with_lowering(OpLowering::Dispatch)
6786 .with_fusion_class(OpFusionClass::Effect)
6787 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6788 .attributes(&[
6789 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6790 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6791 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6792 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6793 ]);
6794
6795 pub const ML_DSA_87_VERIFY_HASH_MESSAGE_BATCH: OperationContract = OperationContract::new(
6796 "oa::crypto::pqc::ml_dsa_87_verify_hash_message_batch",
6797 0x61dfdc3f505ccd96,
6798 &[
6799 OpValueKind::Matrix,
6800 OpValueKind::Matrix,
6801 OpValueKind::Matrix,
6802 OpValueKind::Matrix,
6803 OpValueKind::Matrix,
6804 ],
6805 &[OpValueKind::Matrix],
6806 )
6807 .with_shape_rule(OpShapeRule::Explicit)
6808 .with_dtype_rule(OpDTypeRule::Explicit)
6809 .with_differentiation(OpDifferentiation::None)
6810 .with_lowering(OpLowering::Dispatch)
6811 .with_fusion_class(OpFusionClass::Effect)
6812 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6813 .attributes(&[
6814 OpAttributeSpec::new("batch_size", OpAttributeKind::UnsignedInteger),
6815 OpAttributeSpec::new("context_offset", OpAttributeKind::UnsignedInteger),
6816 OpAttributeSpec::new("context_length", OpAttributeKind::UnsignedInteger),
6817 OpAttributeSpec::new("algorithm", OpAttributeKind::UnsignedInteger),
6818 ]);
6819 }
6820}
6821
6822pub mod image {
6824 use super::*;
6825
6826 pub const RESIZE: OperationContract = OperationContract::new(
6827 "oa::image::resize",
6828 0x38c89d5fa221d139,
6829 &[OpValueKind::Image],
6830 &[OpValueKind::Image],
6831 )
6832 .with_shape_rule(OpShapeRule::Explicit)
6833 .with_dtype_rule(OpDTypeRule::MatchInput)
6834 .with_differentiation(OpDifferentiation::None)
6835 .with_lowering(OpLowering::Dispatch)
6836 .with_fusion_class(OpFusionClass::Gather)
6837 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6838 .attributes(&[
6839 OpAttributeSpec::new("target_width", OpAttributeKind::UnsignedInteger),
6840 OpAttributeSpec::new("target_height", OpAttributeKind::UnsignedInteger),
6841 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
6842 ]);
6843
6844 pub const CROP: OperationContract = OperationContract::new(
6845 "oa::image::crop",
6846 0x2651d4c41fb5f2a6,
6847 &[OpValueKind::Image],
6848 &[OpValueKind::Image],
6849 )
6850 .with_shape_rule(OpShapeRule::Explicit)
6851 .with_dtype_rule(OpDTypeRule::MatchInput)
6852 .with_differentiation(OpDifferentiation::None)
6853 .with_lowering(OpLowering::Dispatch)
6854 .with_fusion_class(OpFusionClass::Gather)
6855 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6856 .attributes(&[
6857 OpAttributeSpec::new("x", OpAttributeKind::UnsignedInteger),
6858 OpAttributeSpec::new("y", OpAttributeKind::UnsignedInteger),
6859 OpAttributeSpec::new("width", OpAttributeKind::UnsignedInteger),
6860 OpAttributeSpec::new("height", OpAttributeKind::UnsignedInteger),
6861 ]);
6862
6863 pub const FLIP: OperationContract = OperationContract::new(
6864 "oa::image::flip",
6865 0xe8c361528c016dce,
6866 &[OpValueKind::Image],
6867 &[OpValueKind::Image],
6868 )
6869 .with_shape_rule(OpShapeRule::Explicit)
6870 .with_dtype_rule(OpDTypeRule::MatchInput)
6871 .with_differentiation(OpDifferentiation::None)
6872 .with_lowering(OpLowering::Dispatch)
6873 .with_fusion_class(OpFusionClass::Gather)
6874 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6875 .attributes(&[
6876 OpAttributeSpec::new("horizontal", OpAttributeKind::Boolean),
6877 OpAttributeSpec::new("vertical", OpAttributeKind::Boolean),
6878 ]);
6879
6880 pub const ROTATE: OperationContract = OperationContract::new(
6881 "oa::image::rotate",
6882 0x2e86596413352577,
6883 &[OpValueKind::Image],
6884 &[OpValueKind::Image],
6885 )
6886 .with_shape_rule(OpShapeRule::Explicit)
6887 .with_dtype_rule(OpDTypeRule::MatchInput)
6888 .with_differentiation(OpDifferentiation::None)
6889 .with_lowering(OpLowering::Dispatch)
6890 .with_fusion_class(OpFusionClass::Gather)
6891 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6892 .attributes(&[OpAttributeSpec::new(
6893 "degrees",
6894 OpAttributeKind::UnsignedInteger,
6895 )]);
6896
6897 pub const PAD: OperationContract = OperationContract::new(
6898 "oa::image::pad",
6899 0x0b533f428d2c73ea,
6900 &[OpValueKind::Image],
6901 &[OpValueKind::Image],
6902 )
6903 .with_shape_rule(OpShapeRule::Explicit)
6904 .with_dtype_rule(OpDTypeRule::MatchInput)
6905 .with_differentiation(OpDifferentiation::None)
6906 .with_lowering(OpLowering::Dispatch)
6907 .with_fusion_class(OpFusionClass::Gather)
6908 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6909 .attributes(&[
6910 OpAttributeSpec::new("left", OpAttributeKind::UnsignedInteger),
6911 OpAttributeSpec::new("right", OpAttributeKind::UnsignedInteger),
6912 OpAttributeSpec::new("top", OpAttributeKind::UnsignedInteger),
6913 OpAttributeSpec::new("bottom", OpAttributeKind::UnsignedInteger),
6914 OpAttributeSpec::new("border", OpAttributeKind::Enum),
6915 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
6916 ]);
6917
6918 pub const CENTER_CROP: OperationContract = OperationContract::new(
6919 "oa::image::center_crop",
6920 0x8a47c17882639246,
6921 &[OpValueKind::Image],
6922 &[OpValueKind::Image],
6923 )
6924 .with_shape_rule(OpShapeRule::Explicit)
6925 .with_dtype_rule(OpDTypeRule::MatchInput)
6926 .with_differentiation(OpDifferentiation::None)
6927 .with_lowering(OpLowering::Dispatch)
6928 .with_fusion_class(OpFusionClass::Gather)
6929 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6930 .attributes(&[
6931 OpAttributeSpec::new("width", OpAttributeKind::UnsignedInteger),
6932 OpAttributeSpec::new("height", OpAttributeKind::UnsignedInteger),
6933 ]);
6934
6935 pub const REMAP: OperationContract = OperationContract::new(
6936 "oa::image::remap",
6937 0x6f6812110a4c4ae9,
6938 &[OpValueKind::Image, OpValueKind::Matrix],
6939 &[OpValueKind::Image],
6940 )
6941 .with_shape_rule(OpShapeRule::Explicit)
6942 .with_dtype_rule(OpDTypeRule::MatchInput)
6943 .with_differentiation(OpDifferentiation::None)
6944 .with_lowering(OpLowering::Dispatch)
6945 .with_fusion_class(OpFusionClass::Gather)
6946 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6947 .attributes(&[
6948 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
6949 OpAttributeSpec::new("border", OpAttributeKind::Enum),
6950 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
6951 ]);
6952
6953 pub const WARP_AFFINE: OperationContract = OperationContract::new(
6954 "oa::image::warp_affine",
6955 0x3f448746adc0df90,
6956 &[OpValueKind::Image, OpValueKind::Matrix],
6957 &[OpValueKind::Image],
6958 )
6959 .with_shape_rule(OpShapeRule::Explicit)
6960 .with_dtype_rule(OpDTypeRule::MatchInput)
6961 .with_differentiation(OpDifferentiation::None)
6962 .with_lowering(OpLowering::Dispatch)
6963 .with_fusion_class(OpFusionClass::Gather)
6964 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6965 .attributes(&[
6966 OpAttributeSpec::new("width", OpAttributeKind::UnsignedInteger),
6967 OpAttributeSpec::new("height", OpAttributeKind::UnsignedInteger),
6968 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
6969 OpAttributeSpec::new("border", OpAttributeKind::Enum),
6970 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
6971 ]);
6972
6973 pub const WARP_PERSPECTIVE: OperationContract = OperationContract::new(
6974 "oa::image::warp_perspective",
6975 0x70929e20efc2937d,
6976 &[OpValueKind::Image, OpValueKind::Matrix],
6977 &[OpValueKind::Image],
6978 )
6979 .with_shape_rule(OpShapeRule::Explicit)
6980 .with_dtype_rule(OpDTypeRule::MatchInput)
6981 .with_differentiation(OpDifferentiation::None)
6982 .with_lowering(OpLowering::Dispatch)
6983 .with_fusion_class(OpFusionClass::Gather)
6984 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
6985 .attributes(&[
6986 OpAttributeSpec::new("width", OpAttributeKind::UnsignedInteger),
6987 OpAttributeSpec::new("height", OpAttributeKind::UnsignedInteger),
6988 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
6989 OpAttributeSpec::new("border", OpAttributeKind::Enum),
6990 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
6991 ]);
6992
6993 pub const THRESHOLD_BINARY: OperationContract = OperationContract::new(
6994 "oa::image::threshold_binary",
6995 0xd7b81667446e39b9,
6996 &[OpValueKind::Image],
6997 &[OpValueKind::Image],
6998 )
6999 .with_shape_rule(OpShapeRule::Explicit)
7000 .with_dtype_rule(OpDTypeRule::MatchInput)
7001 .with_differentiation(OpDifferentiation::None)
7002 .with_lowering(OpLowering::Dispatch)
7003 .with_fusion_class(OpFusionClass::Pointwise)
7004 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7005 .attributes(&[
7006 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
7007 OpAttributeSpec::new("max_value", OpAttributeKind::Float),
7008 ]);
7009
7010 pub const THRESHOLD_BINARY_INV: OperationContract = OperationContract::new(
7011 "oa::image::threshold_binary_inv",
7012 0xc6316e8637c15c85,
7013 &[OpValueKind::Image],
7014 &[OpValueKind::Image],
7015 )
7016 .with_shape_rule(OpShapeRule::Explicit)
7017 .with_dtype_rule(OpDTypeRule::MatchInput)
7018 .with_differentiation(OpDifferentiation::None)
7019 .with_lowering(OpLowering::Dispatch)
7020 .with_fusion_class(OpFusionClass::Pointwise)
7021 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7022 .attributes(&[
7023 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
7024 OpAttributeSpec::new("max_value", OpAttributeKind::Float),
7025 ]);
7026
7027 pub const THRESHOLD_TRUNCATE: OperationContract = OperationContract::new(
7028 "oa::image::threshold_truncate",
7029 0xb97f0a67e5225c1b,
7030 &[OpValueKind::Image],
7031 &[OpValueKind::Image],
7032 )
7033 .with_shape_rule(OpShapeRule::Explicit)
7034 .with_dtype_rule(OpDTypeRule::MatchInput)
7035 .with_differentiation(OpDifferentiation::None)
7036 .with_lowering(OpLowering::Dispatch)
7037 .with_fusion_class(OpFusionClass::Pointwise)
7038 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7039 .attributes(&[OpAttributeSpec::new("threshold", OpAttributeKind::Float)]);
7040
7041 pub const THRESHOLD_TO_ZERO: OperationContract = OperationContract::new(
7042 "oa::image::threshold_to_zero",
7043 0x48c38a0255987231,
7044 &[OpValueKind::Image],
7045 &[OpValueKind::Image],
7046 )
7047 .with_shape_rule(OpShapeRule::Explicit)
7048 .with_dtype_rule(OpDTypeRule::MatchInput)
7049 .with_differentiation(OpDifferentiation::None)
7050 .with_lowering(OpLowering::Dispatch)
7051 .with_fusion_class(OpFusionClass::Pointwise)
7052 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7053 .attributes(&[OpAttributeSpec::new("threshold", OpAttributeKind::Float)]);
7054
7055 pub const THRESHOLD_TO_ZERO_INV: OperationContract = OperationContract::new(
7056 "oa::image::threshold_to_zero_inv",
7057 0x07e73dd34b460226,
7058 &[OpValueKind::Image],
7059 &[OpValueKind::Image],
7060 )
7061 .with_shape_rule(OpShapeRule::Explicit)
7062 .with_dtype_rule(OpDTypeRule::MatchInput)
7063 .with_differentiation(OpDifferentiation::None)
7064 .with_lowering(OpLowering::Dispatch)
7065 .with_fusion_class(OpFusionClass::Pointwise)
7066 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7067 .attributes(&[OpAttributeSpec::new("threshold", OpAttributeKind::Float)]);
7068
7069 pub const IN_RANGE: OperationContract = OperationContract::new(
7070 "oa::image::in_range",
7071 0x629863e5bd10f5eb,
7072 &[OpValueKind::Image],
7073 &[OpValueKind::Image],
7074 )
7075 .with_shape_rule(OpShapeRule::Explicit)
7076 .with_dtype_rule(OpDTypeRule::MatchInput)
7077 .with_differentiation(OpDifferentiation::None)
7078 .with_lowering(OpLowering::Dispatch)
7079 .with_fusion_class(OpFusionClass::Pointwise)
7080 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7081 .attributes(&[
7082 OpAttributeSpec::new("low", OpAttributeKind::Float),
7083 OpAttributeSpec::new("high", OpAttributeKind::Float),
7084 OpAttributeSpec::new("true_value", OpAttributeKind::Float),
7085 ]);
7086
7087 pub const CLAMP: OperationContract = OperationContract::new(
7088 "oa::image::clamp",
7089 0xba6e89bce701cf17,
7090 &[OpValueKind::Image],
7091 &[OpValueKind::Image],
7092 )
7093 .with_shape_rule(OpShapeRule::Explicit)
7094 .with_dtype_rule(OpDTypeRule::MatchInput)
7095 .with_differentiation(OpDifferentiation::None)
7096 .with_lowering(OpLowering::Dispatch)
7097 .with_fusion_class(OpFusionClass::Pointwise)
7098 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7099 .attributes(&[
7100 OpAttributeSpec::new("low", OpAttributeKind::Float),
7101 OpAttributeSpec::new("high", OpAttributeKind::Float),
7102 ]);
7103
7104 pub const INVERT: OperationContract = OperationContract::new(
7105 "oa::image::invert",
7106 0x3f4f9c6d53e6c1f3,
7107 &[OpValueKind::Image],
7108 &[OpValueKind::Image],
7109 )
7110 .with_shape_rule(OpShapeRule::Explicit)
7111 .with_dtype_rule(OpDTypeRule::MatchInput)
7112 .with_differentiation(OpDifferentiation::None)
7113 .with_lowering(OpLowering::Dispatch)
7114 .with_fusion_class(OpFusionClass::Pointwise)
7115 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7116 .attributes(&[OpAttributeSpec::new("max_value", OpAttributeKind::Float)]);
7117
7118 pub const BRIGHTNESS_CONTRAST: OperationContract = OperationContract::new(
7119 "oa::image::brightness_contrast",
7120 0xa6007d6c7c01d0dd,
7121 &[OpValueKind::Image],
7122 &[OpValueKind::Image],
7123 )
7124 .with_shape_rule(OpShapeRule::Explicit)
7125 .with_dtype_rule(OpDTypeRule::MatchInput)
7126 .with_differentiation(OpDifferentiation::None)
7127 .with_lowering(OpLowering::Dispatch)
7128 .with_fusion_class(OpFusionClass::Pointwise)
7129 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7130 .attributes(&[
7131 OpAttributeSpec::new("brightness", OpAttributeKind::Float),
7132 OpAttributeSpec::new("contrast", OpAttributeKind::Float),
7133 ]);
7134
7135 pub const GAMMA_CONTRAST: OperationContract = OperationContract::new(
7136 "oa::image::gamma_contrast",
7137 0x8d2c5b0bbef70865,
7138 &[OpValueKind::Image],
7139 &[OpValueKind::Image],
7140 )
7141 .with_shape_rule(OpShapeRule::Explicit)
7142 .with_dtype_rule(OpDTypeRule::MatchInput)
7143 .with_differentiation(OpDifferentiation::None)
7144 .with_lowering(OpLowering::Dispatch)
7145 .with_fusion_class(OpFusionClass::Pointwise)
7146 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7147 .attributes(&[
7148 OpAttributeSpec::new("gamma", OpAttributeKind::Float),
7149 OpAttributeSpec::new("gain", OpAttributeKind::Float),
7150 ]);
7151
7152 pub const SOLARIZE: OperationContract = OperationContract::new(
7153 "oa::image::solarize",
7154 0x6a94a4c2e6ee2f81,
7155 &[OpValueKind::Image],
7156 &[OpValueKind::Image],
7157 )
7158 .with_shape_rule(OpShapeRule::Explicit)
7159 .with_dtype_rule(OpDTypeRule::MatchInput)
7160 .with_differentiation(OpDifferentiation::None)
7161 .with_lowering(OpLowering::Dispatch)
7162 .with_fusion_class(OpFusionClass::Pointwise)
7163 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7164 .attributes(&[
7165 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
7166 OpAttributeSpec::new("max_value", OpAttributeKind::Float),
7167 ]);
7168
7169 pub const POSTERIZE: OperationContract = OperationContract::new(
7170 "oa::image::posterize",
7171 0x548a51555dd51eef,
7172 &[OpValueKind::Image],
7173 &[OpValueKind::Image],
7174 )
7175 .with_shape_rule(OpShapeRule::Explicit)
7176 .with_dtype_rule(OpDTypeRule::MatchInput)
7177 .with_differentiation(OpDifferentiation::None)
7178 .with_lowering(OpLowering::Dispatch)
7179 .with_fusion_class(OpFusionClass::Pointwise)
7180 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7181 .attributes(&[
7182 OpAttributeSpec::new("levels", OpAttributeKind::UnsignedInteger),
7183 OpAttributeSpec::new("low", OpAttributeKind::Float),
7184 OpAttributeSpec::new("high", OpAttributeKind::Float),
7185 ]);
7186
7187 pub const GRAYSCALE: OperationContract = OperationContract::new(
7188 "oa::image::grayscale",
7189 0x01d1514a9b4426ed,
7190 &[OpValueKind::Image],
7191 &[OpValueKind::Image],
7192 )
7193 .with_shape_rule(OpShapeRule::Explicit)
7194 .with_dtype_rule(OpDTypeRule::MatchInput)
7195 .with_differentiation(OpDifferentiation::None)
7196 .with_lowering(OpLowering::Dispatch)
7197 .with_fusion_class(OpFusionClass::Pointwise)
7198 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7199
7200 pub const ALPHA_BLEND: OperationContract = OperationContract::new(
7201 "oa::image::alpha_blend",
7202 0x59996f42ade29f83,
7203 &[OpValueKind::Image, OpValueKind::Image],
7204 &[OpValueKind::Image],
7205 )
7206 .with_shape_rule(OpShapeRule::Explicit)
7207 .with_dtype_rule(OpDTypeRule::MatchInput)
7208 .with_differentiation(OpDifferentiation::None)
7209 .with_lowering(OpLowering::Dispatch)
7210 .with_fusion_class(OpFusionClass::Pointwise)
7211 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7212 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
7213
7214 pub const COMPOSITE: OperationContract = OperationContract::new(
7215 "oa::image::composite",
7216 0x74cb8520e5ac861b,
7217 &[OpValueKind::Image, OpValueKind::Image, OpValueKind::Image],
7218 &[OpValueKind::Image],
7219 )
7220 .with_shape_rule(OpShapeRule::Explicit)
7221 .with_dtype_rule(OpDTypeRule::MatchInput)
7222 .with_differentiation(OpDifferentiation::None)
7223 .with_lowering(OpLowering::Dispatch)
7224 .with_fusion_class(OpFusionClass::Pointwise)
7225 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7226
7227 pub const ERASE: OperationContract = OperationContract::new(
7228 "oa::image::erase",
7229 0x8ebe7ea8f2c21490,
7230 &[OpValueKind::Image],
7231 &[OpValueKind::Image],
7232 )
7233 .with_shape_rule(OpShapeRule::Explicit)
7234 .with_dtype_rule(OpDTypeRule::MatchInput)
7235 .with_differentiation(OpDifferentiation::None)
7236 .with_lowering(OpLowering::Dispatch)
7237 .with_fusion_class(OpFusionClass::Pointwise)
7238 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7239 .attributes(&[
7240 OpAttributeSpec::new("x", OpAttributeKind::UnsignedInteger),
7241 OpAttributeSpec::new("y", OpAttributeKind::UnsignedInteger),
7242 OpAttributeSpec::new("width", OpAttributeKind::UnsignedInteger),
7243 OpAttributeSpec::new("height", OpAttributeKind::UnsignedInteger),
7244 OpAttributeSpec::new("value", OpAttributeKind::Float),
7245 ]);
7246
7247 pub const COLOR_TWIST: OperationContract = OperationContract::new(
7248 "oa::image::color_twist",
7249 0x039025b539ad7892,
7250 &[OpValueKind::Image, OpValueKind::Matrix],
7251 &[OpValueKind::Image],
7252 )
7253 .with_shape_rule(OpShapeRule::Explicit)
7254 .with_dtype_rule(OpDTypeRule::MatchInput)
7255 .with_differentiation(OpDifferentiation::None)
7256 .with_lowering(OpLowering::Dispatch)
7257 .with_fusion_class(OpFusionClass::Pointwise)
7258 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7259
7260 pub const CHANNEL_REORDER: OperationContract = OperationContract::new(
7261 "oa::image::channel_reorder",
7262 0xa885438f251535a4,
7263 &[OpValueKind::Image],
7264 &[OpValueKind::Image],
7265 )
7266 .with_shape_rule(OpShapeRule::Explicit)
7267 .with_dtype_rule(OpDTypeRule::MatchInput)
7268 .with_differentiation(OpDifferentiation::None)
7269 .with_lowering(OpLowering::Dispatch)
7270 .with_fusion_class(OpFusionClass::Gather)
7271 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7272 .attributes(&[
7273 OpAttributeSpec::new("channel_0", OpAttributeKind::UnsignedInteger),
7274 OpAttributeSpec::new("channel_1", OpAttributeKind::UnsignedInteger),
7275 OpAttributeSpec::new("channel_2", OpAttributeKind::UnsignedInteger),
7276 OpAttributeSpec::new("channel_3", OpAttributeKind::UnsignedInteger),
7277 OpAttributeSpec::new("output_format", OpAttributeKind::Enum),
7278 ]);
7279
7280 pub const GAUSSIAN_NOISE: OperationContract = OperationContract::new(
7281 "oa::image::gaussian_noise",
7282 0x0ed63b11a093c756,
7283 &[OpValueKind::Image],
7284 &[OpValueKind::Image],
7285 )
7286 .with_shape_rule(OpShapeRule::Explicit)
7287 .with_dtype_rule(OpDTypeRule::MatchInput)
7288 .with_differentiation(OpDifferentiation::None)
7289 .with_lowering(OpLowering::Dispatch)
7290 .with_fusion_class(OpFusionClass::Pointwise)
7291 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7292 .attributes(&[
7293 OpAttributeSpec::new("mean", OpAttributeKind::Float),
7294 OpAttributeSpec::new("stddev", OpAttributeKind::Float),
7295 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
7296 ]);
7297
7298 pub const SALT_PEPPER_NOISE: OperationContract = OperationContract::new(
7299 "oa::image::salt_pepper_noise",
7300 0xf6d7d3e43c18bf76,
7301 &[OpValueKind::Image],
7302 &[OpValueKind::Image],
7303 )
7304 .with_shape_rule(OpShapeRule::Explicit)
7305 .with_dtype_rule(OpDTypeRule::MatchInput)
7306 .with_differentiation(OpDifferentiation::None)
7307 .with_lowering(OpLowering::Dispatch)
7308 .with_fusion_class(OpFusionClass::Pointwise)
7309 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7310 .attributes(&[
7311 OpAttributeSpec::new("probability", OpAttributeKind::Float),
7312 OpAttributeSpec::new("salt_value", OpAttributeKind::Float),
7313 OpAttributeSpec::new("pepper_value", OpAttributeKind::Float),
7314 OpAttributeSpec::new("seed", OpAttributeKind::UnsignedInteger),
7315 ]);
7316
7317 pub const CONVOLVE_2D: OperationContract = OperationContract::new(
7318 "oa::image::convolve_2d",
7319 0xcad7c4e14b7da03f,
7320 &[OpValueKind::Image, OpValueKind::Matrix],
7321 &[OpValueKind::Image],
7322 )
7323 .with_shape_rule(OpShapeRule::Explicit)
7324 .with_dtype_rule(OpDTypeRule::MatchInput)
7325 .with_differentiation(OpDifferentiation::None)
7326 .with_lowering(OpLowering::Dispatch)
7327 .with_fusion_class(OpFusionClass::Conv)
7328 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7329 .attributes(&[
7330 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7331 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7332 ]);
7333
7334 pub const SEPARABLE_CONVOLVE_2D: OperationContract = OperationContract::new(
7335 "oa::image::separable_convolve_2d",
7336 0x3eee0317213d1f6a,
7337 &[OpValueKind::Image, OpValueKind::Matrix, OpValueKind::Matrix],
7338 &[OpValueKind::Image],
7339 )
7340 .with_shape_rule(OpShapeRule::Explicit)
7341 .with_dtype_rule(OpDTypeRule::MatchInput)
7342 .with_differentiation(OpDifferentiation::None)
7343 .with_lowering(OpLowering::Dispatch)
7344 .with_fusion_class(OpFusionClass::Conv)
7345 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7346 .attributes(&[
7347 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7348 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7349 ]);
7350
7351 pub const AVERAGE_BLUR: OperationContract = OperationContract::new(
7352 "oa::image::average_blur",
7353 0xa97341a1b8478459,
7354 &[OpValueKind::Image],
7355 &[OpValueKind::Image],
7356 )
7357 .with_shape_rule(OpShapeRule::Explicit)
7358 .with_dtype_rule(OpDTypeRule::MatchInput)
7359 .with_differentiation(OpDifferentiation::None)
7360 .with_lowering(OpLowering::Dispatch)
7361 .with_fusion_class(OpFusionClass::Conv)
7362 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7363 .attributes(&[
7364 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7365 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7366 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7367 ]);
7368
7369 pub const SOBEL: OperationContract = OperationContract::new(
7370 "oa::image::sobel",
7371 0x880465eb735b334b,
7372 &[OpValueKind::Image],
7373 &[OpValueKind::Image],
7374 )
7375 .with_shape_rule(OpShapeRule::Explicit)
7376 .with_dtype_rule(OpDTypeRule::MatchInput)
7377 .with_differentiation(OpDifferentiation::None)
7378 .with_lowering(OpLowering::Dispatch)
7379 .with_fusion_class(OpFusionClass::Conv)
7380 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7381 .attributes(&[
7382 OpAttributeSpec::new("dx", OpAttributeKind::UnsignedInteger),
7383 OpAttributeSpec::new("dy", OpAttributeKind::UnsignedInteger),
7384 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7385 ]);
7386
7387 pub const SCHARR: OperationContract = OperationContract::new(
7388 "oa::image::scharr",
7389 0xde702c015d1ca3a3,
7390 &[OpValueKind::Image],
7391 &[OpValueKind::Image],
7392 )
7393 .with_shape_rule(OpShapeRule::Explicit)
7394 .with_dtype_rule(OpDTypeRule::MatchInput)
7395 .with_differentiation(OpDifferentiation::None)
7396 .with_lowering(OpLowering::Dispatch)
7397 .with_fusion_class(OpFusionClass::Conv)
7398 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7399 .attributes(&[
7400 OpAttributeSpec::new("dx", OpAttributeKind::UnsignedInteger),
7401 OpAttributeSpec::new("dy", OpAttributeKind::UnsignedInteger),
7402 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7403 ]);
7404
7405 pub const LAPLACIAN: OperationContract = OperationContract::new(
7406 "oa::image::laplacian",
7407 0x4b90d4a67f8c1e66,
7408 &[OpValueKind::Image],
7409 &[OpValueKind::Image],
7410 )
7411 .with_shape_rule(OpShapeRule::Explicit)
7412 .with_dtype_rule(OpDTypeRule::MatchInput)
7413 .with_differentiation(OpDifferentiation::None)
7414 .with_lowering(OpLowering::Dispatch)
7415 .with_fusion_class(OpFusionClass::Conv)
7416 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7417 .attributes(&[OpAttributeSpec::new("border", OpAttributeKind::Enum)]);
7418
7419 pub const ERODE: OperationContract = OperationContract::new(
7420 "oa::image::erode",
7421 0x81ad6a776aa81f4c,
7422 &[OpValueKind::Image],
7423 &[OpValueKind::Image],
7424 )
7425 .with_shape_rule(OpShapeRule::Explicit)
7426 .with_dtype_rule(OpDTypeRule::MatchInput)
7427 .with_differentiation(OpDifferentiation::None)
7428 .with_lowering(OpLowering::Dispatch)
7429 .with_fusion_class(OpFusionClass::Conv)
7430 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7431 .attributes(&[
7432 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7433 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7434 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7435 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7436 ]);
7437
7438 pub const DILATE: OperationContract = OperationContract::new(
7439 "oa::image::dilate",
7440 0x1c1e29849b3bbf19,
7441 &[OpValueKind::Image],
7442 &[OpValueKind::Image],
7443 )
7444 .with_shape_rule(OpShapeRule::Explicit)
7445 .with_dtype_rule(OpDTypeRule::MatchInput)
7446 .with_differentiation(OpDifferentiation::None)
7447 .with_lowering(OpLowering::Dispatch)
7448 .with_fusion_class(OpFusionClass::Conv)
7449 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7450 .attributes(&[
7451 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7452 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7453 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7454 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7455 ]);
7456
7457 pub const MORPHOLOGY_OPEN: OperationContract = OperationContract::new(
7458 "oa::image::morphology_open",
7459 0xd9d2733a7c67f9c9,
7460 &[OpValueKind::Image],
7461 &[OpValueKind::Image],
7462 )
7463 .with_shape_rule(OpShapeRule::Explicit)
7464 .with_dtype_rule(OpDTypeRule::MatchInput)
7465 .with_differentiation(OpDifferentiation::None)
7466 .with_lowering(OpLowering::Dispatch)
7467 .with_fusion_class(OpFusionClass::Conv)
7468 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7469 .attributes(&[
7470 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7471 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7472 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7473 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7474 ]);
7475
7476 pub const MORPHOLOGY_CLOSE: OperationContract = OperationContract::new(
7477 "oa::image::morphology_close",
7478 0x7de3b99665f5ff82,
7479 &[OpValueKind::Image],
7480 &[OpValueKind::Image],
7481 )
7482 .with_shape_rule(OpShapeRule::Explicit)
7483 .with_dtype_rule(OpDTypeRule::MatchInput)
7484 .with_differentiation(OpDifferentiation::None)
7485 .with_lowering(OpLowering::Dispatch)
7486 .with_fusion_class(OpFusionClass::Conv)
7487 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7488 .attributes(&[
7489 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7490 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7491 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7492 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7493 ]);
7494
7495 pub const MORPHOLOGY_GRADIENT: OperationContract = OperationContract::new(
7496 "oa::image::morphology_gradient",
7497 0x9b50f7f968e52ddf,
7498 &[OpValueKind::Image],
7499 &[OpValueKind::Image],
7500 )
7501 .with_shape_rule(OpShapeRule::Explicit)
7502 .with_dtype_rule(OpDTypeRule::MatchInput)
7503 .with_differentiation(OpDifferentiation::None)
7504 .with_lowering(OpLowering::Dispatch)
7505 .with_fusion_class(OpFusionClass::Conv)
7506 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7507 .attributes(&[
7508 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7509 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7510 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7511 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7512 ]);
7513
7514 pub const GAUSSIAN_BLUR: OperationContract = OperationContract::new(
7515 "oa::image::gaussian_blur",
7516 0xd4091d8c0468be75,
7517 &[OpValueKind::Image],
7518 &[OpValueKind::Image],
7519 )
7520 .with_shape_rule(OpShapeRule::Explicit)
7521 .with_dtype_rule(OpDTypeRule::MatchInput)
7522 .with_differentiation(OpDifferentiation::None)
7523 .with_lowering(OpLowering::Dispatch)
7524 .with_fusion_class(OpFusionClass::Conv)
7525 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7526 .attributes(&[
7527 OpAttributeSpec::new("sigma", OpAttributeKind::Float),
7528 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
7529 ]);
7530
7531 pub const SHARPEN: OperationContract = OperationContract::new(
7532 "oa::image::sharpen",
7533 0xc421c480cc0744c0,
7534 &[OpValueKind::Image],
7535 &[OpValueKind::Image],
7536 )
7537 .with_shape_rule(OpShapeRule::Explicit)
7538 .with_dtype_rule(OpDTypeRule::MatchInput)
7539 .with_differentiation(OpDifferentiation::None)
7540 .with_lowering(OpLowering::Dispatch)
7541 .with_fusion_class(OpFusionClass::Conv)
7542 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7543 .attributes(&[
7544 OpAttributeSpec::new("amount", OpAttributeKind::Float),
7545 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7546 ]);
7547
7548 pub const MEDIAN_BLUR: OperationContract = OperationContract::new(
7549 "oa::image::median_blur",
7550 0xe1bdd2894e3057ef,
7551 &[OpValueKind::Image],
7552 &[OpValueKind::Image],
7553 )
7554 .with_shape_rule(OpShapeRule::Explicit)
7555 .with_dtype_rule(OpDTypeRule::MatchInput)
7556 .with_differentiation(OpDifferentiation::None)
7557 .with_lowering(OpLowering::Dispatch)
7558 .with_fusion_class(OpFusionClass::Conv)
7559 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7560 .attributes(&[
7561 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
7562 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7563 ]);
7564
7565 pub const BILATERAL_FILTER: OperationContract = OperationContract::new(
7566 "oa::image::bilateral_filter",
7567 0xec78337adf6fc95a,
7568 &[OpValueKind::Image],
7569 &[OpValueKind::Image],
7570 )
7571 .with_shape_rule(OpShapeRule::Explicit)
7572 .with_dtype_rule(OpDTypeRule::MatchInput)
7573 .with_differentiation(OpDifferentiation::None)
7574 .with_lowering(OpLowering::Dispatch)
7575 .with_fusion_class(OpFusionClass::Conv)
7576 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7577 .attributes(&[
7578 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
7579 OpAttributeSpec::new("sigma_color", OpAttributeKind::Float),
7580 OpAttributeSpec::new("sigma_space", OpAttributeKind::Float),
7581 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7582 ]);
7583
7584 pub const UNSHARP_MASK: OperationContract = OperationContract::new(
7585 "oa::image::unsharp_mask",
7586 0xbef8ac3b37268366,
7587 &[OpValueKind::Image],
7588 &[OpValueKind::Image],
7589 )
7590 .with_shape_rule(OpShapeRule::Explicit)
7591 .with_dtype_rule(OpDTypeRule::MatchInput)
7592 .with_differentiation(OpDifferentiation::None)
7593 .with_lowering(OpLowering::Dispatch)
7594 .with_fusion_class(OpFusionClass::Conv)
7595 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7596 .attributes(&[
7597 OpAttributeSpec::new("sigma", OpAttributeKind::Float),
7598 OpAttributeSpec::new("amount", OpAttributeKind::Float),
7599 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
7600 ]);
7601
7602 pub const MORPHOLOGY_TOP_HAT: OperationContract = OperationContract::new(
7603 "oa::image::morphology_top_hat",
7604 0x89c882645a0ac5f3,
7605 &[OpValueKind::Image],
7606 &[OpValueKind::Image],
7607 )
7608 .with_shape_rule(OpShapeRule::Explicit)
7609 .with_dtype_rule(OpDTypeRule::MatchInput)
7610 .with_differentiation(OpDifferentiation::None)
7611 .with_lowering(OpLowering::Dispatch)
7612 .with_fusion_class(OpFusionClass::Conv)
7613 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7614 .attributes(&[
7615 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7616 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7617 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7618 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7619 ]);
7620
7621 pub const MORPHOLOGY_BLACK_HAT: OperationContract = OperationContract::new(
7622 "oa::image::morphology_black_hat",
7623 0x9e9a389328d20c5e,
7624 &[OpValueKind::Image],
7625 &[OpValueKind::Image],
7626 )
7627 .with_shape_rule(OpShapeRule::Explicit)
7628 .with_dtype_rule(OpDTypeRule::MatchInput)
7629 .with_differentiation(OpDifferentiation::None)
7630 .with_lowering(OpLowering::Dispatch)
7631 .with_fusion_class(OpFusionClass::Conv)
7632 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7633 .attributes(&[
7634 OpAttributeSpec::new("kernel_width", OpAttributeKind::UnsignedInteger),
7635 OpAttributeSpec::new("kernel_height", OpAttributeKind::UnsignedInteger),
7636 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7637 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
7638 ]);
7639
7640 pub const ADAPTIVE_THRESHOLD_MEAN: OperationContract = OperationContract::new(
7641 "oa::image::adaptive_threshold_mean",
7642 0xb713a79f905e4fc0,
7643 &[OpValueKind::Image],
7644 &[OpValueKind::Image],
7645 )
7646 .with_shape_rule(OpShapeRule::Explicit)
7647 .with_dtype_rule(OpDTypeRule::MatchInput)
7648 .with_differentiation(OpDifferentiation::None)
7649 .with_lowering(OpLowering::Dispatch)
7650 .with_fusion_class(OpFusionClass::Conv)
7651 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7652 .attributes(&[
7653 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
7654 OpAttributeSpec::new("c", OpAttributeKind::Float),
7655 OpAttributeSpec::new("max_value", OpAttributeKind::Float),
7656 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7657 ]);
7658
7659 pub const ADAPTIVE_THRESHOLD_GAUSSIAN: OperationContract = OperationContract::new(
7660 "oa::image::adaptive_threshold_gaussian",
7661 0x9ffb9c789a7e9cec,
7662 &[OpValueKind::Image],
7663 &[OpValueKind::Image],
7664 )
7665 .with_shape_rule(OpShapeRule::Explicit)
7666 .with_dtype_rule(OpDTypeRule::MatchInput)
7667 .with_differentiation(OpDifferentiation::None)
7668 .with_lowering(OpLowering::Dispatch)
7669 .with_fusion_class(OpFusionClass::Conv)
7670 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7671 .attributes(&[
7672 OpAttributeSpec::new("kernel_size", OpAttributeKind::UnsignedInteger),
7673 OpAttributeSpec::new("c", OpAttributeKind::Float),
7674 OpAttributeSpec::new("max_value", OpAttributeKind::Float),
7675 OpAttributeSpec::new("sigma", OpAttributeKind::Float),
7676 OpAttributeSpec::new("border", OpAttributeKind::Enum),
7677 ]);
7678
7679 pub const NORMALIZE: OperationContract = OperationContract::new(
7680 "oa::image::normalize",
7681 0x56501f0b336cecf3,
7682 &[OpValueKind::Image],
7683 &[OpValueKind::Image],
7684 )
7685 .with_shape_rule(OpShapeRule::Explicit)
7686 .with_dtype_rule(OpDTypeRule::MatchInput)
7687 .with_differentiation(OpDifferentiation::None)
7688 .with_lowering(OpLowering::Dispatch)
7689 .with_fusion_class(OpFusionClass::Pointwise)
7690 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7691 .attributes(&[
7692 OpAttributeSpec::new("mean_0", OpAttributeKind::Float),
7693 OpAttributeSpec::new("mean_1", OpAttributeKind::Float),
7694 OpAttributeSpec::new("mean_2", OpAttributeKind::Float),
7695 OpAttributeSpec::new("std_0", OpAttributeKind::Float),
7696 OpAttributeSpec::new("std_1", OpAttributeKind::Float),
7697 OpAttributeSpec::new("std_2", OpAttributeKind::Float),
7698 ]);
7699
7700 pub const CONVERT_COLOR: OperationContract = OperationContract::new(
7701 "oa::image::convert_color",
7702 0x1b4d4d4392048c04,
7703 &[OpValueKind::Image],
7704 &[OpValueKind::Image],
7705 )
7706 .with_shape_rule(OpShapeRule::Explicit)
7707 .with_dtype_rule(OpDTypeRule::MatchInput)
7708 .with_differentiation(OpDifferentiation::None)
7709 .with_lowering(OpLowering::Dispatch)
7710 .with_fusion_class(OpFusionClass::Pointwise)
7711 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7712 .attributes(&[
7713 OpAttributeSpec::new("source_format", OpAttributeKind::Enum),
7714 OpAttributeSpec::new("destination_format", OpAttributeKind::Enum),
7715 OpAttributeSpec::new("layout", OpAttributeKind::Enum),
7716 ]);
7717
7718 pub const RESIZE_NORMALIZE: OperationContract = OperationContract::new(
7719 "oa::FnImage::resizeNormalize",
7720 0x432c1eda1e224052,
7721 &[OpValueKind::Image],
7722 &[OpValueKind::Image],
7723 )
7724 .with_shape_rule(OpShapeRule::Explicit)
7725 .with_dtype_rule(OpDTypeRule::MatchInput)
7726 .with_differentiation(OpDifferentiation::None)
7727 .with_lowering(OpLowering::Dispatch)
7728 .with_fusion_class(OpFusionClass::Gather)
7729 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7730 .with_control_flow(OpControlFlow::Conditional)
7731 .attributes(&[
7732 OpAttributeSpec::new("width", OpAttributeKind::UnsignedInteger),
7733 OpAttributeSpec::new("height", OpAttributeKind::UnsignedInteger),
7734 OpAttributeSpec::new("mean0", OpAttributeKind::Float),
7735 OpAttributeSpec::new("mean1", OpAttributeKind::Float),
7736 OpAttributeSpec::new("mean2", OpAttributeKind::Float),
7737 OpAttributeSpec::new("std0", OpAttributeKind::Float),
7738 OpAttributeSpec::new("std1", OpAttributeKind::Float),
7739 OpAttributeSpec::new("std2", OpAttributeKind::Float),
7740 ]);
7741
7742 pub const SEGMENTATION_OVERLAY: OperationContract = OperationContract::new(
7743 "oa::image::segmentation_overlay",
7744 0x2583cec889ba734a,
7745 &[OpValueKind::Image, OpValueKind::Matrix, OpValueKind::Matrix],
7746 &[OpValueKind::Image],
7747 )
7748 .with_shape_rule(OpShapeRule::Explicit)
7749 .with_dtype_rule(OpDTypeRule::Explicit)
7750 .with_differentiation(OpDifferentiation::None)
7751 .with_lowering(OpLowering::Dispatch)
7752 .with_fusion_class(OpFusionClass::Pointwise)
7753 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7754 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
7755
7756 pub const CALC_HIST: OperationContract = OperationContract::new(
7757 "oa::image::calc_hist",
7758 0xdec648b1235465bc,
7759 &[OpValueKind::Image],
7760 &[OpValueKind::Matrix],
7761 )
7762 .with_shape_rule(OpShapeRule::Explicit)
7763 .with_dtype_rule(OpDTypeRule::Explicit)
7764 .with_differentiation(OpDifferentiation::None)
7765 .with_lowering(OpLowering::Dispatch)
7766 .with_fusion_class(OpFusionClass::Reduce)
7767 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7768 .attributes(&[
7769 OpAttributeSpec::new("bins", OpAttributeKind::UnsignedInteger),
7770 OpAttributeSpec::new("lower", OpAttributeKind::Float),
7771 OpAttributeSpec::new("upper", OpAttributeKind::Float),
7772 ]);
7773
7774 pub const EQUALIZE_HIST: OperationContract = OperationContract::new(
7775 "oa::image::equalize_hist",
7776 0x9cb3304a059426e6,
7777 &[OpValueKind::Image],
7778 &[OpValueKind::Image],
7779 )
7780 .with_shape_rule(OpShapeRule::Explicit)
7781 .with_dtype_rule(OpDTypeRule::MatchInput)
7782 .with_differentiation(OpDifferentiation::None)
7783 .with_lowering(OpLowering::Dispatch)
7784 .with_fusion_class(OpFusionClass::Effect)
7785 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7786
7787 pub const COMPARE_HIST: OperationContract = OperationContract::new(
7788 "oa::image::compare_hist",
7789 0x1ebdbd17e40cfacb,
7790 &[OpValueKind::Matrix, OpValueKind::Matrix],
7791 &[OpValueKind::Matrix],
7792 )
7793 .with_shape_rule(OpShapeRule::Explicit)
7794 .with_dtype_rule(OpDTypeRule::Explicit)
7795 .with_differentiation(OpDifferentiation::None)
7796 .with_lowering(OpLowering::Dispatch)
7797 .with_fusion_class(OpFusionClass::Reduce)
7798 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7799 .attributes(&[OpAttributeSpec::new("method", OpAttributeKind::Enum)]);
7800
7801 pub const PYR_DOWN: OperationContract = OperationContract::new(
7802 "oa::image::pyr_down",
7803 0x1fff822c81afc57b,
7804 &[OpValueKind::Image],
7805 &[OpValueKind::Image],
7806 )
7807 .with_shape_rule(OpShapeRule::Explicit)
7808 .with_dtype_rule(OpDTypeRule::MatchInput)
7809 .with_differentiation(OpDifferentiation::None)
7810 .with_lowering(OpLowering::Dispatch)
7811 .with_fusion_class(OpFusionClass::Gather)
7812 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7813
7814 pub const PYR_UP: OperationContract = OperationContract::new(
7815 "oa::image::pyr_up",
7816 0x4943bcc70a51b585,
7817 &[OpValueKind::Image],
7818 &[OpValueKind::Image],
7819 )
7820 .with_shape_rule(OpShapeRule::Explicit)
7821 .with_dtype_rule(OpDTypeRule::MatchInput)
7822 .with_differentiation(OpDifferentiation::None)
7823 .with_lowering(OpLowering::Dispatch)
7824 .with_fusion_class(OpFusionClass::Gather)
7825 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7826
7827 pub const THRESHOLD_AUTO: OperationContract = OperationContract::new(
7828 "oa::image::threshold_auto",
7829 0x61b59e7ee3ec8127,
7830 &[OpValueKind::Image],
7831 &[OpValueKind::Image, OpValueKind::Matrix],
7832 )
7833 .with_shape_rule(OpShapeRule::Explicit)
7834 .with_dtype_rule(OpDTypeRule::MatchInput)
7835 .with_differentiation(OpDifferentiation::None)
7836 .with_lowering(OpLowering::Dispatch)
7837 .with_fusion_class(OpFusionClass::Effect)
7838 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7839 .attributes(&[
7840 OpAttributeSpec::new("method", OpAttributeKind::Enum),
7841 OpAttributeSpec::new("max_value", OpAttributeKind::Float),
7842 ]);
7843
7844 pub const INTEGRAL: OperationContract = OperationContract::new(
7845 "oa::image::integral",
7846 0x6bbc5b95576cca38,
7847 &[OpValueKind::Image],
7848 &[OpValueKind::Matrix],
7849 )
7850 .with_shape_rule(OpShapeRule::Explicit)
7851 .with_dtype_rule(OpDTypeRule::MatchInput)
7852 .with_differentiation(OpDifferentiation::None)
7853 .with_lowering(OpLowering::Dispatch)
7854 .with_fusion_class(OpFusionClass::Effect)
7855 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7856
7857 pub const CVT_COLOR: OperationContract = OperationContract::new(
7858 "oa::image::cvt_color",
7859 0xfb265c9420d683b2,
7860 &[OpValueKind::Image],
7861 &[OpValueKind::Image],
7862 )
7863 .with_shape_rule(OpShapeRule::Explicit)
7864 .with_dtype_rule(OpDTypeRule::MatchInput)
7865 .with_differentiation(OpDifferentiation::None)
7866 .with_lowering(OpLowering::Dispatch)
7867 .with_fusion_class(OpFusionClass::Pointwise)
7868 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7869 .attributes(&[OpAttributeSpec::new("conversion", OpAttributeKind::Enum)]);
7870
7871 pub const APPLY_COLOR_MAP: OperationContract = OperationContract::new(
7872 "oa::image::apply_color_map",
7873 0x243e369de7b10eaa,
7874 &[OpValueKind::Image],
7875 &[OpValueKind::Image],
7876 )
7877 .with_shape_rule(OpShapeRule::Explicit)
7878 .with_dtype_rule(OpDTypeRule::MatchInput)
7879 .with_differentiation(OpDifferentiation::None)
7880 .with_lowering(OpLowering::Dispatch)
7881 .with_fusion_class(OpFusionClass::Pointwise)
7882 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7883 .attributes(&[OpAttributeSpec::new("colormap", OpAttributeKind::Enum)]);
7884
7885 pub const CALC_BACK_PROJECT: OperationContract = OperationContract::new(
7886 "oa::image::calc_back_project",
7887 0x8d1603b9e402da35,
7888 &[OpValueKind::Image, OpValueKind::Matrix],
7889 &[OpValueKind::Image],
7890 )
7891 .with_shape_rule(OpShapeRule::Explicit)
7892 .with_dtype_rule(OpDTypeRule::MatchInput)
7893 .with_differentiation(OpDifferentiation::None)
7894 .with_lowering(OpLowering::Dispatch)
7895 .with_fusion_class(OpFusionClass::Pointwise)
7896 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7897 .attributes(&[
7898 OpAttributeSpec::new("lower", OpAttributeKind::Float),
7899 OpAttributeSpec::new("upper", OpAttributeKind::Float),
7900 ]);
7901
7902 pub const CLAHE: OperationContract = OperationContract::new(
7903 "oa::image::clahe",
7904 0x4bf4c35486fa101a,
7905 &[OpValueKind::Image],
7906 &[OpValueKind::Image],
7907 )
7908 .with_shape_rule(OpShapeRule::Explicit)
7909 .with_dtype_rule(OpDTypeRule::MatchInput)
7910 .with_differentiation(OpDifferentiation::None)
7911 .with_lowering(OpLowering::Dispatch)
7912 .with_fusion_class(OpFusionClass::Effect)
7913 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7914 .attributes(&[
7915 OpAttributeSpec::new("clip_limit", OpAttributeKind::Float),
7916 OpAttributeSpec::new("tile_width", OpAttributeKind::UnsignedInteger),
7917 OpAttributeSpec::new("tile_height", OpAttributeKind::UnsignedInteger),
7918 ]);
7919
7920 pub const ACCUMULATE: OperationContract = OperationContract::new(
7921 "oa::image::accumulate",
7922 0x3279bcc7ed3a4791,
7923 &[OpValueKind::Image, OpValueKind::Image],
7924 &[OpValueKind::Image],
7925 )
7926 .with_shape_rule(OpShapeRule::Explicit)
7927 .with_dtype_rule(OpDTypeRule::MatchInput)
7928 .with_differentiation(OpDifferentiation::None)
7929 .with_lowering(OpLowering::Dispatch)
7930 .with_fusion_class(OpFusionClass::Pointwise)
7931 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7932
7933 pub const ACCUMULATE_WEIGHTED: OperationContract = OperationContract::new(
7934 "oa::image::accumulate_weighted",
7935 0xef0f7646410865b0,
7936 &[OpValueKind::Image, OpValueKind::Image],
7937 &[OpValueKind::Image],
7938 )
7939 .with_shape_rule(OpShapeRule::Explicit)
7940 .with_dtype_rule(OpDTypeRule::MatchInput)
7941 .with_differentiation(OpDifferentiation::None)
7942 .with_lowering(OpLowering::Dispatch)
7943 .with_fusion_class(OpFusionClass::Pointwise)
7944 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7945 .attributes(&[OpAttributeSpec::new("alpha", OpAttributeKind::Float)]);
7946
7947 pub const MOMENTS: OperationContract = OperationContract::new(
7948 "oa::image::moments",
7949 0x35d6d8244f9d3e26,
7950 &[OpValueKind::Image],
7951 &[OpValueKind::Matrix],
7952 )
7953 .with_shape_rule(OpShapeRule::Explicit)
7954 .with_dtype_rule(OpDTypeRule::MatchInput)
7955 .with_differentiation(OpDifferentiation::None)
7956 .with_lowering(OpLowering::Dispatch)
7957 .with_fusion_class(OpFusionClass::Reduce)
7958 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7959
7960 pub const PSNR: OperationContract = OperationContract::new(
7961 "oa::image::psnr",
7962 0x1b6ecaa7f981119e,
7963 &[OpValueKind::Image, OpValueKind::Image],
7964 &[OpValueKind::Matrix],
7965 )
7966 .with_shape_rule(OpShapeRule::Explicit)
7967 .with_dtype_rule(OpDTypeRule::MatchInput)
7968 .with_differentiation(OpDifferentiation::None)
7969 .with_lowering(OpLowering::Dispatch)
7970 .with_fusion_class(OpFusionClass::Reduce)
7971 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7972 .attributes(&[OpAttributeSpec::new("peak_value", OpAttributeKind::Float)]);
7973
7974 pub const SSIM: OperationContract = OperationContract::new(
7975 "oa::image::ssim",
7976 0x1daee9962c764cd0,
7977 &[OpValueKind::Image, OpValueKind::Image],
7978 &[OpValueKind::Matrix],
7979 )
7980 .with_shape_rule(OpShapeRule::Explicit)
7981 .with_dtype_rule(OpDTypeRule::MatchInput)
7982 .with_differentiation(OpDifferentiation::None)
7983 .with_lowering(OpLowering::Dispatch)
7984 .with_fusion_class(OpFusionClass::Reduce)
7985 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
7986
7987 pub const MATCH_TEMPLATE: OperationContract = OperationContract::new(
7988 "oa::image::match_template",
7989 0x18cacda0ce17f273,
7990 &[OpValueKind::Image, OpValueKind::Image],
7991 &[OpValueKind::Matrix],
7992 )
7993 .with_shape_rule(OpShapeRule::Explicit)
7994 .with_dtype_rule(OpDTypeRule::MatchInput)
7995 .with_differentiation(OpDifferentiation::None)
7996 .with_lowering(OpLowering::Dispatch)
7997 .with_fusion_class(OpFusionClass::Conv)
7998 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
7999 .attributes(&[OpAttributeSpec::new("method", OpAttributeKind::Enum)]);
8000
8001 pub const WARP_POLAR: OperationContract = OperationContract::new(
8002 "oa::image::warp_polar",
8003 0x75e5586982d68b8e,
8004 &[OpValueKind::Image],
8005 &[OpValueKind::Image],
8006 )
8007 .with_shape_rule(OpShapeRule::Explicit)
8008 .with_dtype_rule(OpDTypeRule::MatchInput)
8009 .with_differentiation(OpDifferentiation::None)
8010 .with_lowering(OpLowering::Dispatch)
8011 .with_fusion_class(OpFusionClass::Gather)
8012 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8013 .attributes(&[
8014 OpAttributeSpec::new("center_x", OpAttributeKind::Float),
8015 OpAttributeSpec::new("center_y", OpAttributeKind::Float),
8016 OpAttributeSpec::new("max_radius", OpAttributeKind::Float),
8017 OpAttributeSpec::new("out_width", OpAttributeKind::UnsignedInteger),
8018 OpAttributeSpec::new("out_height", OpAttributeKind::UnsignedInteger),
8019 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8020 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
8021 OpAttributeSpec::new("border", OpAttributeKind::Enum),
8022 OpAttributeSpec::new("border_value", OpAttributeKind::Float),
8023 ]);
8024
8025 pub const CANNY: OperationContract = OperationContract::new(
8026 "oa::image::canny",
8027 0x00385eb9028aa9b3,
8028 &[OpValueKind::Image],
8029 &[OpValueKind::Image],
8030 )
8031 .with_shape_rule(OpShapeRule::Explicit)
8032 .with_dtype_rule(OpDTypeRule::MatchInput)
8033 .with_differentiation(OpDifferentiation::None)
8034 .with_lowering(OpLowering::Dispatch)
8035 .with_fusion_class(OpFusionClass::Effect)
8036 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8037 .attributes(&[
8038 OpAttributeSpec::new("low_threshold", OpAttributeKind::Float),
8039 OpAttributeSpec::new("high_threshold", OpAttributeKind::Float),
8040 OpAttributeSpec::new("hysteresis_passes", OpAttributeKind::UnsignedInteger),
8041 ]);
8042
8043 pub const CONNECTED_COMPONENTS: OperationContract = OperationContract::new(
8044 "oa::image::connected_components",
8045 0xafdcf5e3b33791b9,
8046 &[OpValueKind::Image],
8047 &[OpValueKind::Matrix],
8048 )
8049 .with_shape_rule(OpShapeRule::Explicit)
8050 .with_dtype_rule(OpDTypeRule::MatchInput)
8051 .with_differentiation(OpDifferentiation::None)
8052 .with_lowering(OpLowering::Dispatch)
8053 .with_fusion_class(OpFusionClass::Effect)
8054 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8055 .attributes(&[
8056 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
8057 OpAttributeSpec::new("connectivity", OpAttributeKind::Enum),
8058 OpAttributeSpec::new("propagation_passes", OpAttributeKind::UnsignedInteger),
8059 ]);
8060
8061 pub const DISTANCE_TRANSFORM: OperationContract = OperationContract::new(
8062 "oa::image::distance_transform",
8063 0xfcbfec25e46d1a7f,
8064 &[OpValueKind::Image],
8065 &[OpValueKind::Matrix],
8066 )
8067 .with_shape_rule(OpShapeRule::Explicit)
8068 .with_dtype_rule(OpDTypeRule::MatchInput)
8069 .with_differentiation(OpDifferentiation::None)
8070 .with_lowering(OpLowering::Dispatch)
8071 .with_fusion_class(OpFusionClass::Effect)
8072 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8073 .attributes(&[
8074 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
8075 OpAttributeSpec::new("distance", OpAttributeKind::Enum),
8076 OpAttributeSpec::new("propagation_passes", OpAttributeKind::UnsignedInteger),
8077 ]);
8078
8079 pub const HOUGH_LINES: OperationContract = OperationContract::new(
8080 "oa::image::hough_lines",
8081 0x41b423ee4b611e97,
8082 &[OpValueKind::Image],
8083 &[OpValueKind::Matrix],
8084 )
8085 .with_shape_rule(OpShapeRule::Explicit)
8086 .with_dtype_rule(OpDTypeRule::MatchInput)
8087 .with_differentiation(OpDifferentiation::None)
8088 .with_lowering(OpLowering::Dispatch)
8089 .with_fusion_class(OpFusionClass::Effect)
8090 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8091 .attributes(&[
8092 OpAttributeSpec::new("edge_threshold", OpAttributeKind::Float),
8093 OpAttributeSpec::new("rho_step", OpAttributeKind::Float),
8094 OpAttributeSpec::new("theta_step", OpAttributeKind::Float),
8095 OpAttributeSpec::new("threshold", OpAttributeKind::UnsignedInteger),
8096 OpAttributeSpec::new("max_lines", OpAttributeKind::UnsignedInteger),
8097 ]);
8098
8099 pub const HOUGH_LINES_P: OperationContract = OperationContract::new(
8100 "oa::image::hough_lines_p",
8101 0xae146d00c93a2531,
8102 &[OpValueKind::Image],
8103 &[OpValueKind::Matrix],
8104 )
8105 .with_shape_rule(OpShapeRule::Explicit)
8106 .with_dtype_rule(OpDTypeRule::MatchInput)
8107 .with_differentiation(OpDifferentiation::None)
8108 .with_lowering(OpLowering::Dispatch)
8109 .with_fusion_class(OpFusionClass::Effect)
8110 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8111 .attributes(&[
8112 OpAttributeSpec::new("edge_threshold", OpAttributeKind::Float),
8113 OpAttributeSpec::new("rho_step", OpAttributeKind::Float),
8114 OpAttributeSpec::new("theta_step", OpAttributeKind::Float),
8115 OpAttributeSpec::new("threshold", OpAttributeKind::UnsignedInteger),
8116 OpAttributeSpec::new("max_lines", OpAttributeKind::UnsignedInteger),
8117 OpAttributeSpec::new("min_line_length", OpAttributeKind::Float),
8118 OpAttributeSpec::new("max_line_gap", OpAttributeKind::UnsignedInteger),
8119 ]);
8120
8121 pub const FIND_CONTOURS: OperationContract = OperationContract::new(
8122 "oa::image::find_contours",
8123 0xfd1f4b1b2abda875,
8124 &[OpValueKind::Image],
8125 &[OpValueKind::Matrix, OpValueKind::Matrix],
8126 )
8127 .with_shape_rule(OpShapeRule::Explicit)
8128 .with_dtype_rule(OpDTypeRule::MatchInput)
8129 .with_differentiation(OpDifferentiation::None)
8130 .with_lowering(OpLowering::Dispatch)
8131 .with_fusion_class(OpFusionClass::Effect)
8132 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8133 .attributes(&[
8134 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
8135 OpAttributeSpec::new("connectivity", OpAttributeKind::Enum),
8136 OpAttributeSpec::new("max_contours", OpAttributeKind::UnsignedInteger),
8137 OpAttributeSpec::new("max_points", OpAttributeKind::UnsignedInteger),
8138 OpAttributeSpec::new("propagation_passes", OpAttributeKind::UnsignedInteger),
8139 ]);
8140
8141 pub const FLOOD_FILL: OperationContract = OperationContract::new(
8142 "oa::image::flood_fill",
8143 0xe0b57fe51cba6ae2,
8144 &[OpValueKind::Image],
8145 &[OpValueKind::Image],
8146 )
8147 .with_shape_rule(OpShapeRule::Explicit)
8148 .with_dtype_rule(OpDTypeRule::MatchInput)
8149 .with_differentiation(OpDifferentiation::None)
8150 .with_lowering(OpLowering::Dispatch)
8151 .with_fusion_class(OpFusionClass::Effect)
8152 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8153 .attributes(&[
8154 OpAttributeSpec::new("seed_x", OpAttributeKind::UnsignedInteger),
8155 OpAttributeSpec::new("seed_y", OpAttributeKind::UnsignedInteger),
8156 OpAttributeSpec::new("value", OpAttributeKind::Float),
8157 OpAttributeSpec::new("lo_diff", OpAttributeKind::Float),
8158 OpAttributeSpec::new("up_diff", OpAttributeKind::Float),
8159 OpAttributeSpec::new("connectivity", OpAttributeKind::Enum),
8160 OpAttributeSpec::new("propagation_passes", OpAttributeKind::UnsignedInteger),
8161 ]);
8162
8163 pub const DRAW_LINE: OperationContract = OperationContract::new(
8164 "oa::image::draw_line",
8165 0xdab3d30bf79fef91,
8166 &[OpValueKind::Image],
8167 &[OpValueKind::Image],
8168 )
8169 .with_shape_rule(OpShapeRule::Explicit)
8170 .with_dtype_rule(OpDTypeRule::MatchInput)
8171 .with_differentiation(OpDifferentiation::None)
8172 .with_lowering(OpLowering::Dispatch)
8173 .with_fusion_class(OpFusionClass::Pointwise)
8174 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8175 .attributes(&[
8176 OpAttributeSpec::new("x1", OpAttributeKind::Float),
8177 OpAttributeSpec::new("y1", OpAttributeKind::Float),
8178 OpAttributeSpec::new("x2", OpAttributeKind::Float),
8179 OpAttributeSpec::new("y2", OpAttributeKind::Float),
8180 OpAttributeSpec::new("color", OpAttributeKind::Float),
8181 OpAttributeSpec::new("thickness", OpAttributeKind::Float),
8182 ]);
8183
8184 pub const DRAW_RECTANGLE: OperationContract = OperationContract::new(
8185 "oa::image::draw_rectangle",
8186 0xd5aef537edd71b5d,
8187 &[OpValueKind::Image],
8188 &[OpValueKind::Image],
8189 )
8190 .with_shape_rule(OpShapeRule::Explicit)
8191 .with_dtype_rule(OpDTypeRule::MatchInput)
8192 .with_differentiation(OpDifferentiation::None)
8193 .with_lowering(OpLowering::Dispatch)
8194 .with_fusion_class(OpFusionClass::Pointwise)
8195 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8196 .attributes(&[
8197 OpAttributeSpec::new("x", OpAttributeKind::Float),
8198 OpAttributeSpec::new("y", OpAttributeKind::Float),
8199 OpAttributeSpec::new("width", OpAttributeKind::Float),
8200 OpAttributeSpec::new("height", OpAttributeKind::Float),
8201 OpAttributeSpec::new("color", OpAttributeKind::Float),
8202 OpAttributeSpec::new("thickness", OpAttributeKind::Float),
8203 ]);
8204
8205 pub const DRAW_CIRCLE: OperationContract = OperationContract::new(
8206 "oa::image::draw_circle",
8207 0x48ad9d29b8e23afb,
8208 &[OpValueKind::Image],
8209 &[OpValueKind::Image],
8210 )
8211 .with_shape_rule(OpShapeRule::Explicit)
8212 .with_dtype_rule(OpDTypeRule::MatchInput)
8213 .with_differentiation(OpDifferentiation::None)
8214 .with_lowering(OpLowering::Dispatch)
8215 .with_fusion_class(OpFusionClass::Pointwise)
8216 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8217 .attributes(&[
8218 OpAttributeSpec::new("cx", OpAttributeKind::Float),
8219 OpAttributeSpec::new("cy", OpAttributeKind::Float),
8220 OpAttributeSpec::new("radius", OpAttributeKind::Float),
8221 OpAttributeSpec::new("color", OpAttributeKind::Float),
8222 OpAttributeSpec::new("thickness", OpAttributeKind::Float),
8223 ]);
8224
8225 pub const FILL_POLYGON: OperationContract = OperationContract::new(
8226 "oa::image::fill_polygon",
8227 0x2740c10840e88535,
8228 &[OpValueKind::Image, OpValueKind::Matrix],
8229 &[OpValueKind::Image],
8230 )
8231 .with_shape_rule(OpShapeRule::Explicit)
8232 .with_dtype_rule(OpDTypeRule::MatchInput)
8233 .with_differentiation(OpDifferentiation::None)
8234 .with_lowering(OpLowering::Dispatch)
8235 .with_fusion_class(OpFusionClass::Pointwise)
8236 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8237 .attributes(&[OpAttributeSpec::new("color", OpAttributeKind::Float)]);
8238
8239 pub const CORNER_SCORE: OperationContract = OperationContract::new(
8240 "oa::image::corner_score",
8241 0xd3edf5608a113269,
8242 &[OpValueKind::Image],
8243 &[OpValueKind::Image],
8244 )
8245 .with_shape_rule(OpShapeRule::Explicit)
8246 .with_dtype_rule(OpDTypeRule::MatchInput)
8247 .with_differentiation(OpDifferentiation::None)
8248 .with_lowering(OpLowering::Dispatch)
8249 .with_fusion_class(OpFusionClass::Effect)
8250 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8251 .attributes(&[
8252 OpAttributeSpec::new("block_size", OpAttributeKind::UnsignedInteger),
8253 OpAttributeSpec::new("k", OpAttributeKind::Float),
8254 OpAttributeSpec::new("score_type", OpAttributeKind::Enum),
8255 ]);
8256
8257 pub const CORNER_FAST: OperationContract = OperationContract::new(
8258 "oa::image::corner_fast",
8259 0x5475eb13a4fc1a04,
8260 &[OpValueKind::Image],
8261 &[OpValueKind::Image],
8262 )
8263 .with_shape_rule(OpShapeRule::Explicit)
8264 .with_dtype_rule(OpDTypeRule::MatchInput)
8265 .with_differentiation(OpDifferentiation::None)
8266 .with_lowering(OpLowering::Dispatch)
8267 .with_fusion_class(OpFusionClass::Effect)
8268 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8269 .attributes(&[OpAttributeSpec::new(
8270 "arc_length",
8271 OpAttributeKind::UnsignedInteger,
8272 )]);
8273
8274 pub const BF_MATCH: OperationContract = OperationContract::new(
8275 "oa::image::bf_match",
8276 0x2c419366e192c0aa,
8277 &[OpValueKind::Matrix, OpValueKind::Matrix],
8278 &[OpValueKind::Matrix],
8279 )
8280 .with_shape_rule(OpShapeRule::Explicit)
8281 .with_dtype_rule(OpDTypeRule::Explicit)
8282 .with_differentiation(OpDifferentiation::None)
8283 .with_lowering(OpLowering::Dispatch)
8284 .with_fusion_class(OpFusionClass::Effect)
8285 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
8286
8287 pub const GOOD_FEATURES_TO_TRACK: OperationContract = OperationContract::new(
8288 "oa::image::good_features_to_track",
8289 0x46a004089f6529ee,
8290 &[OpValueKind::Image],
8291 &[OpValueKind::Matrix, OpValueKind::Matrix],
8292 )
8293 .with_shape_rule(OpShapeRule::Explicit)
8294 .with_dtype_rule(OpDTypeRule::MatchInput)
8295 .with_differentiation(OpDifferentiation::None)
8296 .with_lowering(OpLowering::Dispatch)
8297 .with_fusion_class(OpFusionClass::Effect)
8298 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8299 .attributes(&[
8300 OpAttributeSpec::new("max_corners", OpAttributeKind::UnsignedInteger),
8301 OpAttributeSpec::new("quality", OpAttributeKind::Float),
8302 OpAttributeSpec::new("min_distance", OpAttributeKind::Float),
8303 ]);
8304
8305 pub const ORB: OperationContract = OperationContract::new(
8306 "oa::image::orb",
8307 0xc9b5fc470fdeb062,
8308 &[OpValueKind::Image],
8309 &[
8310 OpValueKind::Matrix,
8311 OpValueKind::Matrix,
8312 OpValueKind::Matrix,
8313 ],
8314 )
8315 .with_shape_rule(OpShapeRule::Explicit)
8316 .with_dtype_rule(OpDTypeRule::MatchInput)
8317 .with_differentiation(OpDifferentiation::None)
8318 .with_lowering(OpLowering::Dispatch)
8319 .with_fusion_class(OpFusionClass::Effect)
8320 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8321 .attributes(&[
8322 OpAttributeSpec::new("max_features", OpAttributeKind::UnsignedInteger),
8323 OpAttributeSpec::new("quality", OpAttributeKind::Float),
8324 OpAttributeSpec::new("min_distance", OpAttributeKind::Float),
8325 OpAttributeSpec::new("levels", OpAttributeKind::UnsignedInteger),
8326 OpAttributeSpec::new("edge", OpAttributeKind::UnsignedInteger),
8327 ]);
8328
8329 pub const OPTICAL_FLOW_PYR_LK: OperationContract = OperationContract::new(
8330 "oa::image::optical_flow_pyr_lk",
8331 0x650d67a85ebca1a6,
8332 &[OpValueKind::Image, OpValueKind::Image, OpValueKind::Matrix],
8333 &[
8334 OpValueKind::Matrix,
8335 OpValueKind::Matrix,
8336 OpValueKind::Matrix,
8337 ],
8338 )
8339 .with_shape_rule(OpShapeRule::Explicit)
8340 .with_dtype_rule(OpDTypeRule::MatchInput)
8341 .with_differentiation(OpDifferentiation::None)
8342 .with_lowering(OpLowering::Dispatch)
8343 .with_fusion_class(OpFusionClass::Effect)
8344 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8345 .attributes(&[
8346 OpAttributeSpec::new("levels", OpAttributeKind::UnsignedInteger),
8347 OpAttributeSpec::new("window", OpAttributeKind::UnsignedInteger),
8348 OpAttributeSpec::new("iterations", OpAttributeKind::UnsignedInteger),
8349 OpAttributeSpec::new("min_eigen", OpAttributeKind::Float),
8350 ]);
8351
8352 pub const OPTICAL_FLOW_FARNEBACK: OperationContract = OperationContract::new(
8353 "oa::image::optical_flow_farneback",
8354 0xd2f92de2556bff42,
8355 &[OpValueKind::Image, OpValueKind::Image],
8356 &[OpValueKind::Matrix],
8357 )
8358 .with_shape_rule(OpShapeRule::Explicit)
8359 .with_dtype_rule(OpDTypeRule::MatchInput)
8360 .with_differentiation(OpDifferentiation::None)
8361 .with_lowering(OpLowering::Dispatch)
8362 .with_fusion_class(OpFusionClass::Effect)
8363 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8364 .attributes(&[
8365 OpAttributeSpec::new("levels", OpAttributeKind::UnsignedInteger),
8366 OpAttributeSpec::new("window", OpAttributeKind::UnsignedInteger),
8367 OpAttributeSpec::new("iterations", OpAttributeKind::UnsignedInteger),
8368 OpAttributeSpec::new("poly_n", OpAttributeKind::UnsignedInteger),
8369 OpAttributeSpec::new("poly_sigma", OpAttributeKind::Float),
8370 ]);
8371
8372 pub const STEREO_BM: OperationContract = OperationContract::new(
8373 "oa::image::stereo_bm",
8374 0x3e0737721ba52e56,
8375 &[OpValueKind::Image, OpValueKind::Image],
8376 &[OpValueKind::Matrix],
8377 )
8378 .with_shape_rule(OpShapeRule::Explicit)
8379 .with_dtype_rule(OpDTypeRule::MatchInput)
8380 .with_differentiation(OpDifferentiation::None)
8381 .with_lowering(OpLowering::Dispatch)
8382 .with_fusion_class(OpFusionClass::Effect)
8383 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8384 .attributes(&[
8385 OpAttributeSpec::new("num_disparities", OpAttributeKind::UnsignedInteger),
8386 OpAttributeSpec::new("block_size", OpAttributeKind::UnsignedInteger),
8387 OpAttributeSpec::new("uniqueness", OpAttributeKind::UnsignedInteger),
8388 ]);
8389
8390 pub const REPROJECT_IMAGE_TO_3D: OperationContract = OperationContract::new(
8391 "oa::image::reproject_image_to_3d",
8392 0x41af943168e9bde2,
8393 &[OpValueKind::Matrix, OpValueKind::Matrix],
8394 &[OpValueKind::Matrix],
8395 )
8396 .with_shape_rule(OpShapeRule::Explicit)
8397 .with_dtype_rule(OpDTypeRule::MatchInput)
8398 .with_differentiation(OpDifferentiation::None)
8399 .with_lowering(OpLowering::Dispatch)
8400 .with_fusion_class(OpFusionClass::Pointwise)
8401 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
8402
8403 pub const FAST_NL_MEANS_DENOISING: OperationContract = OperationContract::new(
8404 "oa::image::fast_nl_means_denoising",
8405 0xd05724e57ee94403,
8406 &[OpValueKind::Image],
8407 &[OpValueKind::Image],
8408 )
8409 .with_shape_rule(OpShapeRule::Explicit)
8410 .with_dtype_rule(OpDTypeRule::MatchInput)
8411 .with_differentiation(OpDifferentiation::None)
8412 .with_lowering(OpLowering::Dispatch)
8413 .with_fusion_class(OpFusionClass::Effect)
8414 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8415 .attributes(&[
8416 OpAttributeSpec::new("h", OpAttributeKind::Float),
8417 OpAttributeSpec::new("template_window", OpAttributeKind::UnsignedInteger),
8418 OpAttributeSpec::new("search_window", OpAttributeKind::UnsignedInteger),
8419 ]);
8420
8421 pub const PYR_MEAN_SHIFT_FILTERING: OperationContract = OperationContract::new(
8422 "oa::image::pyr_mean_shift_filtering",
8423 0x420f78749a404ed1,
8424 &[OpValueKind::Image],
8425 &[OpValueKind::Image],
8426 )
8427 .with_shape_rule(OpShapeRule::Explicit)
8428 .with_dtype_rule(OpDTypeRule::MatchInput)
8429 .with_differentiation(OpDifferentiation::None)
8430 .with_lowering(OpLowering::Dispatch)
8431 .with_fusion_class(OpFusionClass::Effect)
8432 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8433 .attributes(&[
8434 OpAttributeSpec::new("sp", OpAttributeKind::Float),
8435 OpAttributeSpec::new("sr", OpAttributeKind::Float),
8436 OpAttributeSpec::new("max_level", OpAttributeKind::UnsignedInteger),
8437 ]);
8438}
8439
8440pub mod vision {
8442 use super::*;
8443
8444 pub const BOX_IOU: OperationContract = OperationContract::new(
8445 "oa::FnDetection::boxIou",
8446 0x2980e9f6b007cee0,
8447 &[OpValueKind::Matrix, OpValueKind::Matrix],
8448 &[OpValueKind::Matrix],
8449 )
8450 .with_shape_rule(OpShapeRule::Explicit)
8451 .with_dtype_rule(OpDTypeRule::MatchInput)
8452 .with_differentiation(OpDifferentiation::None)
8453 .with_lowering(OpLowering::Dispatch)
8454 .with_fusion_class(OpFusionClass::Reduce)
8455 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
8456
8457 pub const NMS: OperationContract = OperationContract::new(
8458 "oa::FnDetection::nms",
8459 0x0c4f72fb8deeadb4,
8460 &[
8461 OpValueKind::Matrix,
8462 OpValueKind::Matrix,
8463 OpValueKind::Matrix,
8464 ],
8465 &[OpValueKind::Matrix, OpValueKind::Matrix],
8466 )
8467 .with_shape_rule(OpShapeRule::Explicit)
8468 .with_dtype_rule(OpDTypeRule::Explicit)
8469 .with_differentiation(OpDifferentiation::None)
8470 .with_lowering(OpLowering::Dispatch)
8471 .with_fusion_class(OpFusionClass::Effect)
8472 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8473 .attributes(&[
8474 OpAttributeSpec::new("iouThreshold", OpAttributeKind::Float),
8475 OpAttributeSpec::new("scoreThreshold", OpAttributeKind::Float),
8476 OpAttributeSpec::new("maxDetections", OpAttributeKind::SignedInteger),
8477 OpAttributeSpec::new("classAgnostic", OpAttributeKind::Boolean),
8478 ]);
8479
8480 pub const CONFUSION_MATRIX: OperationContract = OperationContract::new(
8481 "oa::FnDetection::confusionMatrix",
8482 0xea8866f1cc77e6a7,
8483 &[OpValueKind::Matrix, OpValueKind::Matrix],
8484 &[OpValueKind::Matrix],
8485 )
8486 .with_shape_rule(OpShapeRule::Explicit)
8487 .with_dtype_rule(OpDTypeRule::Explicit)
8488 .with_differentiation(OpDifferentiation::None)
8489 .with_lowering(OpLowering::Dispatch)
8490 .with_fusion_class(OpFusionClass::Reduce)
8491 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8492 .attributes(&[OpAttributeSpec::new(
8493 "classCount",
8494 OpAttributeKind::SignedInteger,
8495 )]);
8496
8497 pub const BINARY_MASK_COUNTS: OperationContract = OperationContract::new(
8498 "oa::FnDetection::binaryMaskCounts",
8499 0x6a7213ba04980107,
8500 &[OpValueKind::Matrix, OpValueKind::Matrix],
8501 &[OpValueKind::Matrix],
8502 )
8503 .with_shape_rule(OpShapeRule::Explicit)
8504 .with_dtype_rule(OpDTypeRule::Explicit)
8505 .with_differentiation(OpDifferentiation::None)
8506 .with_lowering(OpLowering::Dispatch)
8507 .with_fusion_class(OpFusionClass::Reduce)
8508 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS));
8509
8510 pub const EVALUATE: OperationContract = OperationContract::new(
8511 "oa::FnDetection::evaluate",
8512 0x2cec5366356b3208,
8513 &[
8514 OpValueKind::Matrix,
8515 OpValueKind::Matrix,
8516 OpValueKind::Matrix,
8517 OpValueKind::Matrix,
8518 OpValueKind::Matrix,
8519 OpValueKind::Matrix,
8520 OpValueKind::Matrix,
8521 OpValueKind::Matrix,
8522 ],
8523 &[
8524 OpValueKind::Matrix,
8525 OpValueKind::Matrix,
8526 OpValueKind::Matrix,
8527 OpValueKind::Matrix,
8528 ],
8529 )
8530 .with_shape_rule(OpShapeRule::Explicit)
8531 .with_dtype_rule(OpDTypeRule::Explicit)
8532 .with_differentiation(OpDifferentiation::None)
8533 .with_lowering(OpLowering::Dispatch)
8534 .with_fusion_class(OpFusionClass::Reduce)
8535 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8536 .attributes(&[
8537 OpAttributeSpec::new("classCount", OpAttributeKind::SignedInteger),
8538 OpAttributeSpec::new("scoreThreshold", OpAttributeKind::Float),
8539 ]);
8540
8541 pub const EVALUATE_SEGMENTATION: OperationContract = OperationContract::new(
8542 "oa::FnDetection::evaluateSegmentation",
8543 0x22feb53dae982aa3,
8544 &[OpValueKind::Matrix, OpValueKind::Matrix],
8545 &[
8546 OpValueKind::Matrix,
8547 OpValueKind::Matrix,
8548 OpValueKind::Matrix,
8549 OpValueKind::Matrix,
8550 ],
8551 )
8552 .with_shape_rule(OpShapeRule::Explicit)
8553 .with_dtype_rule(OpDTypeRule::Explicit)
8554 .with_differentiation(OpDifferentiation::None)
8555 .with_lowering(OpLowering::Dispatch)
8556 .with_fusion_class(OpFusionClass::Reduce)
8557 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8558 .attributes(&[OpAttributeSpec::new(
8559 "classCount",
8560 OpAttributeKind::SignedInteger,
8561 )]);
8562}
8563
8564pub mod video {
8566 use super::*;
8567
8568 pub const RESAMPLE: OperationContract = OperationContract::new(
8569 "oa::video::resample",
8570 0xf8cb1a0b26c226c3,
8571 &[OpValueKind::Matrix],
8572 &[OpValueKind::Matrix],
8573 )
8574 .variadic_inputs(OpValueKind::Matrix, 1)
8575 .variadic_outputs(OpValueKind::Matrix, 1)
8576 .with_shape_rule(OpShapeRule::Explicit)
8577 .with_dtype_rule(OpDTypeRule::Explicit)
8578 .with_differentiation(OpDifferentiation::None)
8579 .with_lowering(OpLowering::Dispatch)
8580 .with_fusion_class(OpFusionClass::Gather)
8581 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8582 .attributes(&[
8583 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8584 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
8585 OpAttributeSpec::new("out_width", OpAttributeKind::UnsignedInteger),
8586 OpAttributeSpec::new("out_height", OpAttributeKind::UnsignedInteger),
8587 OpAttributeSpec::new("params", OpAttributeKind::String),
8588 ]);
8589
8590 pub const TO_MATRIX: OperationContract = OperationContract::new(
8591 "oa::video::to_matrix",
8592 0x8413174e393b4f28,
8593 &[OpValueKind::Matrix],
8594 &[OpValueKind::Matrix],
8595 )
8596 .variadic_inputs(OpValueKind::Matrix, 1)
8597 .with_shape_rule(OpShapeRule::Explicit)
8598 .with_dtype_rule(OpDTypeRule::Explicit)
8599 .with_differentiation(OpDifferentiation::None)
8600 .with_lowering(OpLowering::Dispatch)
8601 .with_fusion_class(OpFusionClass::Gather)
8602 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8603 .attributes(&[
8604 OpAttributeSpec::new("channels", OpAttributeKind::Enum),
8605 OpAttributeSpec::new("layout", OpAttributeKind::Enum),
8606 OpAttributeSpec::new("interpolation", OpAttributeKind::Enum),
8607 OpAttributeSpec::new("resize", OpAttributeKind::Enum),
8608 OpAttributeSpec::new("color_space", OpAttributeKind::Enum),
8609 OpAttributeSpec::new("full_range", OpAttributeKind::Boolean),
8610 OpAttributeSpec::new("normalization", OpAttributeKind::String),
8611 OpAttributeSpec::new("crop", OpAttributeKind::String),
8612 ]);
8613
8614 pub const OVERLAY: OperationContract = OperationContract::new(
8615 "oa::video::overlay",
8616 0x1996d19d487f20bf,
8617 &[OpValueKind::Matrix],
8618 &[OpValueKind::Matrix],
8619 )
8620 .variadic_inputs(OpValueKind::Matrix, 1)
8621 .variadic_outputs(OpValueKind::Matrix, 1)
8622 .with_shape_rule(OpShapeRule::Explicit)
8623 .with_dtype_rule(OpDTypeRule::Explicit)
8624 .with_differentiation(OpDifferentiation::None)
8625 .with_lowering(OpLowering::Dispatch)
8626 .with_fusion_class(OpFusionClass::Gather)
8627 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8628 .attributes(&[
8629 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8630 OpAttributeSpec::new("box_count", OpAttributeKind::UnsignedInteger),
8631 OpAttributeSpec::new("border_width", OpAttributeKind::UnsignedInteger),
8632 OpAttributeSpec::new("params", OpAttributeKind::String),
8633 ]);
8634
8635 pub const BLEND: OperationContract = OperationContract::new(
8636 "oa::video::blend",
8637 0xd7351d3564ca56af,
8638 &[OpValueKind::Matrix],
8639 &[OpValueKind::Matrix],
8640 )
8641 .variadic_inputs(OpValueKind::Matrix, 1)
8642 .variadic_outputs(OpValueKind::Matrix, 1)
8643 .with_shape_rule(OpShapeRule::Explicit)
8644 .with_dtype_rule(OpDTypeRule::Explicit)
8645 .with_differentiation(OpDifferentiation::None)
8646 .with_lowering(OpLowering::Dispatch)
8647 .with_fusion_class(OpFusionClass::Pointwise)
8648 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8649 .attributes(&[
8650 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8651 OpAttributeSpec::new("alpha", OpAttributeKind::UnsignedInteger),
8652 OpAttributeSpec::new("fill", OpAttributeKind::UnsignedInteger),
8653 OpAttributeSpec::new("params", OpAttributeKind::String),
8654 ]);
8655
8656 pub const SCORE_BLEND: OperationContract = OperationContract::new(
8657 "oa::video::score_blend",
8658 0xced84e4697b47dfb,
8659 &[OpValueKind::Matrix],
8660 &[OpValueKind::Matrix],
8661 )
8662 .variadic_inputs(OpValueKind::Matrix, 1)
8663 .variadic_outputs(OpValueKind::Matrix, 1)
8664 .with_shape_rule(OpShapeRule::Explicit)
8665 .with_dtype_rule(OpDTypeRule::Explicit)
8666 .with_differentiation(OpDifferentiation::None)
8667 .with_lowering(OpLowering::Dispatch)
8668 .with_fusion_class(OpFusionClass::Pointwise)
8669 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8670 .attributes(&[
8671 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8672 OpAttributeSpec::new("threshold", OpAttributeKind::Float),
8673 OpAttributeSpec::new("fill", OpAttributeKind::UnsignedInteger),
8674 OpAttributeSpec::new("params", OpAttributeKind::String),
8675 ]);
8676
8677 pub const LUMA_MAP: OperationContract = OperationContract::new(
8678 "oa::video::luma_map",
8679 0x02e48e186843f629,
8680 &[OpValueKind::Matrix],
8681 &[OpValueKind::Matrix],
8682 )
8683 .variadic_inputs(OpValueKind::Matrix, 1)
8684 .variadic_outputs(OpValueKind::Matrix, 1)
8685 .with_shape_rule(OpShapeRule::Explicit)
8686 .with_dtype_rule(OpDTypeRule::Explicit)
8687 .with_differentiation(OpDifferentiation::None)
8688 .with_lowering(OpLowering::Dispatch)
8689 .with_fusion_class(OpFusionClass::Pointwise)
8690 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8691 .attributes(&[
8692 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8693 OpAttributeSpec::new("threshold", OpAttributeKind::UnsignedInteger),
8694 OpAttributeSpec::new("low", OpAttributeKind::UnsignedInteger),
8695 OpAttributeSpec::new("high", OpAttributeKind::UnsignedInteger),
8696 ]);
8697
8698 pub const RANGE_CONVERT: OperationContract = OperationContract::new(
8699 "oa::video::range_convert",
8700 0xb2944c6775df0f27,
8701 &[OpValueKind::Matrix],
8702 &[OpValueKind::Matrix],
8703 )
8704 .variadic_inputs(OpValueKind::Matrix, 1)
8705 .variadic_outputs(OpValueKind::Matrix, 1)
8706 .with_shape_rule(OpShapeRule::Explicit)
8707 .with_dtype_rule(OpDTypeRule::Explicit)
8708 .with_differentiation(OpDifferentiation::None)
8709 .with_lowering(OpLowering::Dispatch)
8710 .with_fusion_class(OpFusionClass::Pointwise)
8711 .effects(OpEffect::READ_INPUTS.union(OpEffect::WRITE_OUTPUTS))
8712 .attributes(&[
8713 OpAttributeSpec::new("mode", OpAttributeKind::Enum),
8714 OpAttributeSpec::new("source_range", OpAttributeKind::Enum),
8715 OpAttributeSpec::new("target_range", OpAttributeKind::Enum),
8716 OpAttributeSpec::new("params", OpAttributeKind::String),
8717 ]);
8718}