1 /*
2 * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 // Auto-generated from ONNX op schema
26
27 package oracle.code.onnx.ir;
28
29 import jdk.incubator.code.*;
30 import jdk.incubator.code.extern.ExternalizedOp;
31 import jdk.incubator.code.extern.OpFactory;
32
33 import java.util.*;
34 import oracle.code.onnx.Tensor;
35
36 @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unused", "SequencedCollectionMethodCanBeUsed"})
37 public final class OnnxOps extends ExplicitOnnxOps {
38
39 private OnnxOps() {}
40
41 @OpFactoryHelper.OpDeclaration(Abs.NAME)
42 public static final class Abs extends OnnxOp {
43 public static final String NAME = "Abs";
44
45 public enum Attribute implements OnnxAttribute.None { }
46
47 public enum TypeConstraint implements OnnxTypeConstraint {
48 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
49 ;
50
51 final OnnxType.TypeVariable typeVariable;
52
53 TypeConstraint(OnnxType.TypeVariable typeVariable) {
54 assert typeVariable.name().equals(name());
55 this.typeVariable = typeVariable;
56 }
57
58 @Override
59 public OnnxType.TypeVariable typeVariable() {
60 return typeVariable;
61 }
62 }
63
64 public enum InputParameter implements OnnxParameter {
65 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
66 ;
67
68 final OnnxType type;
69 final Quantifier quantifier;
70
71 InputParameter(OnnxType type, Quantifier quantifier) {
72 this.type = type;
73 this.quantifier = quantifier;
74 }
75
76 @Override
77 public OnnxType type() {
78 return type;
79 }
80
81 @Override
82 public Quantifier quantifier() {
83 return quantifier;
84 }
85 }
86
87 public enum OutputParameter implements OnnxParameter {
88 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
89 ;
90
91 final OnnxType type;
92 final Quantifier quantifier;
93
94 OutputParameter(OnnxType type, Quantifier quantifier) {
95 this.type = type;
96 this.quantifier = quantifier;
97 }
98
99 @Override
100 public OnnxType type() {
101 return type;
102 }
103
104 @Override
105 public Quantifier quantifier() {
106 return quantifier;
107 }
108 }
109
110 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
111 NAME,
112 List.of(Attribute.values()),
113 List.of(TypeConstraint.values()),
114 List.of(InputParameter.values()),
115 List.of(OutputParameter.values())
116 );
117
118 public Abs(ExternalizedOp def) {
119 super(SCHEMA, def);
120 }
121
122 Abs(Abs that, CodeContext cc) {
123 super(that, cc);
124 }
125
126 @Override
127 public Abs transform(CodeContext cc, CodeTransformer ot) {
128 return new Abs(this, cc);
129 }
130
131 Abs(CodeType resultType, Value X) {
132 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
133 }
134
135 @Override
136 public SequencedSet<OnnxParameter> onnxOutputs() {
137 return onnxOutputs(SCHEMA);
138 }
139
140 @Override
141 public SequencedMap<OnnxParameter, Object> onnxInputs() {
142 return onnxInputs(SCHEMA, List.of(X()));
143 }
144
145 public Value X() {
146 return operands().get(0);
147 }
148
149 }
150
151 public static Abs Abs(CodeType resultType, Value X) {
152 return new Abs(resultType, X);
153 }
154
155 @OpFactoryHelper.OpDeclaration(Acos.NAME)
156 public static final class Acos extends OnnxOp {
157 public static final String NAME = "Acos";
158
159 public enum Attribute implements OnnxAttribute.None { }
160
161 public enum TypeConstraint implements OnnxTypeConstraint {
162 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
163 ;
164
165 final OnnxType.TypeVariable typeVariable;
166
167 TypeConstraint(OnnxType.TypeVariable typeVariable) {
168 assert typeVariable.name().equals(name());
169 this.typeVariable = typeVariable;
170 }
171
172 @Override
173 public OnnxType.TypeVariable typeVariable() {
174 return typeVariable;
175 }
176 }
177
178 public enum InputParameter implements OnnxParameter {
179 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
180 ;
181
182 final OnnxType type;
183 final Quantifier quantifier;
184
185 InputParameter(OnnxType type, Quantifier quantifier) {
186 this.type = type;
187 this.quantifier = quantifier;
188 }
189
190 @Override
191 public OnnxType type() {
192 return type;
193 }
194
195 @Override
196 public Quantifier quantifier() {
197 return quantifier;
198 }
199 }
200
201 public enum OutputParameter implements OnnxParameter {
202 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
203 ;
204
205 final OnnxType type;
206 final Quantifier quantifier;
207
208 OutputParameter(OnnxType type, Quantifier quantifier) {
209 this.type = type;
210 this.quantifier = quantifier;
211 }
212
213 @Override
214 public OnnxType type() {
215 return type;
216 }
217
218 @Override
219 public Quantifier quantifier() {
220 return quantifier;
221 }
222 }
223
224 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
225 NAME,
226 List.of(Attribute.values()),
227 List.of(TypeConstraint.values()),
228 List.of(InputParameter.values()),
229 List.of(OutputParameter.values())
230 );
231
232 public Acos(ExternalizedOp def) {
233 super(SCHEMA, def);
234 }
235
236 Acos(Acos that, CodeContext cc) {
237 super(that, cc);
238 }
239
240 @Override
241 public Acos transform(CodeContext cc, CodeTransformer ot) {
242 return new Acos(this, cc);
243 }
244
245 Acos(CodeType resultType, Value input) {
246 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
247 }
248
249 @Override
250 public SequencedSet<OnnxParameter> onnxOutputs() {
251 return onnxOutputs(SCHEMA);
252 }
253
254 @Override
255 public SequencedMap<OnnxParameter, Object> onnxInputs() {
256 return onnxInputs(SCHEMA, List.of(input()));
257 }
258
259 public Value input() {
260 return operands().get(0);
261 }
262
263 }
264
265 public static Acos Acos(CodeType resultType, Value input) {
266 return new Acos(resultType, input);
267 }
268
269 @OpFactoryHelper.OpDeclaration(Acosh.NAME)
270 public static final class Acosh extends OnnxOp {
271 public static final String NAME = "Acosh";
272
273 public enum Attribute implements OnnxAttribute.None { }
274
275 public enum TypeConstraint implements OnnxTypeConstraint {
276 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
277 ;
278
279 final OnnxType.TypeVariable typeVariable;
280
281 TypeConstraint(OnnxType.TypeVariable typeVariable) {
282 assert typeVariable.name().equals(name());
283 this.typeVariable = typeVariable;
284 }
285
286 @Override
287 public OnnxType.TypeVariable typeVariable() {
288 return typeVariable;
289 }
290 }
291
292 public enum InputParameter implements OnnxParameter {
293 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
294 ;
295
296 final OnnxType type;
297 final Quantifier quantifier;
298
299 InputParameter(OnnxType type, Quantifier quantifier) {
300 this.type = type;
301 this.quantifier = quantifier;
302 }
303
304 @Override
305 public OnnxType type() {
306 return type;
307 }
308
309 @Override
310 public Quantifier quantifier() {
311 return quantifier;
312 }
313 }
314
315 public enum OutputParameter implements OnnxParameter {
316 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
317 ;
318
319 final OnnxType type;
320 final Quantifier quantifier;
321
322 OutputParameter(OnnxType type, Quantifier quantifier) {
323 this.type = type;
324 this.quantifier = quantifier;
325 }
326
327 @Override
328 public OnnxType type() {
329 return type;
330 }
331
332 @Override
333 public Quantifier quantifier() {
334 return quantifier;
335 }
336 }
337
338 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
339 NAME,
340 List.of(Attribute.values()),
341 List.of(TypeConstraint.values()),
342 List.of(InputParameter.values()),
343 List.of(OutputParameter.values())
344 );
345
346 public Acosh(ExternalizedOp def) {
347 super(SCHEMA, def);
348 }
349
350 Acosh(Acosh that, CodeContext cc) {
351 super(that, cc);
352 }
353
354 @Override
355 public Acosh transform(CodeContext cc, CodeTransformer ot) {
356 return new Acosh(this, cc);
357 }
358
359 Acosh(CodeType resultType, Value input) {
360 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
361 }
362
363 @Override
364 public SequencedSet<OnnxParameter> onnxOutputs() {
365 return onnxOutputs(SCHEMA);
366 }
367
368 @Override
369 public SequencedMap<OnnxParameter, Object> onnxInputs() {
370 return onnxInputs(SCHEMA, List.of(input()));
371 }
372
373 public Value input() {
374 return operands().get(0);
375 }
376
377 }
378
379 public static Acosh Acosh(CodeType resultType, Value input) {
380 return new Acosh(resultType, input);
381 }
382
383 @OpFactoryHelper.OpDeclaration(Adagrad.NAME)
384 public static final class Adagrad extends OnnxOp {
385 public static final String NAME = "Adagrad";
386
387 public enum Attribute implements OnnxAttribute {
388 epsilon(Float.class, true, 1.0E-6f),
389 decay_factor(Float.class, true, 0.0f),
390 norm_coefficient(Float.class, true, 0.0f),
391 ;
392
393 final Class<?> t;
394 final boolean optional;
395 final Object defaultValue;
396
397 Attribute(Class<?> type, boolean optional, Object defaultValue) {
398 this.t = type;
399 this.optional = optional;
400 this.defaultValue = defaultValue;
401 assert optional || defaultValue == null;
402 }
403
404 public Class<?> type() {
405 return t;
406 }
407
408 public boolean isOptional() {
409 return optional;
410 }
411
412 public Object defaultValue() {
413 return defaultValue;
414 }
415 }
416
417 public enum TypeConstraint implements OnnxTypeConstraint {
418 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
419 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))),
420 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
421 ;
422
423 final OnnxType.TypeVariable typeVariable;
424
425 TypeConstraint(OnnxType.TypeVariable typeVariable) {
426 assert typeVariable.name().equals(name());
427 this.typeVariable = typeVariable;
428 }
429
430 @Override
431 public OnnxType.TypeVariable typeVariable() {
432 return typeVariable;
433 }
434 }
435
436 public enum InputParameter implements OnnxParameter {
437 R(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
438 T(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
439 inputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC),
440 ;
441
442 final OnnxType type;
443 final Quantifier quantifier;
444
445 InputParameter(OnnxType type, Quantifier quantifier) {
446 this.type = type;
447 this.quantifier = quantifier;
448 }
449
450 @Override
451 public OnnxType type() {
452 return type;
453 }
454
455 @Override
456 public Quantifier quantifier() {
457 return quantifier;
458 }
459 }
460
461 public enum OutputParameter implements OnnxParameter {
462 outputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC),
463 ;
464
465 final OnnxType type;
466 final Quantifier quantifier;
467
468 OutputParameter(OnnxType type, Quantifier quantifier) {
469 this.type = type;
470 this.quantifier = quantifier;
471 }
472
473 @Override
474 public OnnxType type() {
475 return type;
476 }
477
478 @Override
479 public Quantifier quantifier() {
480 return quantifier;
481 }
482 }
483
484 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
485 NAME,
486 List.of(Attribute.values()),
487 List.of(TypeConstraint.values()),
488 List.of(InputParameter.values()),
489 List.of(OutputParameter.values())
490 );
491
492 public Adagrad(ExternalizedOp def) {
493 super(SCHEMA, def);
494 }
495
496 Adagrad(Adagrad that, CodeContext cc) {
497 super(that, cc);
498 }
499
500 @Override
501 public Adagrad transform(CodeContext cc, CodeTransformer ot) {
502 return new Adagrad(this, cc);
503 }
504
505 Adagrad(CodeType resultType, Value R, Value T, List<Value> inputs, java.util.Optional<Float> epsilon, java.util.Optional<Float> decay_factor, java.util.Optional<Float> norm_coefficient) {
506 super(SCHEMA, resultType, Set.of(), List.of(R, T, inputs), List.of(epsilon, decay_factor, norm_coefficient));
507 }
508
509 @Override
510 public SequencedSet<OnnxParameter> onnxOutputs() {
511 return onnxOutputs(SCHEMA);
512 }
513
514 @Override
515 public SequencedMap<OnnxParameter, Object> onnxInputs() {
516 return onnxInputs(SCHEMA, List.of(R(), T(), inputs()));
517 }
518
519 public Value R() {
520 return operands().get(0);
521 }
522
523 public Value T() {
524 return operands().get(1);
525 }
526
527 public List<Value> inputs() {
528 return operands().subList(2, operands().size());
529 }
530
531 public java.util.Optional<Float> epsilon() {
532 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
533 return java.util.Optional.ofNullable(epsilon);
534 }
535
536 public java.util.Optional<Float> decay_factor() {
537 Float decay_factor = Attribute.decay_factor.access(Float.class, onnxAttributes);
538 return java.util.Optional.ofNullable(decay_factor);
539 }
540
541 public java.util.Optional<Float> norm_coefficient() {
542 Float norm_coefficient = Attribute.norm_coefficient.access(Float.class, onnxAttributes);
543 return java.util.Optional.ofNullable(norm_coefficient);
544 }
545
546 }
547
548 public static Adagrad Adagrad(CodeType resultType, Value R, Value T, List<Value> inputs, java.util.Optional<Float> epsilon, java.util.Optional<Float> decay_factor, java.util.Optional<Float> norm_coefficient) {
549 return new Adagrad(resultType, R, T, inputs, epsilon, decay_factor, norm_coefficient);
550 }
551
552 @OpFactoryHelper.OpDeclaration(Adam.NAME)
553 public static final class Adam extends OnnxOp {
554 public static final String NAME = "Adam";
555
556 public enum Attribute implements OnnxAttribute {
557 epsilon(Float.class, true, 1.0E-6f),
558 norm_coefficient_post(Float.class, true, 0.0f),
559 norm_coefficient(Float.class, true, 0.0f),
560 alpha(Float.class, true, 0.9f),
561 beta(Float.class, true, 0.999f),
562 ;
563
564 final Class<?> t;
565 final boolean optional;
566 final Object defaultValue;
567
568 Attribute(Class<?> type, boolean optional, Object defaultValue) {
569 this.t = type;
570 this.optional = optional;
571 this.defaultValue = defaultValue;
572 assert optional || defaultValue == null;
573 }
574
575 public Class<?> type() {
576 return t;
577 }
578
579 public boolean isOptional() {
580 return optional;
581 }
582
583 public Object defaultValue() {
584 return defaultValue;
585 }
586 }
587
588 public enum TypeConstraint implements OnnxTypeConstraint {
589 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
590 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))),
591 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
592 ;
593
594 final OnnxType.TypeVariable typeVariable;
595
596 TypeConstraint(OnnxType.TypeVariable typeVariable) {
597 assert typeVariable.name().equals(name());
598 this.typeVariable = typeVariable;
599 }
600
601 @Override
602 public OnnxType.TypeVariable typeVariable() {
603 return typeVariable;
604 }
605 }
606
607 public enum InputParameter implements OnnxParameter {
608 R(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
609 T(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
610 inputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC),
611 ;
612
613 final OnnxType type;
614 final Quantifier quantifier;
615
616 InputParameter(OnnxType type, Quantifier quantifier) {
617 this.type = type;
618 this.quantifier = quantifier;
619 }
620
621 @Override
622 public OnnxType type() {
623 return type;
624 }
625
626 @Override
627 public Quantifier quantifier() {
628 return quantifier;
629 }
630 }
631
632 public enum OutputParameter implements OnnxParameter {
633 outputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC),
634 ;
635
636 final OnnxType type;
637 final Quantifier quantifier;
638
639 OutputParameter(OnnxType type, Quantifier quantifier) {
640 this.type = type;
641 this.quantifier = quantifier;
642 }
643
644 @Override
645 public OnnxType type() {
646 return type;
647 }
648
649 @Override
650 public Quantifier quantifier() {
651 return quantifier;
652 }
653 }
654
655 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
656 NAME,
657 List.of(Attribute.values()),
658 List.of(TypeConstraint.values()),
659 List.of(InputParameter.values()),
660 List.of(OutputParameter.values())
661 );
662
663 public Adam(ExternalizedOp def) {
664 super(SCHEMA, def);
665 }
666
667 Adam(Adam that, CodeContext cc) {
668 super(that, cc);
669 }
670
671 @Override
672 public Adam transform(CodeContext cc, CodeTransformer ot) {
673 return new Adam(this, cc);
674 }
675
676 Adam(CodeType resultType, Value R, Value T, List<Value> inputs, java.util.Optional<Float> epsilon, java.util.Optional<Float> norm_coefficient_post, java.util.Optional<Float> norm_coefficient, java.util.Optional<Float> alpha, java.util.Optional<Float> beta) {
677 super(SCHEMA, resultType, Set.of(), List.of(R, T, inputs), List.of(epsilon, norm_coefficient_post, norm_coefficient, alpha, beta));
678 }
679
680 @Override
681 public SequencedSet<OnnxParameter> onnxOutputs() {
682 return onnxOutputs(SCHEMA);
683 }
684
685 @Override
686 public SequencedMap<OnnxParameter, Object> onnxInputs() {
687 return onnxInputs(SCHEMA, List.of(R(), T(), inputs()));
688 }
689
690 public Value R() {
691 return operands().get(0);
692 }
693
694 public Value T() {
695 return operands().get(1);
696 }
697
698 public List<Value> inputs() {
699 return operands().subList(2, operands().size());
700 }
701
702 public java.util.Optional<Float> epsilon() {
703 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
704 return java.util.Optional.ofNullable(epsilon);
705 }
706
707 public java.util.Optional<Float> norm_coefficient_post() {
708 Float norm_coefficient_post = Attribute.norm_coefficient_post.access(Float.class, onnxAttributes);
709 return java.util.Optional.ofNullable(norm_coefficient_post);
710 }
711
712 public java.util.Optional<Float> norm_coefficient() {
713 Float norm_coefficient = Attribute.norm_coefficient.access(Float.class, onnxAttributes);
714 return java.util.Optional.ofNullable(norm_coefficient);
715 }
716
717 public java.util.Optional<Float> alpha() {
718 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
719 return java.util.Optional.ofNullable(alpha);
720 }
721
722 public java.util.Optional<Float> beta() {
723 Float beta = Attribute.beta.access(Float.class, onnxAttributes);
724 return java.util.Optional.ofNullable(beta);
725 }
726
727 }
728
729 public static Adam Adam(CodeType resultType, Value R, Value T, List<Value> inputs, java.util.Optional<Float> epsilon, java.util.Optional<Float> norm_coefficient_post, java.util.Optional<Float> norm_coefficient, java.util.Optional<Float> alpha, java.util.Optional<Float> beta) {
730 return new Adam(resultType, R, T, inputs, epsilon, norm_coefficient_post, norm_coefficient, alpha, beta);
731 }
732
733 @OpFactoryHelper.OpDeclaration(Add.NAME)
734 public static final class Add extends OnnxOp {
735 public static final String NAME = "Add";
736
737 public enum Attribute implements OnnxAttribute.None { }
738
739 public enum TypeConstraint implements OnnxTypeConstraint {
740 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
741 ;
742
743 final OnnxType.TypeVariable typeVariable;
744
745 TypeConstraint(OnnxType.TypeVariable typeVariable) {
746 assert typeVariable.name().equals(name());
747 this.typeVariable = typeVariable;
748 }
749
750 @Override
751 public OnnxType.TypeVariable typeVariable() {
752 return typeVariable;
753 }
754 }
755
756 public enum InputParameter implements OnnxParameter {
757 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
758 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
759 ;
760
761 final OnnxType type;
762 final Quantifier quantifier;
763
764 InputParameter(OnnxType type, Quantifier quantifier) {
765 this.type = type;
766 this.quantifier = quantifier;
767 }
768
769 @Override
770 public OnnxType type() {
771 return type;
772 }
773
774 @Override
775 public Quantifier quantifier() {
776 return quantifier;
777 }
778 }
779
780 public enum OutputParameter implements OnnxParameter {
781 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
782 ;
783
784 final OnnxType type;
785 final Quantifier quantifier;
786
787 OutputParameter(OnnxType type, Quantifier quantifier) {
788 this.type = type;
789 this.quantifier = quantifier;
790 }
791
792 @Override
793 public OnnxType type() {
794 return type;
795 }
796
797 @Override
798 public Quantifier quantifier() {
799 return quantifier;
800 }
801 }
802
803 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
804 NAME,
805 List.of(Attribute.values()),
806 List.of(TypeConstraint.values()),
807 List.of(InputParameter.values()),
808 List.of(OutputParameter.values())
809 );
810
811 public Add(ExternalizedOp def) {
812 super(SCHEMA, def);
813 }
814
815 Add(Add that, CodeContext cc) {
816 super(that, cc);
817 }
818
819 @Override
820 public Add transform(CodeContext cc, CodeTransformer ot) {
821 return new Add(this, cc);
822 }
823
824 Add(CodeType resultType, Value A, Value B) {
825 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
826 }
827
828 @Override
829 public SequencedSet<OnnxParameter> onnxOutputs() {
830 return onnxOutputs(SCHEMA);
831 }
832
833 @Override
834 public SequencedMap<OnnxParameter, Object> onnxInputs() {
835 return onnxInputs(SCHEMA, List.of(A(), B()));
836 }
837
838 public Value A() {
839 return operands().get(0);
840 }
841
842 public Value B() {
843 return operands().get(1);
844 }
845
846 }
847
848 public static Add Add(CodeType resultType, Value A, Value B) {
849 return new Add(resultType, A, B);
850 }
851
852 @OpFactoryHelper.OpDeclaration(AffineGrid.NAME)
853 public static final class AffineGrid extends OnnxOp {
854 public static final String NAME = "AffineGrid";
855
856 public enum Attribute implements OnnxAttribute {
857 align_corners(Long.class, true, 0),
858 ;
859
860 final Class<?> t;
861 final boolean optional;
862 final Object defaultValue;
863
864 Attribute(Class<?> type, boolean optional, Object defaultValue) {
865 this.t = type;
866 this.optional = optional;
867 this.defaultValue = defaultValue;
868 assert optional || defaultValue == null;
869 }
870
871 public Class<?> type() {
872 return t;
873 }
874
875 public boolean isOptional() {
876 return optional;
877 }
878
879 public Object defaultValue() {
880 return defaultValue;
881 }
882 }
883
884 public enum TypeConstraint implements OnnxTypeConstraint {
885 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
886 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))),
887 ;
888
889 final OnnxType.TypeVariable typeVariable;
890
891 TypeConstraint(OnnxType.TypeVariable typeVariable) {
892 assert typeVariable.name().equals(name());
893 this.typeVariable = typeVariable;
894 }
895
896 @Override
897 public OnnxType.TypeVariable typeVariable() {
898 return typeVariable;
899 }
900 }
901
902 public enum InputParameter implements OnnxParameter {
903 theta(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
904 size(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
905 ;
906
907 final OnnxType type;
908 final Quantifier quantifier;
909
910 InputParameter(OnnxType type, Quantifier quantifier) {
911 this.type = type;
912 this.quantifier = quantifier;
913 }
914
915 @Override
916 public OnnxType type() {
917 return type;
918 }
919
920 @Override
921 public Quantifier quantifier() {
922 return quantifier;
923 }
924 }
925
926 public enum OutputParameter implements OnnxParameter {
927 grid(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
928 ;
929
930 final OnnxType type;
931 final Quantifier quantifier;
932
933 OutputParameter(OnnxType type, Quantifier quantifier) {
934 this.type = type;
935 this.quantifier = quantifier;
936 }
937
938 @Override
939 public OnnxType type() {
940 return type;
941 }
942
943 @Override
944 public Quantifier quantifier() {
945 return quantifier;
946 }
947 }
948
949 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
950 NAME,
951 List.of(Attribute.values()),
952 List.of(TypeConstraint.values()),
953 List.of(InputParameter.values()),
954 List.of(OutputParameter.values())
955 );
956
957 public AffineGrid(ExternalizedOp def) {
958 super(SCHEMA, def);
959 }
960
961 AffineGrid(AffineGrid that, CodeContext cc) {
962 super(that, cc);
963 }
964
965 @Override
966 public AffineGrid transform(CodeContext cc, CodeTransformer ot) {
967 return new AffineGrid(this, cc);
968 }
969
970 AffineGrid(CodeType resultType, Value theta, Value size, java.util.Optional<Long> align_corners) {
971 super(SCHEMA, resultType, Set.of(), List.of(theta, size), List.of(align_corners));
972 }
973
974 @Override
975 public SequencedSet<OnnxParameter> onnxOutputs() {
976 return onnxOutputs(SCHEMA);
977 }
978
979 @Override
980 public SequencedMap<OnnxParameter, Object> onnxInputs() {
981 return onnxInputs(SCHEMA, List.of(theta(), size()));
982 }
983
984 public Value theta() {
985 return operands().get(0);
986 }
987
988 public Value size() {
989 return operands().get(1);
990 }
991
992 public java.util.Optional<Long> align_corners() {
993 Long align_corners = Attribute.align_corners.access(Long.class, onnxAttributes);
994 return java.util.Optional.ofNullable(align_corners);
995 }
996
997 }
998
999 public static AffineGrid AffineGrid(CodeType resultType, Value theta, Value size, java.util.Optional<Long> align_corners) {
1000 return new AffineGrid(resultType, theta, size, align_corners);
1001 }
1002
1003 @OpFactoryHelper.OpDeclaration(And.NAME)
1004 public static final class And extends OnnxOp {
1005 public static final String NAME = "And";
1006
1007 public enum Attribute implements OnnxAttribute.None { }
1008
1009 public enum TypeConstraint implements OnnxTypeConstraint {
1010 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))),
1011 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
1012 ;
1013
1014 final OnnxType.TypeVariable typeVariable;
1015
1016 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1017 assert typeVariable.name().equals(name());
1018 this.typeVariable = typeVariable;
1019 }
1020
1021 @Override
1022 public OnnxType.TypeVariable typeVariable() {
1023 return typeVariable;
1024 }
1025 }
1026
1027 public enum InputParameter implements OnnxParameter {
1028 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1029 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1030 ;
1031
1032 final OnnxType type;
1033 final Quantifier quantifier;
1034
1035 InputParameter(OnnxType type, Quantifier quantifier) {
1036 this.type = type;
1037 this.quantifier = quantifier;
1038 }
1039
1040 @Override
1041 public OnnxType type() {
1042 return type;
1043 }
1044
1045 @Override
1046 public Quantifier quantifier() {
1047 return quantifier;
1048 }
1049 }
1050
1051 public enum OutputParameter implements OnnxParameter {
1052 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
1053 ;
1054
1055 final OnnxType type;
1056 final Quantifier quantifier;
1057
1058 OutputParameter(OnnxType type, Quantifier quantifier) {
1059 this.type = type;
1060 this.quantifier = quantifier;
1061 }
1062
1063 @Override
1064 public OnnxType type() {
1065 return type;
1066 }
1067
1068 @Override
1069 public Quantifier quantifier() {
1070 return quantifier;
1071 }
1072 }
1073
1074 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1075 NAME,
1076 List.of(Attribute.values()),
1077 List.of(TypeConstraint.values()),
1078 List.of(InputParameter.values()),
1079 List.of(OutputParameter.values())
1080 );
1081
1082 public And(ExternalizedOp def) {
1083 super(SCHEMA, def);
1084 }
1085
1086 And(And that, CodeContext cc) {
1087 super(that, cc);
1088 }
1089
1090 @Override
1091 public And transform(CodeContext cc, CodeTransformer ot) {
1092 return new And(this, cc);
1093 }
1094
1095 And(CodeType resultType, Value A, Value B) {
1096 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
1097 }
1098
1099 @Override
1100 public SequencedSet<OnnxParameter> onnxOutputs() {
1101 return onnxOutputs(SCHEMA);
1102 }
1103
1104 @Override
1105 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1106 return onnxInputs(SCHEMA, List.of(A(), B()));
1107 }
1108
1109 public Value A() {
1110 return operands().get(0);
1111 }
1112
1113 public Value B() {
1114 return operands().get(1);
1115 }
1116
1117 }
1118
1119 public static And And(CodeType resultType, Value A, Value B) {
1120 return new And(resultType, A, B);
1121 }
1122
1123 @OpFactoryHelper.OpDeclaration(ArgMax.NAME)
1124 public static final class ArgMax extends OnnxOp {
1125 public static final String NAME = "ArgMax";
1126
1127 public enum Attribute implements OnnxAttribute {
1128 keepdims(Long.class, true, 1),
1129 select_last_index(Long.class, true, 0),
1130 axis(Long.class, true, 0),
1131 ;
1132
1133 final Class<?> t;
1134 final boolean optional;
1135 final Object defaultValue;
1136
1137 Attribute(Class<?> type, boolean optional, Object defaultValue) {
1138 this.t = type;
1139 this.optional = optional;
1140 this.defaultValue = defaultValue;
1141 assert optional || defaultValue == null;
1142 }
1143
1144 public Class<?> type() {
1145 return t;
1146 }
1147
1148 public boolean isOptional() {
1149 return optional;
1150 }
1151
1152 public Object defaultValue() {
1153 return defaultValue;
1154 }
1155 }
1156
1157 public enum TypeConstraint implements OnnxTypeConstraint {
1158 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
1159 ;
1160
1161 final OnnxType.TypeVariable typeVariable;
1162
1163 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1164 assert typeVariable.name().equals(name());
1165 this.typeVariable = typeVariable;
1166 }
1167
1168 @Override
1169 public OnnxType.TypeVariable typeVariable() {
1170 return typeVariable;
1171 }
1172 }
1173
1174 public enum InputParameter implements OnnxParameter {
1175 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1176 ;
1177
1178 final OnnxType type;
1179 final Quantifier quantifier;
1180
1181 InputParameter(OnnxType type, Quantifier quantifier) {
1182 this.type = type;
1183 this.quantifier = quantifier;
1184 }
1185
1186 @Override
1187 public OnnxType type() {
1188 return type;
1189 }
1190
1191 @Override
1192 public Quantifier quantifier() {
1193 return quantifier;
1194 }
1195 }
1196
1197 public enum OutputParameter implements OnnxParameter {
1198 reduced(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
1199 ;
1200
1201 final OnnxType type;
1202 final Quantifier quantifier;
1203
1204 OutputParameter(OnnxType type, Quantifier quantifier) {
1205 this.type = type;
1206 this.quantifier = quantifier;
1207 }
1208
1209 @Override
1210 public OnnxType type() {
1211 return type;
1212 }
1213
1214 @Override
1215 public Quantifier quantifier() {
1216 return quantifier;
1217 }
1218 }
1219
1220 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1221 NAME,
1222 List.of(Attribute.values()),
1223 List.of(TypeConstraint.values()),
1224 List.of(InputParameter.values()),
1225 List.of(OutputParameter.values())
1226 );
1227
1228 public ArgMax(ExternalizedOp def) {
1229 super(SCHEMA, def);
1230 }
1231
1232 ArgMax(ArgMax that, CodeContext cc) {
1233 super(that, cc);
1234 }
1235
1236 @Override
1237 public ArgMax transform(CodeContext cc, CodeTransformer ot) {
1238 return new ArgMax(this, cc);
1239 }
1240
1241 ArgMax(CodeType resultType, Value data, java.util.Optional<Long> keepdims, java.util.Optional<Long> select_last_index, java.util.Optional<Long> axis) {
1242 super(SCHEMA, resultType, Set.of(), List.of(data), List.of(keepdims, select_last_index, axis));
1243 }
1244
1245 @Override
1246 public SequencedSet<OnnxParameter> onnxOutputs() {
1247 return onnxOutputs(SCHEMA);
1248 }
1249
1250 @Override
1251 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1252 return onnxInputs(SCHEMA, List.of(data()));
1253 }
1254
1255 public Value data() {
1256 return operands().get(0);
1257 }
1258
1259 public java.util.Optional<Long> keepdims() {
1260 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
1261 return java.util.Optional.ofNullable(keepdims);
1262 }
1263
1264 public java.util.Optional<Long> select_last_index() {
1265 Long select_last_index = Attribute.select_last_index.access(Long.class, onnxAttributes);
1266 return java.util.Optional.ofNullable(select_last_index);
1267 }
1268
1269 public java.util.Optional<Long> axis() {
1270 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
1271 return java.util.Optional.ofNullable(axis);
1272 }
1273
1274 }
1275
1276 public static ArgMax ArgMax(CodeType resultType, Value data, java.util.Optional<Long> keepdims, java.util.Optional<Long> select_last_index, java.util.Optional<Long> axis) {
1277 return new ArgMax(resultType, data, keepdims, select_last_index, axis);
1278 }
1279
1280 @OpFactoryHelper.OpDeclaration(ArgMin.NAME)
1281 public static final class ArgMin extends OnnxOp {
1282 public static final String NAME = "ArgMin";
1283
1284 public enum Attribute implements OnnxAttribute {
1285 keepdims(Long.class, true, 1),
1286 select_last_index(Long.class, true, 0),
1287 axis(Long.class, true, 0),
1288 ;
1289
1290 final Class<?> t;
1291 final boolean optional;
1292 final Object defaultValue;
1293
1294 Attribute(Class<?> type, boolean optional, Object defaultValue) {
1295 this.t = type;
1296 this.optional = optional;
1297 this.defaultValue = defaultValue;
1298 assert optional || defaultValue == null;
1299 }
1300
1301 public Class<?> type() {
1302 return t;
1303 }
1304
1305 public boolean isOptional() {
1306 return optional;
1307 }
1308
1309 public Object defaultValue() {
1310 return defaultValue;
1311 }
1312 }
1313
1314 public enum TypeConstraint implements OnnxTypeConstraint {
1315 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
1316 ;
1317
1318 final OnnxType.TypeVariable typeVariable;
1319
1320 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1321 assert typeVariable.name().equals(name());
1322 this.typeVariable = typeVariable;
1323 }
1324
1325 @Override
1326 public OnnxType.TypeVariable typeVariable() {
1327 return typeVariable;
1328 }
1329 }
1330
1331 public enum InputParameter implements OnnxParameter {
1332 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1333 ;
1334
1335 final OnnxType type;
1336 final Quantifier quantifier;
1337
1338 InputParameter(OnnxType type, Quantifier quantifier) {
1339 this.type = type;
1340 this.quantifier = quantifier;
1341 }
1342
1343 @Override
1344 public OnnxType type() {
1345 return type;
1346 }
1347
1348 @Override
1349 public Quantifier quantifier() {
1350 return quantifier;
1351 }
1352 }
1353
1354 public enum OutputParameter implements OnnxParameter {
1355 reduced(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
1356 ;
1357
1358 final OnnxType type;
1359 final Quantifier quantifier;
1360
1361 OutputParameter(OnnxType type, Quantifier quantifier) {
1362 this.type = type;
1363 this.quantifier = quantifier;
1364 }
1365
1366 @Override
1367 public OnnxType type() {
1368 return type;
1369 }
1370
1371 @Override
1372 public Quantifier quantifier() {
1373 return quantifier;
1374 }
1375 }
1376
1377 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1378 NAME,
1379 List.of(Attribute.values()),
1380 List.of(TypeConstraint.values()),
1381 List.of(InputParameter.values()),
1382 List.of(OutputParameter.values())
1383 );
1384
1385 public ArgMin(ExternalizedOp def) {
1386 super(SCHEMA, def);
1387 }
1388
1389 ArgMin(ArgMin that, CodeContext cc) {
1390 super(that, cc);
1391 }
1392
1393 @Override
1394 public ArgMin transform(CodeContext cc, CodeTransformer ot) {
1395 return new ArgMin(this, cc);
1396 }
1397
1398 ArgMin(CodeType resultType, Value data, java.util.Optional<Long> keepdims, java.util.Optional<Long> select_last_index, java.util.Optional<Long> axis) {
1399 super(SCHEMA, resultType, Set.of(), List.of(data), List.of(keepdims, select_last_index, axis));
1400 }
1401
1402 @Override
1403 public SequencedSet<OnnxParameter> onnxOutputs() {
1404 return onnxOutputs(SCHEMA);
1405 }
1406
1407 @Override
1408 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1409 return onnxInputs(SCHEMA, List.of(data()));
1410 }
1411
1412 public Value data() {
1413 return operands().get(0);
1414 }
1415
1416 public java.util.Optional<Long> keepdims() {
1417 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
1418 return java.util.Optional.ofNullable(keepdims);
1419 }
1420
1421 public java.util.Optional<Long> select_last_index() {
1422 Long select_last_index = Attribute.select_last_index.access(Long.class, onnxAttributes);
1423 return java.util.Optional.ofNullable(select_last_index);
1424 }
1425
1426 public java.util.Optional<Long> axis() {
1427 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
1428 return java.util.Optional.ofNullable(axis);
1429 }
1430
1431 }
1432
1433 public static ArgMin ArgMin(CodeType resultType, Value data, java.util.Optional<Long> keepdims, java.util.Optional<Long> select_last_index, java.util.Optional<Long> axis) {
1434 return new ArgMin(resultType, data, keepdims, select_last_index, axis);
1435 }
1436
1437 @OpFactoryHelper.OpDeclaration(ArrayFeatureExtractor.NAME)
1438 public static final class ArrayFeatureExtractor extends OnnxOp {
1439 public static final String NAME = "ArrayFeatureExtractor";
1440
1441 public enum Attribute implements OnnxAttribute.None { }
1442
1443 public enum TypeConstraint implements OnnxTypeConstraint {
1444 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.string())))),
1445 ;
1446
1447 final OnnxType.TypeVariable typeVariable;
1448
1449 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1450 assert typeVariable.name().equals(name());
1451 this.typeVariable = typeVariable;
1452 }
1453
1454 @Override
1455 public OnnxType.TypeVariable typeVariable() {
1456 return typeVariable;
1457 }
1458 }
1459
1460 public enum InputParameter implements OnnxParameter {
1461 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1462 Y(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
1463 ;
1464
1465 final OnnxType type;
1466 final Quantifier quantifier;
1467
1468 InputParameter(OnnxType type, Quantifier quantifier) {
1469 this.type = type;
1470 this.quantifier = quantifier;
1471 }
1472
1473 @Override
1474 public OnnxType type() {
1475 return type;
1476 }
1477
1478 @Override
1479 public Quantifier quantifier() {
1480 return quantifier;
1481 }
1482 }
1483
1484 public enum OutputParameter implements OnnxParameter {
1485 Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1486 ;
1487
1488 final OnnxType type;
1489 final Quantifier quantifier;
1490
1491 OutputParameter(OnnxType type, Quantifier quantifier) {
1492 this.type = type;
1493 this.quantifier = quantifier;
1494 }
1495
1496 @Override
1497 public OnnxType type() {
1498 return type;
1499 }
1500
1501 @Override
1502 public Quantifier quantifier() {
1503 return quantifier;
1504 }
1505 }
1506
1507 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1508 NAME,
1509 List.of(Attribute.values()),
1510 List.of(TypeConstraint.values()),
1511 List.of(InputParameter.values()),
1512 List.of(OutputParameter.values())
1513 );
1514
1515 public ArrayFeatureExtractor(ExternalizedOp def) {
1516 super(SCHEMA, def);
1517 }
1518
1519 ArrayFeatureExtractor(ArrayFeatureExtractor that, CodeContext cc) {
1520 super(that, cc);
1521 }
1522
1523 @Override
1524 public ArrayFeatureExtractor transform(CodeContext cc, CodeTransformer ot) {
1525 return new ArrayFeatureExtractor(this, cc);
1526 }
1527
1528 ArrayFeatureExtractor(CodeType resultType, Value X, Value Y) {
1529 super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of());
1530 }
1531
1532 @Override
1533 public SequencedSet<OnnxParameter> onnxOutputs() {
1534 return onnxOutputs(SCHEMA);
1535 }
1536
1537 @Override
1538 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1539 return onnxInputs(SCHEMA, List.of(X(), Y()));
1540 }
1541
1542 public Value X() {
1543 return operands().get(0);
1544 }
1545
1546 public Value Y() {
1547 return operands().get(1);
1548 }
1549
1550 }
1551
1552 public static ArrayFeatureExtractor ArrayFeatureExtractor(CodeType resultType, Value X, Value Y) {
1553 return new ArrayFeatureExtractor(resultType, X, Y);
1554 }
1555
1556 @OpFactoryHelper.OpDeclaration(Asin.NAME)
1557 public static final class Asin extends OnnxOp {
1558 public static final String NAME = "Asin";
1559
1560 public enum Attribute implements OnnxAttribute.None { }
1561
1562 public enum TypeConstraint implements OnnxTypeConstraint {
1563 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
1564 ;
1565
1566 final OnnxType.TypeVariable typeVariable;
1567
1568 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1569 assert typeVariable.name().equals(name());
1570 this.typeVariable = typeVariable;
1571 }
1572
1573 @Override
1574 public OnnxType.TypeVariable typeVariable() {
1575 return typeVariable;
1576 }
1577 }
1578
1579 public enum InputParameter implements OnnxParameter {
1580 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1581 ;
1582
1583 final OnnxType type;
1584 final Quantifier quantifier;
1585
1586 InputParameter(OnnxType type, Quantifier quantifier) {
1587 this.type = type;
1588 this.quantifier = quantifier;
1589 }
1590
1591 @Override
1592 public OnnxType type() {
1593 return type;
1594 }
1595
1596 @Override
1597 public Quantifier quantifier() {
1598 return quantifier;
1599 }
1600 }
1601
1602 public enum OutputParameter implements OnnxParameter {
1603 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1604 ;
1605
1606 final OnnxType type;
1607 final Quantifier quantifier;
1608
1609 OutputParameter(OnnxType type, Quantifier quantifier) {
1610 this.type = type;
1611 this.quantifier = quantifier;
1612 }
1613
1614 @Override
1615 public OnnxType type() {
1616 return type;
1617 }
1618
1619 @Override
1620 public Quantifier quantifier() {
1621 return quantifier;
1622 }
1623 }
1624
1625 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1626 NAME,
1627 List.of(Attribute.values()),
1628 List.of(TypeConstraint.values()),
1629 List.of(InputParameter.values()),
1630 List.of(OutputParameter.values())
1631 );
1632
1633 public Asin(ExternalizedOp def) {
1634 super(SCHEMA, def);
1635 }
1636
1637 Asin(Asin that, CodeContext cc) {
1638 super(that, cc);
1639 }
1640
1641 @Override
1642 public Asin transform(CodeContext cc, CodeTransformer ot) {
1643 return new Asin(this, cc);
1644 }
1645
1646 Asin(CodeType resultType, Value input) {
1647 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
1648 }
1649
1650 @Override
1651 public SequencedSet<OnnxParameter> onnxOutputs() {
1652 return onnxOutputs(SCHEMA);
1653 }
1654
1655 @Override
1656 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1657 return onnxInputs(SCHEMA, List.of(input()));
1658 }
1659
1660 public Value input() {
1661 return operands().get(0);
1662 }
1663
1664 }
1665
1666 public static Asin Asin(CodeType resultType, Value input) {
1667 return new Asin(resultType, input);
1668 }
1669
1670 @OpFactoryHelper.OpDeclaration(Asinh.NAME)
1671 public static final class Asinh extends OnnxOp {
1672 public static final String NAME = "Asinh";
1673
1674 public enum Attribute implements OnnxAttribute.None { }
1675
1676 public enum TypeConstraint implements OnnxTypeConstraint {
1677 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
1678 ;
1679
1680 final OnnxType.TypeVariable typeVariable;
1681
1682 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1683 assert typeVariable.name().equals(name());
1684 this.typeVariable = typeVariable;
1685 }
1686
1687 @Override
1688 public OnnxType.TypeVariable typeVariable() {
1689 return typeVariable;
1690 }
1691 }
1692
1693 public enum InputParameter implements OnnxParameter {
1694 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1695 ;
1696
1697 final OnnxType type;
1698 final Quantifier quantifier;
1699
1700 InputParameter(OnnxType type, Quantifier quantifier) {
1701 this.type = type;
1702 this.quantifier = quantifier;
1703 }
1704
1705 @Override
1706 public OnnxType type() {
1707 return type;
1708 }
1709
1710 @Override
1711 public Quantifier quantifier() {
1712 return quantifier;
1713 }
1714 }
1715
1716 public enum OutputParameter implements OnnxParameter {
1717 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1718 ;
1719
1720 final OnnxType type;
1721 final Quantifier quantifier;
1722
1723 OutputParameter(OnnxType type, Quantifier quantifier) {
1724 this.type = type;
1725 this.quantifier = quantifier;
1726 }
1727
1728 @Override
1729 public OnnxType type() {
1730 return type;
1731 }
1732
1733 @Override
1734 public Quantifier quantifier() {
1735 return quantifier;
1736 }
1737 }
1738
1739 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1740 NAME,
1741 List.of(Attribute.values()),
1742 List.of(TypeConstraint.values()),
1743 List.of(InputParameter.values()),
1744 List.of(OutputParameter.values())
1745 );
1746
1747 public Asinh(ExternalizedOp def) {
1748 super(SCHEMA, def);
1749 }
1750
1751 Asinh(Asinh that, CodeContext cc) {
1752 super(that, cc);
1753 }
1754
1755 @Override
1756 public Asinh transform(CodeContext cc, CodeTransformer ot) {
1757 return new Asinh(this, cc);
1758 }
1759
1760 Asinh(CodeType resultType, Value input) {
1761 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
1762 }
1763
1764 @Override
1765 public SequencedSet<OnnxParameter> onnxOutputs() {
1766 return onnxOutputs(SCHEMA);
1767 }
1768
1769 @Override
1770 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1771 return onnxInputs(SCHEMA, List.of(input()));
1772 }
1773
1774 public Value input() {
1775 return operands().get(0);
1776 }
1777
1778 }
1779
1780 public static Asinh Asinh(CodeType resultType, Value input) {
1781 return new Asinh(resultType, input);
1782 }
1783
1784 @OpFactoryHelper.OpDeclaration(Atan.NAME)
1785 public static final class Atan extends OnnxOp {
1786 public static final String NAME = "Atan";
1787
1788 public enum Attribute implements OnnxAttribute.None { }
1789
1790 public enum TypeConstraint implements OnnxTypeConstraint {
1791 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
1792 ;
1793
1794 final OnnxType.TypeVariable typeVariable;
1795
1796 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1797 assert typeVariable.name().equals(name());
1798 this.typeVariable = typeVariable;
1799 }
1800
1801 @Override
1802 public OnnxType.TypeVariable typeVariable() {
1803 return typeVariable;
1804 }
1805 }
1806
1807 public enum InputParameter implements OnnxParameter {
1808 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1809 ;
1810
1811 final OnnxType type;
1812 final Quantifier quantifier;
1813
1814 InputParameter(OnnxType type, Quantifier quantifier) {
1815 this.type = type;
1816 this.quantifier = quantifier;
1817 }
1818
1819 @Override
1820 public OnnxType type() {
1821 return type;
1822 }
1823
1824 @Override
1825 public Quantifier quantifier() {
1826 return quantifier;
1827 }
1828 }
1829
1830 public enum OutputParameter implements OnnxParameter {
1831 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1832 ;
1833
1834 final OnnxType type;
1835 final Quantifier quantifier;
1836
1837 OutputParameter(OnnxType type, Quantifier quantifier) {
1838 this.type = type;
1839 this.quantifier = quantifier;
1840 }
1841
1842 @Override
1843 public OnnxType type() {
1844 return type;
1845 }
1846
1847 @Override
1848 public Quantifier quantifier() {
1849 return quantifier;
1850 }
1851 }
1852
1853 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1854 NAME,
1855 List.of(Attribute.values()),
1856 List.of(TypeConstraint.values()),
1857 List.of(InputParameter.values()),
1858 List.of(OutputParameter.values())
1859 );
1860
1861 public Atan(ExternalizedOp def) {
1862 super(SCHEMA, def);
1863 }
1864
1865 Atan(Atan that, CodeContext cc) {
1866 super(that, cc);
1867 }
1868
1869 @Override
1870 public Atan transform(CodeContext cc, CodeTransformer ot) {
1871 return new Atan(this, cc);
1872 }
1873
1874 Atan(CodeType resultType, Value input) {
1875 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
1876 }
1877
1878 @Override
1879 public SequencedSet<OnnxParameter> onnxOutputs() {
1880 return onnxOutputs(SCHEMA);
1881 }
1882
1883 @Override
1884 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1885 return onnxInputs(SCHEMA, List.of(input()));
1886 }
1887
1888 public Value input() {
1889 return operands().get(0);
1890 }
1891
1892 }
1893
1894 public static Atan Atan(CodeType resultType, Value input) {
1895 return new Atan(resultType, input);
1896 }
1897
1898 @OpFactoryHelper.OpDeclaration(Atanh.NAME)
1899 public static final class Atanh extends OnnxOp {
1900 public static final String NAME = "Atanh";
1901
1902 public enum Attribute implements OnnxAttribute.None { }
1903
1904 public enum TypeConstraint implements OnnxTypeConstraint {
1905 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
1906 ;
1907
1908 final OnnxType.TypeVariable typeVariable;
1909
1910 TypeConstraint(OnnxType.TypeVariable typeVariable) {
1911 assert typeVariable.name().equals(name());
1912 this.typeVariable = typeVariable;
1913 }
1914
1915 @Override
1916 public OnnxType.TypeVariable typeVariable() {
1917 return typeVariable;
1918 }
1919 }
1920
1921 public enum InputParameter implements OnnxParameter {
1922 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1923 ;
1924
1925 final OnnxType type;
1926 final Quantifier quantifier;
1927
1928 InputParameter(OnnxType type, Quantifier quantifier) {
1929 this.type = type;
1930 this.quantifier = quantifier;
1931 }
1932
1933 @Override
1934 public OnnxType type() {
1935 return type;
1936 }
1937
1938 @Override
1939 public Quantifier quantifier() {
1940 return quantifier;
1941 }
1942 }
1943
1944 public enum OutputParameter implements OnnxParameter {
1945 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
1946 ;
1947
1948 final OnnxType type;
1949 final Quantifier quantifier;
1950
1951 OutputParameter(OnnxType type, Quantifier quantifier) {
1952 this.type = type;
1953 this.quantifier = quantifier;
1954 }
1955
1956 @Override
1957 public OnnxType type() {
1958 return type;
1959 }
1960
1961 @Override
1962 public Quantifier quantifier() {
1963 return quantifier;
1964 }
1965 }
1966
1967 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
1968 NAME,
1969 List.of(Attribute.values()),
1970 List.of(TypeConstraint.values()),
1971 List.of(InputParameter.values()),
1972 List.of(OutputParameter.values())
1973 );
1974
1975 public Atanh(ExternalizedOp def) {
1976 super(SCHEMA, def);
1977 }
1978
1979 Atanh(Atanh that, CodeContext cc) {
1980 super(that, cc);
1981 }
1982
1983 @Override
1984 public Atanh transform(CodeContext cc, CodeTransformer ot) {
1985 return new Atanh(this, cc);
1986 }
1987
1988 Atanh(CodeType resultType, Value input) {
1989 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
1990 }
1991
1992 @Override
1993 public SequencedSet<OnnxParameter> onnxOutputs() {
1994 return onnxOutputs(SCHEMA);
1995 }
1996
1997 @Override
1998 public SequencedMap<OnnxParameter, Object> onnxInputs() {
1999 return onnxInputs(SCHEMA, List.of(input()));
2000 }
2001
2002 public Value input() {
2003 return operands().get(0);
2004 }
2005
2006 }
2007
2008 public static Atanh Atanh(CodeType resultType, Value input) {
2009 return new Atanh(resultType, input);
2010 }
2011
2012 @OpFactoryHelper.OpDeclaration(Attention.NAME)
2013 public static final class Attention extends OnnxOp {
2014 public static final String NAME = "Attention";
2015
2016 public enum Attribute implements OnnxAttribute {
2017 qk_matmul_output_mode(Long.class, true, 0),
2018 softcap(Float.class, true, 0.0f),
2019 softmax_precision(Long.class, true, null),
2020 scale(Float.class, true, null),
2021 is_causal(Long.class, true, 0),
2022 q_num_heads(Long.class, true, null),
2023 kv_num_heads(Long.class, true, null),
2024 ;
2025
2026 final Class<?> t;
2027 final boolean optional;
2028 final Object defaultValue;
2029
2030 Attribute(Class<?> type, boolean optional, Object defaultValue) {
2031 this.t = type;
2032 this.optional = optional;
2033 this.defaultValue = defaultValue;
2034 assert optional || defaultValue == null;
2035 }
2036
2037 public Class<?> type() {
2038 return t;
2039 }
2040
2041 public boolean isOptional() {
2042 return optional;
2043 }
2044
2045 public Object defaultValue() {
2046 return defaultValue;
2047 }
2048 }
2049
2050 public enum TypeConstraint implements OnnxTypeConstraint {
2051 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
2052 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
2053 U(new OnnxType.TypeVariable("U", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))),
2054 ;
2055
2056 final OnnxType.TypeVariable typeVariable;
2057
2058 TypeConstraint(OnnxType.TypeVariable typeVariable) {
2059 assert typeVariable.name().equals(name());
2060 this.typeVariable = typeVariable;
2061 }
2062
2063 @Override
2064 public OnnxType.TypeVariable typeVariable() {
2065 return typeVariable;
2066 }
2067 }
2068
2069 public enum InputParameter implements OnnxParameter {
2070 Q(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2071 K(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2072 V(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
2073 attn_mask(TypeConstraint.U.typeVariable(), Quantifier.OPTIONAL),
2074 past_key(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
2075 past_value(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
2076 nonpad_kv_seqlen(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
2077 ;
2078
2079 final OnnxType type;
2080 final Quantifier quantifier;
2081
2082 InputParameter(OnnxType type, Quantifier quantifier) {
2083 this.type = type;
2084 this.quantifier = quantifier;
2085 }
2086
2087 @Override
2088 public OnnxType type() {
2089 return type;
2090 }
2091
2092 @Override
2093 public Quantifier quantifier() {
2094 return quantifier;
2095 }
2096 }
2097
2098 public enum OutputParameter implements OnnxParameter {
2099 Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2100 present_key(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
2101 present_value(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
2102 qk_matmul_output(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
2103 ;
2104
2105 final OnnxType type;
2106 final Quantifier quantifier;
2107
2108 OutputParameter(OnnxType type, Quantifier quantifier) {
2109 this.type = type;
2110 this.quantifier = quantifier;
2111 }
2112
2113 @Override
2114 public OnnxType type() {
2115 return type;
2116 }
2117
2118 @Override
2119 public Quantifier quantifier() {
2120 return quantifier;
2121 }
2122 }
2123
2124 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
2125 NAME,
2126 List.of(Attribute.values()),
2127 List.of(TypeConstraint.values()),
2128 List.of(InputParameter.values()),
2129 List.of(OutputParameter.values())
2130 );
2131
2132 public Attention(ExternalizedOp def) {
2133 super(SCHEMA, def);
2134 }
2135
2136 Attention(Attention that, CodeContext cc) {
2137 super(that, cc);
2138 }
2139
2140 @Override
2141 public Attention transform(CodeContext cc, CodeTransformer ot) {
2142 return new Attention(this, cc);
2143 }
2144
2145 Attention(CodeType resultType, Set<OutputParameter> optionalOutputs, Value Q, Value K, Value V, java.util.Optional<Value> attn_mask, java.util.Optional<Value> past_key, java.util.Optional<Value> past_value, java.util.Optional<Value> nonpad_kv_seqlen, java.util.Optional<Long> qk_matmul_output_mode, java.util.Optional<Float> softcap, java.util.Optional<Long> softmax_precision, java.util.Optional<Float> scale, java.util.Optional<Long> is_causal, java.util.Optional<Long> q_num_heads, java.util.Optional<Long> kv_num_heads) {
2146 super(SCHEMA, resultType, optionalOutputs, List.of(Q, K, V, attn_mask, past_key, past_value, nonpad_kv_seqlen), List.of(qk_matmul_output_mode, softcap, softmax_precision, scale, is_causal, q_num_heads, kv_num_heads));
2147 }
2148
2149 @Override
2150 public SequencedSet<OnnxParameter> onnxOutputs() {
2151 return onnxOutputs(SCHEMA);
2152 }
2153
2154 @Override
2155 public SequencedMap<OnnxParameter, Object> onnxInputs() {
2156 return onnxInputs(SCHEMA, List.of(Q(), K(), V(), attn_mask(), past_key(), past_value(), nonpad_kv_seqlen()));
2157 }
2158
2159 public Value Q() {
2160 return operands().get(0);
2161 }
2162
2163 public Value K() {
2164 return operands().get(1);
2165 }
2166
2167 public Value V() {
2168 return operands().get(2);
2169 }
2170
2171 public java.util.Optional<Value> attn_mask() {
2172 int i = optionalInputArguments.indexOf(InputParameter.attn_mask);
2173 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
2174 }
2175
2176 public java.util.Optional<Value> past_key() {
2177 int i = optionalInputArguments.indexOf(InputParameter.past_key);
2178 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
2179 }
2180
2181 public java.util.Optional<Value> past_value() {
2182 int i = optionalInputArguments.indexOf(InputParameter.past_value);
2183 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
2184 }
2185
2186 public java.util.Optional<Value> nonpad_kv_seqlen() {
2187 int i = optionalInputArguments.indexOf(InputParameter.nonpad_kv_seqlen);
2188 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
2189 }
2190
2191 public java.util.Optional<Long> qk_matmul_output_mode() {
2192 Long qk_matmul_output_mode = Attribute.qk_matmul_output_mode.access(Long.class, onnxAttributes);
2193 return java.util.Optional.ofNullable(qk_matmul_output_mode);
2194 }
2195
2196 public java.util.Optional<Float> softcap() {
2197 Float softcap = Attribute.softcap.access(Float.class, onnxAttributes);
2198 return java.util.Optional.ofNullable(softcap);
2199 }
2200
2201 public java.util.Optional<Long> softmax_precision() {
2202 Long softmax_precision = Attribute.softmax_precision.access(Long.class, onnxAttributes);
2203 return java.util.Optional.ofNullable(softmax_precision);
2204 }
2205
2206 public java.util.Optional<Float> scale() {
2207 Float scale = Attribute.scale.access(Float.class, onnxAttributes);
2208 return java.util.Optional.ofNullable(scale);
2209 }
2210
2211 public java.util.Optional<Long> is_causal() {
2212 Long is_causal = Attribute.is_causal.access(Long.class, onnxAttributes);
2213 return java.util.Optional.ofNullable(is_causal);
2214 }
2215
2216 public java.util.Optional<Long> q_num_heads() {
2217 Long q_num_heads = Attribute.q_num_heads.access(Long.class, onnxAttributes);
2218 return java.util.Optional.ofNullable(q_num_heads);
2219 }
2220
2221 public java.util.Optional<Long> kv_num_heads() {
2222 Long kv_num_heads = Attribute.kv_num_heads.access(Long.class, onnxAttributes);
2223 return java.util.Optional.ofNullable(kv_num_heads);
2224 }
2225
2226 }
2227
2228 public static Attention Attention(CodeType resultType, Set<Attention.OutputParameter> optionalOutputs, Value Q, Value K, Value V, java.util.Optional<Value> attn_mask, java.util.Optional<Value> past_key, java.util.Optional<Value> past_value, java.util.Optional<Value> nonpad_kv_seqlen, java.util.Optional<Long> qk_matmul_output_mode, java.util.Optional<Float> softcap, java.util.Optional<Long> softmax_precision, java.util.Optional<Float> scale, java.util.Optional<Long> is_causal, java.util.Optional<Long> q_num_heads, java.util.Optional<Long> kv_num_heads) {
2229 return new Attention(resultType, optionalOutputs, Q, K, V, attn_mask, past_key, past_value, nonpad_kv_seqlen, qk_matmul_output_mode, softcap, softmax_precision, scale, is_causal, q_num_heads, kv_num_heads);
2230 }
2231
2232 @OpFactoryHelper.OpDeclaration(AveragePool.NAME)
2233 public static final class AveragePool extends OnnxOp {
2234 public static final String NAME = "AveragePool";
2235
2236 public enum Attribute implements OnnxAttribute {
2237 pads(long[].class, true, null),
2238 dilations(long[].class, true, null),
2239 auto_pad(String.class, true, "NOTSET"),
2240 count_include_pad(Long.class, true, 0),
2241 ceil_mode(Long.class, true, 0),
2242 strides(long[].class, true, null),
2243 kernel_shape(long[].class, false, null),
2244 ;
2245
2246 final Class<?> t;
2247 final boolean optional;
2248 final Object defaultValue;
2249
2250 Attribute(Class<?> type, boolean optional, Object defaultValue) {
2251 this.t = type;
2252 this.optional = optional;
2253 this.defaultValue = defaultValue;
2254 assert optional || defaultValue == null;
2255 }
2256
2257 public Class<?> type() {
2258 return t;
2259 }
2260
2261 public boolean isOptional() {
2262 return optional;
2263 }
2264
2265 public Object defaultValue() {
2266 return defaultValue;
2267 }
2268 }
2269
2270 public enum TypeConstraint implements OnnxTypeConstraint {
2271 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
2272 ;
2273
2274 final OnnxType.TypeVariable typeVariable;
2275
2276 TypeConstraint(OnnxType.TypeVariable typeVariable) {
2277 assert typeVariable.name().equals(name());
2278 this.typeVariable = typeVariable;
2279 }
2280
2281 @Override
2282 public OnnxType.TypeVariable typeVariable() {
2283 return typeVariable;
2284 }
2285 }
2286
2287 public enum InputParameter implements OnnxParameter {
2288 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
2289 ;
2290
2291 final OnnxType type;
2292 final Quantifier quantifier;
2293
2294 InputParameter(OnnxType type, Quantifier quantifier) {
2295 this.type = type;
2296 this.quantifier = quantifier;
2297 }
2298
2299 @Override
2300 public OnnxType type() {
2301 return type;
2302 }
2303
2304 @Override
2305 public Quantifier quantifier() {
2306 return quantifier;
2307 }
2308 }
2309
2310 public enum OutputParameter implements OnnxParameter {
2311 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
2312 ;
2313
2314 final OnnxType type;
2315 final Quantifier quantifier;
2316
2317 OutputParameter(OnnxType type, Quantifier quantifier) {
2318 this.type = type;
2319 this.quantifier = quantifier;
2320 }
2321
2322 @Override
2323 public OnnxType type() {
2324 return type;
2325 }
2326
2327 @Override
2328 public Quantifier quantifier() {
2329 return quantifier;
2330 }
2331 }
2332
2333 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
2334 NAME,
2335 List.of(Attribute.values()),
2336 List.of(TypeConstraint.values()),
2337 List.of(InputParameter.values()),
2338 List.of(OutputParameter.values())
2339 );
2340
2341 public AveragePool(ExternalizedOp def) {
2342 super(SCHEMA, def);
2343 }
2344
2345 AveragePool(AveragePool that, CodeContext cc) {
2346 super(that, cc);
2347 }
2348
2349 @Override
2350 public AveragePool transform(CodeContext cc, CodeTransformer ot) {
2351 return new AveragePool(this, cc);
2352 }
2353
2354 AveragePool(CodeType resultType, Value X, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<Long> count_include_pad, java.util.Optional<Long> ceil_mode, java.util.Optional<long[]> strides, long[] kernel_shape) {
2355 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape));
2356 }
2357
2358 @Override
2359 public SequencedSet<OnnxParameter> onnxOutputs() {
2360 return onnxOutputs(SCHEMA);
2361 }
2362
2363 @Override
2364 public SequencedMap<OnnxParameter, Object> onnxInputs() {
2365 return onnxInputs(SCHEMA, List.of(X()));
2366 }
2367
2368 public Value X() {
2369 return operands().get(0);
2370 }
2371
2372 public java.util.Optional<long[]> pads() {
2373 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
2374 return java.util.Optional.ofNullable(pads).map(long[]::clone);
2375 }
2376
2377 public java.util.Optional<long[]> dilations() {
2378 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
2379 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
2380 }
2381
2382 public java.util.Optional<String> auto_pad() {
2383 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
2384 return java.util.Optional.ofNullable(auto_pad);
2385 }
2386
2387 public java.util.Optional<Long> count_include_pad() {
2388 Long count_include_pad = Attribute.count_include_pad.access(Long.class, onnxAttributes);
2389 return java.util.Optional.ofNullable(count_include_pad);
2390 }
2391
2392 public java.util.Optional<Long> ceil_mode() {
2393 Long ceil_mode = Attribute.ceil_mode.access(Long.class, onnxAttributes);
2394 return java.util.Optional.ofNullable(ceil_mode);
2395 }
2396
2397 public java.util.Optional<long[]> strides() {
2398 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
2399 return java.util.Optional.ofNullable(strides).map(long[]::clone);
2400 }
2401
2402 public long[] kernel_shape() {
2403 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
2404 return kernel_shape.clone();
2405 }
2406
2407 }
2408
2409 public static AveragePool AveragePool(CodeType resultType, Value X, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<Long> count_include_pad, java.util.Optional<Long> ceil_mode, java.util.Optional<long[]> strides, long[] kernel_shape) {
2410 return new AveragePool(resultType, X, pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape);
2411 }
2412
2413 @OpFactoryHelper.OpDeclaration(BatchNormalization.NAME)
2414 public static final class BatchNormalization extends OnnxOp {
2415 public static final String NAME = "BatchNormalization";
2416
2417 public enum Attribute implements OnnxAttribute {
2418 epsilon(Float.class, true, 1.0E-5f),
2419 training_mode(Long.class, true, 0),
2420 momentum(Float.class, true, 0.9f),
2421 ;
2422
2423 final Class<?> t;
2424 final boolean optional;
2425 final Object defaultValue;
2426
2427 Attribute(Class<?> type, boolean optional, Object defaultValue) {
2428 this.t = type;
2429 this.optional = optional;
2430 this.defaultValue = defaultValue;
2431 assert optional || defaultValue == null;
2432 }
2433
2434 public Class<?> type() {
2435 return t;
2436 }
2437
2438 public boolean isOptional() {
2439 return optional;
2440 }
2441
2442 public Object defaultValue() {
2443 return defaultValue;
2444 }
2445 }
2446
2447 public enum TypeConstraint implements OnnxTypeConstraint {
2448 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
2449 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
2450 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
2451 ;
2452
2453 final OnnxType.TypeVariable typeVariable;
2454
2455 TypeConstraint(OnnxType.TypeVariable typeVariable) {
2456 assert typeVariable.name().equals(name());
2457 this.typeVariable = typeVariable;
2458 }
2459
2460 @Override
2461 public OnnxType.TypeVariable typeVariable() {
2462 return typeVariable;
2463 }
2464 }
2465
2466 public enum InputParameter implements OnnxParameter {
2467 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
2468 scale(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2469 B(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2470 input_mean(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
2471 input_var(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
2472 ;
2473
2474 final OnnxType type;
2475 final Quantifier quantifier;
2476
2477 InputParameter(OnnxType type, Quantifier quantifier) {
2478 this.type = type;
2479 this.quantifier = quantifier;
2480 }
2481
2482 @Override
2483 public OnnxType type() {
2484 return type;
2485 }
2486
2487 @Override
2488 public Quantifier quantifier() {
2489 return quantifier;
2490 }
2491 }
2492
2493 public enum OutputParameter implements OnnxParameter {
2494 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
2495 running_mean(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
2496 running_var(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
2497 ;
2498
2499 final OnnxType type;
2500 final Quantifier quantifier;
2501
2502 OutputParameter(OnnxType type, Quantifier quantifier) {
2503 this.type = type;
2504 this.quantifier = quantifier;
2505 }
2506
2507 @Override
2508 public OnnxType type() {
2509 return type;
2510 }
2511
2512 @Override
2513 public Quantifier quantifier() {
2514 return quantifier;
2515 }
2516 }
2517
2518 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
2519 NAME,
2520 List.of(Attribute.values()),
2521 List.of(TypeConstraint.values()),
2522 List.of(InputParameter.values()),
2523 List.of(OutputParameter.values())
2524 );
2525
2526 public BatchNormalization(ExternalizedOp def) {
2527 super(SCHEMA, def);
2528 }
2529
2530 BatchNormalization(BatchNormalization that, CodeContext cc) {
2531 super(that, cc);
2532 }
2533
2534 @Override
2535 public BatchNormalization transform(CodeContext cc, CodeTransformer ot) {
2536 return new BatchNormalization(this, cc);
2537 }
2538
2539 BatchNormalization(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, Value scale, Value B, Value input_mean, Value input_var, java.util.Optional<Float> epsilon, java.util.Optional<Long> training_mode, java.util.Optional<Float> momentum) {
2540 super(SCHEMA, resultType, optionalOutputs, List.of(X, scale, B, input_mean, input_var), List.of(epsilon, training_mode, momentum));
2541 }
2542
2543 @Override
2544 public SequencedSet<OnnxParameter> onnxOutputs() {
2545 return onnxOutputs(SCHEMA);
2546 }
2547
2548 @Override
2549 public SequencedMap<OnnxParameter, Object> onnxInputs() {
2550 return onnxInputs(SCHEMA, List.of(X(), scale(), B(), input_mean(), input_var()));
2551 }
2552
2553 public Value X() {
2554 return operands().get(0);
2555 }
2556
2557 public Value scale() {
2558 return operands().get(1);
2559 }
2560
2561 public Value B() {
2562 return operands().get(2);
2563 }
2564
2565 public Value input_mean() {
2566 return operands().get(3);
2567 }
2568
2569 public Value input_var() {
2570 return operands().get(4);
2571 }
2572
2573 public java.util.Optional<Float> epsilon() {
2574 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
2575 return java.util.Optional.ofNullable(epsilon);
2576 }
2577
2578 public java.util.Optional<Long> training_mode() {
2579 Long training_mode = Attribute.training_mode.access(Long.class, onnxAttributes);
2580 return java.util.Optional.ofNullable(training_mode);
2581 }
2582
2583 public java.util.Optional<Float> momentum() {
2584 Float momentum = Attribute.momentum.access(Float.class, onnxAttributes);
2585 return java.util.Optional.ofNullable(momentum);
2586 }
2587
2588 }
2589
2590 public static BatchNormalization BatchNormalization(CodeType resultType, Set<BatchNormalization.OutputParameter> optionalOutputs, Value X, Value scale, Value B, Value input_mean, Value input_var, java.util.Optional<Float> epsilon, java.util.Optional<Long> training_mode, java.util.Optional<Float> momentum) {
2591 return new BatchNormalization(resultType, optionalOutputs, X, scale, B, input_mean, input_var, epsilon, training_mode, momentum);
2592 }
2593
2594 @OpFactoryHelper.OpDeclaration(Bernoulli.NAME)
2595 public static final class Bernoulli extends OnnxOp {
2596 public static final String NAME = "Bernoulli";
2597
2598 public enum Attribute implements OnnxAttribute {
2599 seed(Float.class, true, null),
2600 dtype(Long.class, true, null),
2601 ;
2602
2603 final Class<?> t;
2604 final boolean optional;
2605 final Object defaultValue;
2606
2607 Attribute(Class<?> type, boolean optional, Object defaultValue) {
2608 this.t = type;
2609 this.optional = optional;
2610 this.defaultValue = defaultValue;
2611 assert optional || defaultValue == null;
2612 }
2613
2614 public Class<?> type() {
2615 return t;
2616 }
2617
2618 public boolean isOptional() {
2619 return optional;
2620 }
2621
2622 public Object defaultValue() {
2623 return defaultValue;
2624 }
2625 }
2626
2627 public enum TypeConstraint implements OnnxTypeConstraint {
2628 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
2629 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))),
2630 ;
2631
2632 final OnnxType.TypeVariable typeVariable;
2633
2634 TypeConstraint(OnnxType.TypeVariable typeVariable) {
2635 assert typeVariable.name().equals(name());
2636 this.typeVariable = typeVariable;
2637 }
2638
2639 @Override
2640 public OnnxType.TypeVariable typeVariable() {
2641 return typeVariable;
2642 }
2643 }
2644
2645 public enum InputParameter implements OnnxParameter {
2646 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2647 ;
2648
2649 final OnnxType type;
2650 final Quantifier quantifier;
2651
2652 InputParameter(OnnxType type, Quantifier quantifier) {
2653 this.type = type;
2654 this.quantifier = quantifier;
2655 }
2656
2657 @Override
2658 public OnnxType type() {
2659 return type;
2660 }
2661
2662 @Override
2663 public Quantifier quantifier() {
2664 return quantifier;
2665 }
2666 }
2667
2668 public enum OutputParameter implements OnnxParameter {
2669 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
2670 ;
2671
2672 final OnnxType type;
2673 final Quantifier quantifier;
2674
2675 OutputParameter(OnnxType type, Quantifier quantifier) {
2676 this.type = type;
2677 this.quantifier = quantifier;
2678 }
2679
2680 @Override
2681 public OnnxType type() {
2682 return type;
2683 }
2684
2685 @Override
2686 public Quantifier quantifier() {
2687 return quantifier;
2688 }
2689 }
2690
2691 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
2692 NAME,
2693 List.of(Attribute.values()),
2694 List.of(TypeConstraint.values()),
2695 List.of(InputParameter.values()),
2696 List.of(OutputParameter.values())
2697 );
2698
2699 public Bernoulli(ExternalizedOp def) {
2700 super(SCHEMA, def);
2701 }
2702
2703 Bernoulli(Bernoulli that, CodeContext cc) {
2704 super(that, cc);
2705 }
2706
2707 @Override
2708 public Bernoulli transform(CodeContext cc, CodeTransformer ot) {
2709 return new Bernoulli(this, cc);
2710 }
2711
2712 Bernoulli(CodeType resultType, Value input, java.util.Optional<Float> seed, java.util.Optional<Long> dtype) {
2713 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(seed, dtype));
2714 }
2715
2716 @Override
2717 public SequencedSet<OnnxParameter> onnxOutputs() {
2718 return onnxOutputs(SCHEMA);
2719 }
2720
2721 @Override
2722 public SequencedMap<OnnxParameter, Object> onnxInputs() {
2723 return onnxInputs(SCHEMA, List.of(input()));
2724 }
2725
2726 public Value input() {
2727 return operands().get(0);
2728 }
2729
2730 public java.util.Optional<Float> seed() {
2731 Float seed = Attribute.seed.access(Float.class, onnxAttributes);
2732 return java.util.Optional.ofNullable(seed);
2733 }
2734
2735 public java.util.Optional<Long> dtype() {
2736 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
2737 return java.util.Optional.ofNullable(dtype);
2738 }
2739
2740 }
2741
2742 public static Bernoulli Bernoulli(CodeType resultType, Value input, java.util.Optional<Float> seed, java.util.Optional<Long> dtype) {
2743 return new Bernoulli(resultType, input, seed, dtype);
2744 }
2745
2746 @OpFactoryHelper.OpDeclaration(Binarizer.NAME)
2747 public static final class Binarizer extends OnnxOp {
2748 public static final String NAME = "Binarizer";
2749
2750 public enum Attribute implements OnnxAttribute {
2751 threshold(Float.class, true, 0.0f),
2752 ;
2753
2754 final Class<?> t;
2755 final boolean optional;
2756 final Object defaultValue;
2757
2758 Attribute(Class<?> type, boolean optional, Object defaultValue) {
2759 this.t = type;
2760 this.optional = optional;
2761 this.defaultValue = defaultValue;
2762 assert optional || defaultValue == null;
2763 }
2764
2765 public Class<?> type() {
2766 return t;
2767 }
2768
2769 public boolean isOptional() {
2770 return optional;
2771 }
2772
2773 public Object defaultValue() {
2774 return defaultValue;
2775 }
2776 }
2777
2778 public enum TypeConstraint implements OnnxTypeConstraint {
2779 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
2780 ;
2781
2782 final OnnxType.TypeVariable typeVariable;
2783
2784 TypeConstraint(OnnxType.TypeVariable typeVariable) {
2785 assert typeVariable.name().equals(name());
2786 this.typeVariable = typeVariable;
2787 }
2788
2789 @Override
2790 public OnnxType.TypeVariable typeVariable() {
2791 return typeVariable;
2792 }
2793 }
2794
2795 public enum InputParameter implements OnnxParameter {
2796 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
2797 ;
2798
2799 final OnnxType type;
2800 final Quantifier quantifier;
2801
2802 InputParameter(OnnxType type, Quantifier quantifier) {
2803 this.type = type;
2804 this.quantifier = quantifier;
2805 }
2806
2807 @Override
2808 public OnnxType type() {
2809 return type;
2810 }
2811
2812 @Override
2813 public Quantifier quantifier() {
2814 return quantifier;
2815 }
2816 }
2817
2818 public enum OutputParameter implements OnnxParameter {
2819 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
2820 ;
2821
2822 final OnnxType type;
2823 final Quantifier quantifier;
2824
2825 OutputParameter(OnnxType type, Quantifier quantifier) {
2826 this.type = type;
2827 this.quantifier = quantifier;
2828 }
2829
2830 @Override
2831 public OnnxType type() {
2832 return type;
2833 }
2834
2835 @Override
2836 public Quantifier quantifier() {
2837 return quantifier;
2838 }
2839 }
2840
2841 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
2842 NAME,
2843 List.of(Attribute.values()),
2844 List.of(TypeConstraint.values()),
2845 List.of(InputParameter.values()),
2846 List.of(OutputParameter.values())
2847 );
2848
2849 public Binarizer(ExternalizedOp def) {
2850 super(SCHEMA, def);
2851 }
2852
2853 Binarizer(Binarizer that, CodeContext cc) {
2854 super(that, cc);
2855 }
2856
2857 @Override
2858 public Binarizer transform(CodeContext cc, CodeTransformer ot) {
2859 return new Binarizer(this, cc);
2860 }
2861
2862 Binarizer(CodeType resultType, Value X, java.util.Optional<Float> threshold) {
2863 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(threshold));
2864 }
2865
2866 @Override
2867 public SequencedSet<OnnxParameter> onnxOutputs() {
2868 return onnxOutputs(SCHEMA);
2869 }
2870
2871 @Override
2872 public SequencedMap<OnnxParameter, Object> onnxInputs() {
2873 return onnxInputs(SCHEMA, List.of(X()));
2874 }
2875
2876 public Value X() {
2877 return operands().get(0);
2878 }
2879
2880 public java.util.Optional<Float> threshold() {
2881 Float threshold = Attribute.threshold.access(Float.class, onnxAttributes);
2882 return java.util.Optional.ofNullable(threshold);
2883 }
2884
2885 }
2886
2887 public static Binarizer Binarizer(CodeType resultType, Value X, java.util.Optional<Float> threshold) {
2888 return new Binarizer(resultType, X, threshold);
2889 }
2890
2891 @OpFactoryHelper.OpDeclaration(BitCast.NAME)
2892 public static final class BitCast extends OnnxOp {
2893 public static final String NAME = "BitCast";
2894
2895 public enum Attribute implements OnnxAttribute {
2896 to(Long.class, false, null),
2897 ;
2898
2899 final Class<?> t;
2900 final boolean optional;
2901 final Object defaultValue;
2902
2903 Attribute(Class<?> type, boolean optional, Object defaultValue) {
2904 this.t = type;
2905 this.optional = optional;
2906 this.defaultValue = defaultValue;
2907 assert optional || defaultValue == null;
2908 }
2909
2910 public Class<?> type() {
2911 return t;
2912 }
2913
2914 public boolean isOptional() {
2915 return optional;
2916 }
2917
2918 public Object defaultValue() {
2919 return defaultValue;
2920 }
2921 }
2922
2923 public enum TypeConstraint implements OnnxTypeConstraint {
2924 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
2925 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
2926 ;
2927
2928 final OnnxType.TypeVariable typeVariable;
2929
2930 TypeConstraint(OnnxType.TypeVariable typeVariable) {
2931 assert typeVariable.name().equals(name());
2932 this.typeVariable = typeVariable;
2933 }
2934
2935 @Override
2936 public OnnxType.TypeVariable typeVariable() {
2937 return typeVariable;
2938 }
2939 }
2940
2941 public enum InputParameter implements OnnxParameter {
2942 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
2943 ;
2944
2945 final OnnxType type;
2946 final Quantifier quantifier;
2947
2948 InputParameter(OnnxType type, Quantifier quantifier) {
2949 this.type = type;
2950 this.quantifier = quantifier;
2951 }
2952
2953 @Override
2954 public OnnxType type() {
2955 return type;
2956 }
2957
2958 @Override
2959 public Quantifier quantifier() {
2960 return quantifier;
2961 }
2962 }
2963
2964 public enum OutputParameter implements OnnxParameter {
2965 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
2966 ;
2967
2968 final OnnxType type;
2969 final Quantifier quantifier;
2970
2971 OutputParameter(OnnxType type, Quantifier quantifier) {
2972 this.type = type;
2973 this.quantifier = quantifier;
2974 }
2975
2976 @Override
2977 public OnnxType type() {
2978 return type;
2979 }
2980
2981 @Override
2982 public Quantifier quantifier() {
2983 return quantifier;
2984 }
2985 }
2986
2987 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
2988 NAME,
2989 List.of(Attribute.values()),
2990 List.of(TypeConstraint.values()),
2991 List.of(InputParameter.values()),
2992 List.of(OutputParameter.values())
2993 );
2994
2995 public BitCast(ExternalizedOp def) {
2996 super(SCHEMA, def);
2997 }
2998
2999 BitCast(BitCast that, CodeContext cc) {
3000 super(that, cc);
3001 }
3002
3003 @Override
3004 public BitCast transform(CodeContext cc, CodeTransformer ot) {
3005 return new BitCast(this, cc);
3006 }
3007
3008 BitCast(CodeType resultType, Value input, long to) {
3009 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(to));
3010 }
3011
3012 @Override
3013 public SequencedSet<OnnxParameter> onnxOutputs() {
3014 return onnxOutputs(SCHEMA);
3015 }
3016
3017 @Override
3018 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3019 return onnxInputs(SCHEMA, List.of(input()));
3020 }
3021
3022 public Value input() {
3023 return operands().get(0);
3024 }
3025
3026 public long to() {
3027 long to = Attribute.to.access(Long.class, onnxAttributes);
3028 return to;
3029 }
3030
3031 }
3032
3033 public static BitCast BitCast(CodeType resultType, Value input, long to) {
3034 return new BitCast(resultType, input, to);
3035 }
3036
3037 @OpFactoryHelper.OpDeclaration(BitShift.NAME)
3038 public static final class BitShift extends OnnxOp {
3039 public static final String NAME = "BitShift";
3040
3041 public enum Attribute implements OnnxAttribute {
3042 direction(String.class, false, null),
3043 ;
3044
3045 final Class<?> t;
3046 final boolean optional;
3047 final Object defaultValue;
3048
3049 Attribute(Class<?> type, boolean optional, Object defaultValue) {
3050 this.t = type;
3051 this.optional = optional;
3052 this.defaultValue = defaultValue;
3053 assert optional || defaultValue == null;
3054 }
3055
3056 public Class<?> type() {
3057 return t;
3058 }
3059
3060 public boolean isOptional() {
3061 return optional;
3062 }
3063
3064 public Object defaultValue() {
3065 return defaultValue;
3066 }
3067 }
3068
3069 public enum TypeConstraint implements OnnxTypeConstraint {
3070 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64())))),
3071 ;
3072
3073 final OnnxType.TypeVariable typeVariable;
3074
3075 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3076 assert typeVariable.name().equals(name());
3077 this.typeVariable = typeVariable;
3078 }
3079
3080 @Override
3081 public OnnxType.TypeVariable typeVariable() {
3082 return typeVariable;
3083 }
3084 }
3085
3086 public enum InputParameter implements OnnxParameter {
3087 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3088 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3089 ;
3090
3091 final OnnxType type;
3092 final Quantifier quantifier;
3093
3094 InputParameter(OnnxType type, Quantifier quantifier) {
3095 this.type = type;
3096 this.quantifier = quantifier;
3097 }
3098
3099 @Override
3100 public OnnxType type() {
3101 return type;
3102 }
3103
3104 @Override
3105 public Quantifier quantifier() {
3106 return quantifier;
3107 }
3108 }
3109
3110 public enum OutputParameter implements OnnxParameter {
3111 Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3112 ;
3113
3114 final OnnxType type;
3115 final Quantifier quantifier;
3116
3117 OutputParameter(OnnxType type, Quantifier quantifier) {
3118 this.type = type;
3119 this.quantifier = quantifier;
3120 }
3121
3122 @Override
3123 public OnnxType type() {
3124 return type;
3125 }
3126
3127 @Override
3128 public Quantifier quantifier() {
3129 return quantifier;
3130 }
3131 }
3132
3133 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3134 NAME,
3135 List.of(Attribute.values()),
3136 List.of(TypeConstraint.values()),
3137 List.of(InputParameter.values()),
3138 List.of(OutputParameter.values())
3139 );
3140
3141 public BitShift(ExternalizedOp def) {
3142 super(SCHEMA, def);
3143 }
3144
3145 BitShift(BitShift that, CodeContext cc) {
3146 super(that, cc);
3147 }
3148
3149 @Override
3150 public BitShift transform(CodeContext cc, CodeTransformer ot) {
3151 return new BitShift(this, cc);
3152 }
3153
3154 BitShift(CodeType resultType, Value X, Value Y, String direction) {
3155 super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of(direction));
3156 }
3157
3158 @Override
3159 public SequencedSet<OnnxParameter> onnxOutputs() {
3160 return onnxOutputs(SCHEMA);
3161 }
3162
3163 @Override
3164 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3165 return onnxInputs(SCHEMA, List.of(X(), Y()));
3166 }
3167
3168 public Value X() {
3169 return operands().get(0);
3170 }
3171
3172 public Value Y() {
3173 return operands().get(1);
3174 }
3175
3176 public String direction() {
3177 String direction = Attribute.direction.access(String.class, onnxAttributes);
3178 return direction;
3179 }
3180
3181 }
3182
3183 public static BitShift BitShift(CodeType resultType, Value X, Value Y, String direction) {
3184 return new BitShift(resultType, X, Y, direction);
3185 }
3186
3187 @OpFactoryHelper.OpDeclaration(BitwiseAnd.NAME)
3188 public static final class BitwiseAnd extends OnnxOp {
3189 public static final String NAME = "BitwiseAnd";
3190
3191 public enum Attribute implements OnnxAttribute.None { }
3192
3193 public enum TypeConstraint implements OnnxTypeConstraint {
3194 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
3195 ;
3196
3197 final OnnxType.TypeVariable typeVariable;
3198
3199 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3200 assert typeVariable.name().equals(name());
3201 this.typeVariable = typeVariable;
3202 }
3203
3204 @Override
3205 public OnnxType.TypeVariable typeVariable() {
3206 return typeVariable;
3207 }
3208 }
3209
3210 public enum InputParameter implements OnnxParameter {
3211 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3212 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3213 ;
3214
3215 final OnnxType type;
3216 final Quantifier quantifier;
3217
3218 InputParameter(OnnxType type, Quantifier quantifier) {
3219 this.type = type;
3220 this.quantifier = quantifier;
3221 }
3222
3223 @Override
3224 public OnnxType type() {
3225 return type;
3226 }
3227
3228 @Override
3229 public Quantifier quantifier() {
3230 return quantifier;
3231 }
3232 }
3233
3234 public enum OutputParameter implements OnnxParameter {
3235 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3236 ;
3237
3238 final OnnxType type;
3239 final Quantifier quantifier;
3240
3241 OutputParameter(OnnxType type, Quantifier quantifier) {
3242 this.type = type;
3243 this.quantifier = quantifier;
3244 }
3245
3246 @Override
3247 public OnnxType type() {
3248 return type;
3249 }
3250
3251 @Override
3252 public Quantifier quantifier() {
3253 return quantifier;
3254 }
3255 }
3256
3257 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3258 NAME,
3259 List.of(Attribute.values()),
3260 List.of(TypeConstraint.values()),
3261 List.of(InputParameter.values()),
3262 List.of(OutputParameter.values())
3263 );
3264
3265 public BitwiseAnd(ExternalizedOp def) {
3266 super(SCHEMA, def);
3267 }
3268
3269 BitwiseAnd(BitwiseAnd that, CodeContext cc) {
3270 super(that, cc);
3271 }
3272
3273 @Override
3274 public BitwiseAnd transform(CodeContext cc, CodeTransformer ot) {
3275 return new BitwiseAnd(this, cc);
3276 }
3277
3278 BitwiseAnd(CodeType resultType, Value A, Value B) {
3279 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
3280 }
3281
3282 @Override
3283 public SequencedSet<OnnxParameter> onnxOutputs() {
3284 return onnxOutputs(SCHEMA);
3285 }
3286
3287 @Override
3288 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3289 return onnxInputs(SCHEMA, List.of(A(), B()));
3290 }
3291
3292 public Value A() {
3293 return operands().get(0);
3294 }
3295
3296 public Value B() {
3297 return operands().get(1);
3298 }
3299
3300 }
3301
3302 public static BitwiseAnd BitwiseAnd(CodeType resultType, Value A, Value B) {
3303 return new BitwiseAnd(resultType, A, B);
3304 }
3305
3306 @OpFactoryHelper.OpDeclaration(BitwiseNot.NAME)
3307 public static final class BitwiseNot extends OnnxOp {
3308 public static final String NAME = "BitwiseNot";
3309
3310 public enum Attribute implements OnnxAttribute.None { }
3311
3312 public enum TypeConstraint implements OnnxTypeConstraint {
3313 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
3314 ;
3315
3316 final OnnxType.TypeVariable typeVariable;
3317
3318 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3319 assert typeVariable.name().equals(name());
3320 this.typeVariable = typeVariable;
3321 }
3322
3323 @Override
3324 public OnnxType.TypeVariable typeVariable() {
3325 return typeVariable;
3326 }
3327 }
3328
3329 public enum InputParameter implements OnnxParameter {
3330 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3331 ;
3332
3333 final OnnxType type;
3334 final Quantifier quantifier;
3335
3336 InputParameter(OnnxType type, Quantifier quantifier) {
3337 this.type = type;
3338 this.quantifier = quantifier;
3339 }
3340
3341 @Override
3342 public OnnxType type() {
3343 return type;
3344 }
3345
3346 @Override
3347 public Quantifier quantifier() {
3348 return quantifier;
3349 }
3350 }
3351
3352 public enum OutputParameter implements OnnxParameter {
3353 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3354 ;
3355
3356 final OnnxType type;
3357 final Quantifier quantifier;
3358
3359 OutputParameter(OnnxType type, Quantifier quantifier) {
3360 this.type = type;
3361 this.quantifier = quantifier;
3362 }
3363
3364 @Override
3365 public OnnxType type() {
3366 return type;
3367 }
3368
3369 @Override
3370 public Quantifier quantifier() {
3371 return quantifier;
3372 }
3373 }
3374
3375 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3376 NAME,
3377 List.of(Attribute.values()),
3378 List.of(TypeConstraint.values()),
3379 List.of(InputParameter.values()),
3380 List.of(OutputParameter.values())
3381 );
3382
3383 public BitwiseNot(ExternalizedOp def) {
3384 super(SCHEMA, def);
3385 }
3386
3387 BitwiseNot(BitwiseNot that, CodeContext cc) {
3388 super(that, cc);
3389 }
3390
3391 @Override
3392 public BitwiseNot transform(CodeContext cc, CodeTransformer ot) {
3393 return new BitwiseNot(this, cc);
3394 }
3395
3396 BitwiseNot(CodeType resultType, Value X) {
3397 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
3398 }
3399
3400 @Override
3401 public SequencedSet<OnnxParameter> onnxOutputs() {
3402 return onnxOutputs(SCHEMA);
3403 }
3404
3405 @Override
3406 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3407 return onnxInputs(SCHEMA, List.of(X()));
3408 }
3409
3410 public Value X() {
3411 return operands().get(0);
3412 }
3413
3414 }
3415
3416 public static BitwiseNot BitwiseNot(CodeType resultType, Value X) {
3417 return new BitwiseNot(resultType, X);
3418 }
3419
3420 @OpFactoryHelper.OpDeclaration(BitwiseOr.NAME)
3421 public static final class BitwiseOr extends OnnxOp {
3422 public static final String NAME = "BitwiseOr";
3423
3424 public enum Attribute implements OnnxAttribute.None { }
3425
3426 public enum TypeConstraint implements OnnxTypeConstraint {
3427 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
3428 ;
3429
3430 final OnnxType.TypeVariable typeVariable;
3431
3432 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3433 assert typeVariable.name().equals(name());
3434 this.typeVariable = typeVariable;
3435 }
3436
3437 @Override
3438 public OnnxType.TypeVariable typeVariable() {
3439 return typeVariable;
3440 }
3441 }
3442
3443 public enum InputParameter implements OnnxParameter {
3444 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3445 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3446 ;
3447
3448 final OnnxType type;
3449 final Quantifier quantifier;
3450
3451 InputParameter(OnnxType type, Quantifier quantifier) {
3452 this.type = type;
3453 this.quantifier = quantifier;
3454 }
3455
3456 @Override
3457 public OnnxType type() {
3458 return type;
3459 }
3460
3461 @Override
3462 public Quantifier quantifier() {
3463 return quantifier;
3464 }
3465 }
3466
3467 public enum OutputParameter implements OnnxParameter {
3468 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3469 ;
3470
3471 final OnnxType type;
3472 final Quantifier quantifier;
3473
3474 OutputParameter(OnnxType type, Quantifier quantifier) {
3475 this.type = type;
3476 this.quantifier = quantifier;
3477 }
3478
3479 @Override
3480 public OnnxType type() {
3481 return type;
3482 }
3483
3484 @Override
3485 public Quantifier quantifier() {
3486 return quantifier;
3487 }
3488 }
3489
3490 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3491 NAME,
3492 List.of(Attribute.values()),
3493 List.of(TypeConstraint.values()),
3494 List.of(InputParameter.values()),
3495 List.of(OutputParameter.values())
3496 );
3497
3498 public BitwiseOr(ExternalizedOp def) {
3499 super(SCHEMA, def);
3500 }
3501
3502 BitwiseOr(BitwiseOr that, CodeContext cc) {
3503 super(that, cc);
3504 }
3505
3506 @Override
3507 public BitwiseOr transform(CodeContext cc, CodeTransformer ot) {
3508 return new BitwiseOr(this, cc);
3509 }
3510
3511 BitwiseOr(CodeType resultType, Value A, Value B) {
3512 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
3513 }
3514
3515 @Override
3516 public SequencedSet<OnnxParameter> onnxOutputs() {
3517 return onnxOutputs(SCHEMA);
3518 }
3519
3520 @Override
3521 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3522 return onnxInputs(SCHEMA, List.of(A(), B()));
3523 }
3524
3525 public Value A() {
3526 return operands().get(0);
3527 }
3528
3529 public Value B() {
3530 return operands().get(1);
3531 }
3532
3533 }
3534
3535 public static BitwiseOr BitwiseOr(CodeType resultType, Value A, Value B) {
3536 return new BitwiseOr(resultType, A, B);
3537 }
3538
3539 @OpFactoryHelper.OpDeclaration(BitwiseXor.NAME)
3540 public static final class BitwiseXor extends OnnxOp {
3541 public static final String NAME = "BitwiseXor";
3542
3543 public enum Attribute implements OnnxAttribute.None { }
3544
3545 public enum TypeConstraint implements OnnxTypeConstraint {
3546 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
3547 ;
3548
3549 final OnnxType.TypeVariable typeVariable;
3550
3551 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3552 assert typeVariable.name().equals(name());
3553 this.typeVariable = typeVariable;
3554 }
3555
3556 @Override
3557 public OnnxType.TypeVariable typeVariable() {
3558 return typeVariable;
3559 }
3560 }
3561
3562 public enum InputParameter implements OnnxParameter {
3563 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3564 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3565 ;
3566
3567 final OnnxType type;
3568 final Quantifier quantifier;
3569
3570 InputParameter(OnnxType type, Quantifier quantifier) {
3571 this.type = type;
3572 this.quantifier = quantifier;
3573 }
3574
3575 @Override
3576 public OnnxType type() {
3577 return type;
3578 }
3579
3580 @Override
3581 public Quantifier quantifier() {
3582 return quantifier;
3583 }
3584 }
3585
3586 public enum OutputParameter implements OnnxParameter {
3587 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
3588 ;
3589
3590 final OnnxType type;
3591 final Quantifier quantifier;
3592
3593 OutputParameter(OnnxType type, Quantifier quantifier) {
3594 this.type = type;
3595 this.quantifier = quantifier;
3596 }
3597
3598 @Override
3599 public OnnxType type() {
3600 return type;
3601 }
3602
3603 @Override
3604 public Quantifier quantifier() {
3605 return quantifier;
3606 }
3607 }
3608
3609 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3610 NAME,
3611 List.of(Attribute.values()),
3612 List.of(TypeConstraint.values()),
3613 List.of(InputParameter.values()),
3614 List.of(OutputParameter.values())
3615 );
3616
3617 public BitwiseXor(ExternalizedOp def) {
3618 super(SCHEMA, def);
3619 }
3620
3621 BitwiseXor(BitwiseXor that, CodeContext cc) {
3622 super(that, cc);
3623 }
3624
3625 @Override
3626 public BitwiseXor transform(CodeContext cc, CodeTransformer ot) {
3627 return new BitwiseXor(this, cc);
3628 }
3629
3630 BitwiseXor(CodeType resultType, Value A, Value B) {
3631 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
3632 }
3633
3634 @Override
3635 public SequencedSet<OnnxParameter> onnxOutputs() {
3636 return onnxOutputs(SCHEMA);
3637 }
3638
3639 @Override
3640 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3641 return onnxInputs(SCHEMA, List.of(A(), B()));
3642 }
3643
3644 public Value A() {
3645 return operands().get(0);
3646 }
3647
3648 public Value B() {
3649 return operands().get(1);
3650 }
3651
3652 }
3653
3654 public static BitwiseXor BitwiseXor(CodeType resultType, Value A, Value B) {
3655 return new BitwiseXor(resultType, A, B);
3656 }
3657
3658 @OpFactoryHelper.OpDeclaration(BlackmanWindow.NAME)
3659 public static final class BlackmanWindow extends OnnxOp {
3660 public static final String NAME = "BlackmanWindow";
3661
3662 public enum Attribute implements OnnxAttribute {
3663 periodic(Long.class, true, 1),
3664 output_datatype(Long.class, true, 1),
3665 ;
3666
3667 final Class<?> t;
3668 final boolean optional;
3669 final Object defaultValue;
3670
3671 Attribute(Class<?> type, boolean optional, Object defaultValue) {
3672 this.t = type;
3673 this.optional = optional;
3674 this.defaultValue = defaultValue;
3675 assert optional || defaultValue == null;
3676 }
3677
3678 public Class<?> type() {
3679 return t;
3680 }
3681
3682 public boolean isOptional() {
3683 return optional;
3684 }
3685
3686 public Object defaultValue() {
3687 return defaultValue;
3688 }
3689 }
3690
3691 public enum TypeConstraint implements OnnxTypeConstraint {
3692 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
3693 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
3694 ;
3695
3696 final OnnxType.TypeVariable typeVariable;
3697
3698 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3699 assert typeVariable.name().equals(name());
3700 this.typeVariable = typeVariable;
3701 }
3702
3703 @Override
3704 public OnnxType.TypeVariable typeVariable() {
3705 return typeVariable;
3706 }
3707 }
3708
3709 public enum InputParameter implements OnnxParameter {
3710 size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
3711 ;
3712
3713 final OnnxType type;
3714 final Quantifier quantifier;
3715
3716 InputParameter(OnnxType type, Quantifier quantifier) {
3717 this.type = type;
3718 this.quantifier = quantifier;
3719 }
3720
3721 @Override
3722 public OnnxType type() {
3723 return type;
3724 }
3725
3726 @Override
3727 public Quantifier quantifier() {
3728 return quantifier;
3729 }
3730 }
3731
3732 public enum OutputParameter implements OnnxParameter {
3733 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
3734 ;
3735
3736 final OnnxType type;
3737 final Quantifier quantifier;
3738
3739 OutputParameter(OnnxType type, Quantifier quantifier) {
3740 this.type = type;
3741 this.quantifier = quantifier;
3742 }
3743
3744 @Override
3745 public OnnxType type() {
3746 return type;
3747 }
3748
3749 @Override
3750 public Quantifier quantifier() {
3751 return quantifier;
3752 }
3753 }
3754
3755 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3756 NAME,
3757 List.of(Attribute.values()),
3758 List.of(TypeConstraint.values()),
3759 List.of(InputParameter.values()),
3760 List.of(OutputParameter.values())
3761 );
3762
3763 public BlackmanWindow(ExternalizedOp def) {
3764 super(SCHEMA, def);
3765 }
3766
3767 BlackmanWindow(BlackmanWindow that, CodeContext cc) {
3768 super(that, cc);
3769 }
3770
3771 @Override
3772 public BlackmanWindow transform(CodeContext cc, CodeTransformer ot) {
3773 return new BlackmanWindow(this, cc);
3774 }
3775
3776 BlackmanWindow(CodeType resultType, Value size, java.util.Optional<Long> periodic, java.util.Optional<Long> output_datatype) {
3777 super(SCHEMA, resultType, Set.of(), List.of(size), List.of(periodic, output_datatype));
3778 }
3779
3780 @Override
3781 public SequencedSet<OnnxParameter> onnxOutputs() {
3782 return onnxOutputs(SCHEMA);
3783 }
3784
3785 @Override
3786 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3787 return onnxInputs(SCHEMA, List.of(size()));
3788 }
3789
3790 public Value size() {
3791 return operands().get(0);
3792 }
3793
3794 public java.util.Optional<Long> periodic() {
3795 Long periodic = Attribute.periodic.access(Long.class, onnxAttributes);
3796 return java.util.Optional.ofNullable(periodic);
3797 }
3798
3799 public java.util.Optional<Long> output_datatype() {
3800 Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes);
3801 return java.util.Optional.ofNullable(output_datatype);
3802 }
3803
3804 }
3805
3806 public static BlackmanWindow BlackmanWindow(CodeType resultType, Value size, java.util.Optional<Long> periodic, java.util.Optional<Long> output_datatype) {
3807 return new BlackmanWindow(resultType, size, periodic, output_datatype);
3808 }
3809
3810 @OpFactoryHelper.OpDeclaration(Cast.NAME)
3811 public static final class Cast extends OnnxOp {
3812 public static final String NAME = "Cast";
3813
3814 public enum Attribute implements OnnxAttribute {
3815 saturate(Long.class, true, 1),
3816 to(Long.class, false, null),
3817 round_mode(String.class, true, "up"),
3818 ;
3819
3820 final Class<?> t;
3821 final boolean optional;
3822 final Object defaultValue;
3823
3824 Attribute(Class<?> type, boolean optional, Object defaultValue) {
3825 this.t = type;
3826 this.optional = optional;
3827 this.defaultValue = defaultValue;
3828 assert optional || defaultValue == null;
3829 }
3830
3831 public Class<?> type() {
3832 return t;
3833 }
3834
3835 public boolean isOptional() {
3836 return optional;
3837 }
3838
3839 public Object defaultValue() {
3840 return defaultValue;
3841 }
3842 }
3843
3844 public enum TypeConstraint implements OnnxTypeConstraint {
3845 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
3846 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
3847 ;
3848
3849 final OnnxType.TypeVariable typeVariable;
3850
3851 TypeConstraint(OnnxType.TypeVariable typeVariable) {
3852 assert typeVariable.name().equals(name());
3853 this.typeVariable = typeVariable;
3854 }
3855
3856 @Override
3857 public OnnxType.TypeVariable typeVariable() {
3858 return typeVariable;
3859 }
3860 }
3861
3862 public enum InputParameter implements OnnxParameter {
3863 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
3864 ;
3865
3866 final OnnxType type;
3867 final Quantifier quantifier;
3868
3869 InputParameter(OnnxType type, Quantifier quantifier) {
3870 this.type = type;
3871 this.quantifier = quantifier;
3872 }
3873
3874 @Override
3875 public OnnxType type() {
3876 return type;
3877 }
3878
3879 @Override
3880 public Quantifier quantifier() {
3881 return quantifier;
3882 }
3883 }
3884
3885 public enum OutputParameter implements OnnxParameter {
3886 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
3887 ;
3888
3889 final OnnxType type;
3890 final Quantifier quantifier;
3891
3892 OutputParameter(OnnxType type, Quantifier quantifier) {
3893 this.type = type;
3894 this.quantifier = quantifier;
3895 }
3896
3897 @Override
3898 public OnnxType type() {
3899 return type;
3900 }
3901
3902 @Override
3903 public Quantifier quantifier() {
3904 return quantifier;
3905 }
3906 }
3907
3908 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
3909 NAME,
3910 List.of(Attribute.values()),
3911 List.of(TypeConstraint.values()),
3912 List.of(InputParameter.values()),
3913 List.of(OutputParameter.values())
3914 );
3915
3916 public Cast(ExternalizedOp def) {
3917 super(SCHEMA, def);
3918 }
3919
3920 Cast(Cast that, CodeContext cc) {
3921 super(that, cc);
3922 }
3923
3924 @Override
3925 public Cast transform(CodeContext cc, CodeTransformer ot) {
3926 return new Cast(this, cc);
3927 }
3928
3929 Cast(CodeType resultType, Value input, java.util.Optional<Long> saturate, long to, java.util.Optional<String> round_mode) {
3930 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(saturate, to, round_mode));
3931 }
3932
3933 @Override
3934 public SequencedSet<OnnxParameter> onnxOutputs() {
3935 return onnxOutputs(SCHEMA);
3936 }
3937
3938 @Override
3939 public SequencedMap<OnnxParameter, Object> onnxInputs() {
3940 return onnxInputs(SCHEMA, List.of(input()));
3941 }
3942
3943 public Value input() {
3944 return operands().get(0);
3945 }
3946
3947 public java.util.Optional<Long> saturate() {
3948 Long saturate = Attribute.saturate.access(Long.class, onnxAttributes);
3949 return java.util.Optional.ofNullable(saturate);
3950 }
3951
3952 public long to() {
3953 long to = Attribute.to.access(Long.class, onnxAttributes);
3954 return to;
3955 }
3956
3957 public java.util.Optional<String> round_mode() {
3958 String round_mode = Attribute.round_mode.access(String.class, onnxAttributes);
3959 return java.util.Optional.ofNullable(round_mode);
3960 }
3961
3962 }
3963
3964 public static Cast Cast(CodeType resultType, Value input, java.util.Optional<Long> saturate, long to, java.util.Optional<String> round_mode) {
3965 return new Cast(resultType, input, saturate, to, round_mode);
3966 }
3967
3968 @OpFactoryHelper.OpDeclaration(CastLike.NAME)
3969 public static final class CastLike extends OnnxOp {
3970 public static final String NAME = "CastLike";
3971
3972 public enum Attribute implements OnnxAttribute {
3973 saturate(Long.class, true, 1),
3974 round_mode(String.class, true, "up"),
3975 ;
3976
3977 final Class<?> t;
3978 final boolean optional;
3979 final Object defaultValue;
3980
3981 Attribute(Class<?> type, boolean optional, Object defaultValue) {
3982 this.t = type;
3983 this.optional = optional;
3984 this.defaultValue = defaultValue;
3985 assert optional || defaultValue == null;
3986 }
3987
3988 public Class<?> type() {
3989 return t;
3990 }
3991
3992 public boolean isOptional() {
3993 return optional;
3994 }
3995
3996 public Object defaultValue() {
3997 return defaultValue;
3998 }
3999 }
4000
4001 public enum TypeConstraint implements OnnxTypeConstraint {
4002 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
4003 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
4004 ;
4005
4006 final OnnxType.TypeVariable typeVariable;
4007
4008 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4009 assert typeVariable.name().equals(name());
4010 this.typeVariable = typeVariable;
4011 }
4012
4013 @Override
4014 public OnnxType.TypeVariable typeVariable() {
4015 return typeVariable;
4016 }
4017 }
4018
4019 public enum InputParameter implements OnnxParameter {
4020 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
4021 target_type(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
4022 ;
4023
4024 final OnnxType type;
4025 final Quantifier quantifier;
4026
4027 InputParameter(OnnxType type, Quantifier quantifier) {
4028 this.type = type;
4029 this.quantifier = quantifier;
4030 }
4031
4032 @Override
4033 public OnnxType type() {
4034 return type;
4035 }
4036
4037 @Override
4038 public Quantifier quantifier() {
4039 return quantifier;
4040 }
4041 }
4042
4043 public enum OutputParameter implements OnnxParameter {
4044 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
4045 ;
4046
4047 final OnnxType type;
4048 final Quantifier quantifier;
4049
4050 OutputParameter(OnnxType type, Quantifier quantifier) {
4051 this.type = type;
4052 this.quantifier = quantifier;
4053 }
4054
4055 @Override
4056 public OnnxType type() {
4057 return type;
4058 }
4059
4060 @Override
4061 public Quantifier quantifier() {
4062 return quantifier;
4063 }
4064 }
4065
4066 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4067 NAME,
4068 List.of(Attribute.values()),
4069 List.of(TypeConstraint.values()),
4070 List.of(InputParameter.values()),
4071 List.of(OutputParameter.values())
4072 );
4073
4074 public CastLike(ExternalizedOp def) {
4075 super(SCHEMA, def);
4076 }
4077
4078 CastLike(CastLike that, CodeContext cc) {
4079 super(that, cc);
4080 }
4081
4082 @Override
4083 public CastLike transform(CodeContext cc, CodeTransformer ot) {
4084 return new CastLike(this, cc);
4085 }
4086
4087 CastLike(CodeType resultType, Value input, Value target_type, java.util.Optional<Long> saturate, java.util.Optional<String> round_mode) {
4088 super(SCHEMA, resultType, Set.of(), List.of(input, target_type), List.of(saturate, round_mode));
4089 }
4090
4091 @Override
4092 public SequencedSet<OnnxParameter> onnxOutputs() {
4093 return onnxOutputs(SCHEMA);
4094 }
4095
4096 @Override
4097 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4098 return onnxInputs(SCHEMA, List.of(input(), target_type()));
4099 }
4100
4101 public Value input() {
4102 return operands().get(0);
4103 }
4104
4105 public Value target_type() {
4106 return operands().get(1);
4107 }
4108
4109 public java.util.Optional<Long> saturate() {
4110 Long saturate = Attribute.saturate.access(Long.class, onnxAttributes);
4111 return java.util.Optional.ofNullable(saturate);
4112 }
4113
4114 public java.util.Optional<String> round_mode() {
4115 String round_mode = Attribute.round_mode.access(String.class, onnxAttributes);
4116 return java.util.Optional.ofNullable(round_mode);
4117 }
4118
4119 }
4120
4121 public static CastLike CastLike(CodeType resultType, Value input, Value target_type, java.util.Optional<Long> saturate, java.util.Optional<String> round_mode) {
4122 return new CastLike(resultType, input, target_type, saturate, round_mode);
4123 }
4124
4125 @OpFactoryHelper.OpDeclaration(CastMap.NAME)
4126 public static final class CastMap extends OnnxOp {
4127 public static final String NAME = "CastMap";
4128
4129 public enum Attribute implements OnnxAttribute {
4130 map_form(String.class, true, "DENSE"),
4131 cast_to(String.class, true, "TO_FLOAT"),
4132 max_map(Long.class, true, 1),
4133 ;
4134
4135 final Class<?> t;
4136 final boolean optional;
4137 final Object defaultValue;
4138
4139 Attribute(Class<?> type, boolean optional, Object defaultValue) {
4140 this.t = type;
4141 this.optional = optional;
4142 this.defaultValue = defaultValue;
4143 assert optional || defaultValue == null;
4144 }
4145
4146 public Class<?> type() {
4147 return t;
4148 }
4149
4150 public boolean isOptional() {
4151 return optional;
4152 }
4153
4154 public Object defaultValue() {
4155 return defaultValue;
4156 }
4157 }
4158
4159 public enum TypeConstraint implements OnnxTypeConstraint {
4160 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.map(OnnxType.int64(), OnnxType.string()), OnnxType.map(OnnxType.int64(), OnnxType.float32())))),
4161 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int64())))),
4162 ;
4163
4164 final OnnxType.TypeVariable typeVariable;
4165
4166 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4167 assert typeVariable.name().equals(name());
4168 this.typeVariable = typeVariable;
4169 }
4170
4171 @Override
4172 public OnnxType.TypeVariable typeVariable() {
4173 return typeVariable;
4174 }
4175 }
4176
4177 public enum InputParameter implements OnnxParameter {
4178 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
4179 ;
4180
4181 final OnnxType type;
4182 final Quantifier quantifier;
4183
4184 InputParameter(OnnxType type, Quantifier quantifier) {
4185 this.type = type;
4186 this.quantifier = quantifier;
4187 }
4188
4189 @Override
4190 public OnnxType type() {
4191 return type;
4192 }
4193
4194 @Override
4195 public Quantifier quantifier() {
4196 return quantifier;
4197 }
4198 }
4199
4200 public enum OutputParameter implements OnnxParameter {
4201 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
4202 ;
4203
4204 final OnnxType type;
4205 final Quantifier quantifier;
4206
4207 OutputParameter(OnnxType type, Quantifier quantifier) {
4208 this.type = type;
4209 this.quantifier = quantifier;
4210 }
4211
4212 @Override
4213 public OnnxType type() {
4214 return type;
4215 }
4216
4217 @Override
4218 public Quantifier quantifier() {
4219 return quantifier;
4220 }
4221 }
4222
4223 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4224 NAME,
4225 List.of(Attribute.values()),
4226 List.of(TypeConstraint.values()),
4227 List.of(InputParameter.values()),
4228 List.of(OutputParameter.values())
4229 );
4230
4231 public CastMap(ExternalizedOp def) {
4232 super(SCHEMA, def);
4233 }
4234
4235 CastMap(CastMap that, CodeContext cc) {
4236 super(that, cc);
4237 }
4238
4239 @Override
4240 public CastMap transform(CodeContext cc, CodeTransformer ot) {
4241 return new CastMap(this, cc);
4242 }
4243
4244 CastMap(CodeType resultType, Value X, java.util.Optional<String> map_form, java.util.Optional<String> cast_to, java.util.Optional<Long> max_map) {
4245 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(map_form, cast_to, max_map));
4246 }
4247
4248 @Override
4249 public SequencedSet<OnnxParameter> onnxOutputs() {
4250 return onnxOutputs(SCHEMA);
4251 }
4252
4253 @Override
4254 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4255 return onnxInputs(SCHEMA, List.of(X()));
4256 }
4257
4258 public Value X() {
4259 return operands().get(0);
4260 }
4261
4262 public java.util.Optional<String> map_form() {
4263 String map_form = Attribute.map_form.access(String.class, onnxAttributes);
4264 return java.util.Optional.ofNullable(map_form);
4265 }
4266
4267 public java.util.Optional<String> cast_to() {
4268 String cast_to = Attribute.cast_to.access(String.class, onnxAttributes);
4269 return java.util.Optional.ofNullable(cast_to);
4270 }
4271
4272 public java.util.Optional<Long> max_map() {
4273 Long max_map = Attribute.max_map.access(Long.class, onnxAttributes);
4274 return java.util.Optional.ofNullable(max_map);
4275 }
4276
4277 }
4278
4279 public static CastMap CastMap(CodeType resultType, Value X, java.util.Optional<String> map_form, java.util.Optional<String> cast_to, java.util.Optional<Long> max_map) {
4280 return new CastMap(resultType, X, map_form, cast_to, max_map);
4281 }
4282
4283 @OpFactoryHelper.OpDeclaration(CategoryMapper.NAME)
4284 public static final class CategoryMapper extends OnnxOp {
4285 public static final String NAME = "CategoryMapper";
4286
4287 public enum Attribute implements OnnxAttribute {
4288 cats_int64s(long[].class, true, null),
4289 cats_strings(String[].class, true, null),
4290 default_int64(Long.class, true, -1),
4291 default_string(String.class, true, "_Unused"),
4292 ;
4293
4294 final Class<?> t;
4295 final boolean optional;
4296 final Object defaultValue;
4297
4298 Attribute(Class<?> type, boolean optional, Object defaultValue) {
4299 this.t = type;
4300 this.optional = optional;
4301 this.defaultValue = defaultValue;
4302 assert optional || defaultValue == null;
4303 }
4304
4305 public Class<?> type() {
4306 return t;
4307 }
4308
4309 public boolean isOptional() {
4310 return optional;
4311 }
4312
4313 public Object defaultValue() {
4314 return defaultValue;
4315 }
4316 }
4317
4318 public enum TypeConstraint implements OnnxTypeConstraint {
4319 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))),
4320 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))),
4321 ;
4322
4323 final OnnxType.TypeVariable typeVariable;
4324
4325 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4326 assert typeVariable.name().equals(name());
4327 this.typeVariable = typeVariable;
4328 }
4329
4330 @Override
4331 public OnnxType.TypeVariable typeVariable() {
4332 return typeVariable;
4333 }
4334 }
4335
4336 public enum InputParameter implements OnnxParameter {
4337 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
4338 ;
4339
4340 final OnnxType type;
4341 final Quantifier quantifier;
4342
4343 InputParameter(OnnxType type, Quantifier quantifier) {
4344 this.type = type;
4345 this.quantifier = quantifier;
4346 }
4347
4348 @Override
4349 public OnnxType type() {
4350 return type;
4351 }
4352
4353 @Override
4354 public Quantifier quantifier() {
4355 return quantifier;
4356 }
4357 }
4358
4359 public enum OutputParameter implements OnnxParameter {
4360 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
4361 ;
4362
4363 final OnnxType type;
4364 final Quantifier quantifier;
4365
4366 OutputParameter(OnnxType type, Quantifier quantifier) {
4367 this.type = type;
4368 this.quantifier = quantifier;
4369 }
4370
4371 @Override
4372 public OnnxType type() {
4373 return type;
4374 }
4375
4376 @Override
4377 public Quantifier quantifier() {
4378 return quantifier;
4379 }
4380 }
4381
4382 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4383 NAME,
4384 List.of(Attribute.values()),
4385 List.of(TypeConstraint.values()),
4386 List.of(InputParameter.values()),
4387 List.of(OutputParameter.values())
4388 );
4389
4390 public CategoryMapper(ExternalizedOp def) {
4391 super(SCHEMA, def);
4392 }
4393
4394 CategoryMapper(CategoryMapper that, CodeContext cc) {
4395 super(that, cc);
4396 }
4397
4398 @Override
4399 public CategoryMapper transform(CodeContext cc, CodeTransformer ot) {
4400 return new CategoryMapper(this, cc);
4401 }
4402
4403 CategoryMapper(CodeType resultType, Value X, java.util.Optional<long[]> cats_int64s, java.util.Optional<String[]> cats_strings, java.util.Optional<Long> default_int64, java.util.Optional<String> default_string) {
4404 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(cats_int64s, cats_strings, default_int64, default_string));
4405 }
4406
4407 @Override
4408 public SequencedSet<OnnxParameter> onnxOutputs() {
4409 return onnxOutputs(SCHEMA);
4410 }
4411
4412 @Override
4413 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4414 return onnxInputs(SCHEMA, List.of(X()));
4415 }
4416
4417 public Value X() {
4418 return operands().get(0);
4419 }
4420
4421 public java.util.Optional<long[]> cats_int64s() {
4422 long[] cats_int64s = Attribute.cats_int64s.access(long[].class, onnxAttributes);
4423 return java.util.Optional.ofNullable(cats_int64s).map(long[]::clone);
4424 }
4425
4426 public java.util.Optional<String[]> cats_strings() {
4427 String[] cats_strings = Attribute.cats_strings.access(String[].class, onnxAttributes);
4428 return java.util.Optional.ofNullable(cats_strings).map(String[]::clone);
4429 }
4430
4431 public java.util.Optional<Long> default_int64() {
4432 Long default_int64 = Attribute.default_int64.access(Long.class, onnxAttributes);
4433 return java.util.Optional.ofNullable(default_int64);
4434 }
4435
4436 public java.util.Optional<String> default_string() {
4437 String default_string = Attribute.default_string.access(String.class, onnxAttributes);
4438 return java.util.Optional.ofNullable(default_string);
4439 }
4440
4441 }
4442
4443 public static CategoryMapper CategoryMapper(CodeType resultType, Value X, java.util.Optional<long[]> cats_int64s, java.util.Optional<String[]> cats_strings, java.util.Optional<Long> default_int64, java.util.Optional<String> default_string) {
4444 return new CategoryMapper(resultType, X, cats_int64s, cats_strings, default_int64, default_string);
4445 }
4446
4447 @OpFactoryHelper.OpDeclaration(CausalConvWithState.NAME)
4448 public static final class CausalConvWithState extends OnnxOp {
4449 public static final String NAME = "CausalConvWithState";
4450
4451 public enum Attribute implements OnnxAttribute {
4452 activation(String.class, true, "none"),
4453 ;
4454
4455 final Class<?> t;
4456 final boolean optional;
4457 final Object defaultValue;
4458
4459 Attribute(Class<?> type, boolean optional, Object defaultValue) {
4460 this.t = type;
4461 this.optional = optional;
4462 this.defaultValue = defaultValue;
4463 assert optional || defaultValue == null;
4464 }
4465
4466 public Class<?> type() {
4467 return t;
4468 }
4469
4470 public boolean isOptional() {
4471 return optional;
4472 }
4473
4474 public Object defaultValue() {
4475 return defaultValue;
4476 }
4477 }
4478
4479 public enum TypeConstraint implements OnnxTypeConstraint {
4480 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))),
4481 ;
4482
4483 final OnnxType.TypeVariable typeVariable;
4484
4485 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4486 assert typeVariable.name().equals(name());
4487 this.typeVariable = typeVariable;
4488 }
4489
4490 @Override
4491 public OnnxType.TypeVariable typeVariable() {
4492 return typeVariable;
4493 }
4494 }
4495
4496 public enum InputParameter implements OnnxParameter {
4497 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4498 weight(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4499 bias(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
4500 past_state(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
4501 ;
4502
4503 final OnnxType type;
4504 final Quantifier quantifier;
4505
4506 InputParameter(OnnxType type, Quantifier quantifier) {
4507 this.type = type;
4508 this.quantifier = quantifier;
4509 }
4510
4511 @Override
4512 public OnnxType type() {
4513 return type;
4514 }
4515
4516 @Override
4517 public Quantifier quantifier() {
4518 return quantifier;
4519 }
4520 }
4521
4522 public enum OutputParameter implements OnnxParameter {
4523 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4524 present_state(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4525 ;
4526
4527 final OnnxType type;
4528 final Quantifier quantifier;
4529
4530 OutputParameter(OnnxType type, Quantifier quantifier) {
4531 this.type = type;
4532 this.quantifier = quantifier;
4533 }
4534
4535 @Override
4536 public OnnxType type() {
4537 return type;
4538 }
4539
4540 @Override
4541 public Quantifier quantifier() {
4542 return quantifier;
4543 }
4544 }
4545
4546 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4547 NAME,
4548 List.of(Attribute.values()),
4549 List.of(TypeConstraint.values()),
4550 List.of(InputParameter.values()),
4551 List.of(OutputParameter.values())
4552 );
4553
4554 public CausalConvWithState(ExternalizedOp def) {
4555 super(SCHEMA, def);
4556 }
4557
4558 CausalConvWithState(CausalConvWithState that, CodeContext cc) {
4559 super(that, cc);
4560 }
4561
4562 @Override
4563 public CausalConvWithState transform(CodeContext cc, CodeTransformer ot) {
4564 return new CausalConvWithState(this, cc);
4565 }
4566
4567 CausalConvWithState(CodeType resultType, Value input, Value weight, java.util.Optional<Value> bias, java.util.Optional<Value> past_state, java.util.Optional<String> activation) {
4568 super(SCHEMA, resultType, Set.of(), List.of(input, weight, bias, past_state), List.of(activation));
4569 }
4570
4571 @Override
4572 public SequencedSet<OnnxParameter> onnxOutputs() {
4573 return onnxOutputs(SCHEMA);
4574 }
4575
4576 @Override
4577 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4578 return onnxInputs(SCHEMA, List.of(input(), weight(), bias(), past_state()));
4579 }
4580
4581 public Value input() {
4582 return operands().get(0);
4583 }
4584
4585 public Value weight() {
4586 return operands().get(1);
4587 }
4588
4589 public java.util.Optional<Value> bias() {
4590 int i = optionalInputArguments.indexOf(InputParameter.bias);
4591 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
4592 }
4593
4594 public java.util.Optional<Value> past_state() {
4595 int i = optionalInputArguments.indexOf(InputParameter.past_state);
4596 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
4597 }
4598
4599 public java.util.Optional<String> activation() {
4600 String activation = Attribute.activation.access(String.class, onnxAttributes);
4601 return java.util.Optional.ofNullable(activation);
4602 }
4603
4604 }
4605
4606 public static CausalConvWithState CausalConvWithState(CodeType resultType, Value input, Value weight, java.util.Optional<Value> bias, java.util.Optional<Value> past_state, java.util.Optional<String> activation) {
4607 return new CausalConvWithState(resultType, input, weight, bias, past_state, activation);
4608 }
4609
4610 @OpFactoryHelper.OpDeclaration(Ceil.NAME)
4611 public static final class Ceil extends OnnxOp {
4612 public static final String NAME = "Ceil";
4613
4614 public enum Attribute implements OnnxAttribute.None { }
4615
4616 public enum TypeConstraint implements OnnxTypeConstraint {
4617 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
4618 ;
4619
4620 final OnnxType.TypeVariable typeVariable;
4621
4622 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4623 assert typeVariable.name().equals(name());
4624 this.typeVariable = typeVariable;
4625 }
4626
4627 @Override
4628 public OnnxType.TypeVariable typeVariable() {
4629 return typeVariable;
4630 }
4631 }
4632
4633 public enum InputParameter implements OnnxParameter {
4634 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4635 ;
4636
4637 final OnnxType type;
4638 final Quantifier quantifier;
4639
4640 InputParameter(OnnxType type, Quantifier quantifier) {
4641 this.type = type;
4642 this.quantifier = quantifier;
4643 }
4644
4645 @Override
4646 public OnnxType type() {
4647 return type;
4648 }
4649
4650 @Override
4651 public Quantifier quantifier() {
4652 return quantifier;
4653 }
4654 }
4655
4656 public enum OutputParameter implements OnnxParameter {
4657 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4658 ;
4659
4660 final OnnxType type;
4661 final Quantifier quantifier;
4662
4663 OutputParameter(OnnxType type, Quantifier quantifier) {
4664 this.type = type;
4665 this.quantifier = quantifier;
4666 }
4667
4668 @Override
4669 public OnnxType type() {
4670 return type;
4671 }
4672
4673 @Override
4674 public Quantifier quantifier() {
4675 return quantifier;
4676 }
4677 }
4678
4679 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4680 NAME,
4681 List.of(Attribute.values()),
4682 List.of(TypeConstraint.values()),
4683 List.of(InputParameter.values()),
4684 List.of(OutputParameter.values())
4685 );
4686
4687 public Ceil(ExternalizedOp def) {
4688 super(SCHEMA, def);
4689 }
4690
4691 Ceil(Ceil that, CodeContext cc) {
4692 super(that, cc);
4693 }
4694
4695 @Override
4696 public Ceil transform(CodeContext cc, CodeTransformer ot) {
4697 return new Ceil(this, cc);
4698 }
4699
4700 Ceil(CodeType resultType, Value X) {
4701 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
4702 }
4703
4704 @Override
4705 public SequencedSet<OnnxParameter> onnxOutputs() {
4706 return onnxOutputs(SCHEMA);
4707 }
4708
4709 @Override
4710 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4711 return onnxInputs(SCHEMA, List.of(X()));
4712 }
4713
4714 public Value X() {
4715 return operands().get(0);
4716 }
4717
4718 }
4719
4720 public static Ceil Ceil(CodeType resultType, Value X) {
4721 return new Ceil(resultType, X);
4722 }
4723
4724 @OpFactoryHelper.OpDeclaration(Celu.NAME)
4725 public static final class Celu extends OnnxOp {
4726 public static final String NAME = "Celu";
4727
4728 public enum Attribute implements OnnxAttribute {
4729 alpha(Float.class, true, 1.0f),
4730 ;
4731
4732 final Class<?> t;
4733 final boolean optional;
4734 final Object defaultValue;
4735
4736 Attribute(Class<?> type, boolean optional, Object defaultValue) {
4737 this.t = type;
4738 this.optional = optional;
4739 this.defaultValue = defaultValue;
4740 assert optional || defaultValue == null;
4741 }
4742
4743 public Class<?> type() {
4744 return t;
4745 }
4746
4747 public boolean isOptional() {
4748 return optional;
4749 }
4750
4751 public Object defaultValue() {
4752 return defaultValue;
4753 }
4754 }
4755
4756 public enum TypeConstraint implements OnnxTypeConstraint {
4757 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32())))),
4758 ;
4759
4760 final OnnxType.TypeVariable typeVariable;
4761
4762 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4763 assert typeVariable.name().equals(name());
4764 this.typeVariable = typeVariable;
4765 }
4766
4767 @Override
4768 public OnnxType.TypeVariable typeVariable() {
4769 return typeVariable;
4770 }
4771 }
4772
4773 public enum InputParameter implements OnnxParameter {
4774 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4775 ;
4776
4777 final OnnxType type;
4778 final Quantifier quantifier;
4779
4780 InputParameter(OnnxType type, Quantifier quantifier) {
4781 this.type = type;
4782 this.quantifier = quantifier;
4783 }
4784
4785 @Override
4786 public OnnxType type() {
4787 return type;
4788 }
4789
4790 @Override
4791 public Quantifier quantifier() {
4792 return quantifier;
4793 }
4794 }
4795
4796 public enum OutputParameter implements OnnxParameter {
4797 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4798 ;
4799
4800 final OnnxType type;
4801 final Quantifier quantifier;
4802
4803 OutputParameter(OnnxType type, Quantifier quantifier) {
4804 this.type = type;
4805 this.quantifier = quantifier;
4806 }
4807
4808 @Override
4809 public OnnxType type() {
4810 return type;
4811 }
4812
4813 @Override
4814 public Quantifier quantifier() {
4815 return quantifier;
4816 }
4817 }
4818
4819 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4820 NAME,
4821 List.of(Attribute.values()),
4822 List.of(TypeConstraint.values()),
4823 List.of(InputParameter.values()),
4824 List.of(OutputParameter.values())
4825 );
4826
4827 public Celu(ExternalizedOp def) {
4828 super(SCHEMA, def);
4829 }
4830
4831 Celu(Celu that, CodeContext cc) {
4832 super(that, cc);
4833 }
4834
4835 @Override
4836 public Celu transform(CodeContext cc, CodeTransformer ot) {
4837 return new Celu(this, cc);
4838 }
4839
4840 Celu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
4841 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha));
4842 }
4843
4844 @Override
4845 public SequencedSet<OnnxParameter> onnxOutputs() {
4846 return onnxOutputs(SCHEMA);
4847 }
4848
4849 @Override
4850 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4851 return onnxInputs(SCHEMA, List.of(X()));
4852 }
4853
4854 public Value X() {
4855 return operands().get(0);
4856 }
4857
4858 public java.util.Optional<Float> alpha() {
4859 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
4860 return java.util.Optional.ofNullable(alpha);
4861 }
4862
4863 }
4864
4865 public static Celu Celu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
4866 return new Celu(resultType, X, alpha);
4867 }
4868
4869 @OpFactoryHelper.OpDeclaration(CenterCropPad.NAME)
4870 public static final class CenterCropPad extends OnnxOp {
4871 public static final String NAME = "CenterCropPad";
4872
4873 public enum Attribute implements OnnxAttribute {
4874 axes(long[].class, true, null),
4875 ;
4876
4877 final Class<?> t;
4878 final boolean optional;
4879 final Object defaultValue;
4880
4881 Attribute(Class<?> type, boolean optional, Object defaultValue) {
4882 this.t = type;
4883 this.optional = optional;
4884 this.defaultValue = defaultValue;
4885 assert optional || defaultValue == null;
4886 }
4887
4888 public Class<?> type() {
4889 return t;
4890 }
4891
4892 public boolean isOptional() {
4893 return optional;
4894 }
4895
4896 public Object defaultValue() {
4897 return defaultValue;
4898 }
4899 }
4900
4901 public enum TypeConstraint implements OnnxTypeConstraint {
4902 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
4903 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
4904 ;
4905
4906 final OnnxType.TypeVariable typeVariable;
4907
4908 TypeConstraint(OnnxType.TypeVariable typeVariable) {
4909 assert typeVariable.name().equals(name());
4910 this.typeVariable = typeVariable;
4911 }
4912
4913 @Override
4914 public OnnxType.TypeVariable typeVariable() {
4915 return typeVariable;
4916 }
4917 }
4918
4919 public enum InputParameter implements OnnxParameter {
4920 input_data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4921 shape(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
4922 ;
4923
4924 final OnnxType type;
4925 final Quantifier quantifier;
4926
4927 InputParameter(OnnxType type, Quantifier quantifier) {
4928 this.type = type;
4929 this.quantifier = quantifier;
4930 }
4931
4932 @Override
4933 public OnnxType type() {
4934 return type;
4935 }
4936
4937 @Override
4938 public Quantifier quantifier() {
4939 return quantifier;
4940 }
4941 }
4942
4943 public enum OutputParameter implements OnnxParameter {
4944 output_data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
4945 ;
4946
4947 final OnnxType type;
4948 final Quantifier quantifier;
4949
4950 OutputParameter(OnnxType type, Quantifier quantifier) {
4951 this.type = type;
4952 this.quantifier = quantifier;
4953 }
4954
4955 @Override
4956 public OnnxType type() {
4957 return type;
4958 }
4959
4960 @Override
4961 public Quantifier quantifier() {
4962 return quantifier;
4963 }
4964 }
4965
4966 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
4967 NAME,
4968 List.of(Attribute.values()),
4969 List.of(TypeConstraint.values()),
4970 List.of(InputParameter.values()),
4971 List.of(OutputParameter.values())
4972 );
4973
4974 public CenterCropPad(ExternalizedOp def) {
4975 super(SCHEMA, def);
4976 }
4977
4978 CenterCropPad(CenterCropPad that, CodeContext cc) {
4979 super(that, cc);
4980 }
4981
4982 @Override
4983 public CenterCropPad transform(CodeContext cc, CodeTransformer ot) {
4984 return new CenterCropPad(this, cc);
4985 }
4986
4987 CenterCropPad(CodeType resultType, Value input_data, Value shape, java.util.Optional<long[]> axes) {
4988 super(SCHEMA, resultType, Set.of(), List.of(input_data, shape), List.of(axes));
4989 }
4990
4991 @Override
4992 public SequencedSet<OnnxParameter> onnxOutputs() {
4993 return onnxOutputs(SCHEMA);
4994 }
4995
4996 @Override
4997 public SequencedMap<OnnxParameter, Object> onnxInputs() {
4998 return onnxInputs(SCHEMA, List.of(input_data(), shape()));
4999 }
5000
5001 public Value input_data() {
5002 return operands().get(0);
5003 }
5004
5005 public Value shape() {
5006 return operands().get(1);
5007 }
5008
5009 public java.util.Optional<long[]> axes() {
5010 long[] axes = Attribute.axes.access(long[].class, onnxAttributes);
5011 return java.util.Optional.ofNullable(axes).map(long[]::clone);
5012 }
5013
5014 }
5015
5016 public static CenterCropPad CenterCropPad(CodeType resultType, Value input_data, Value shape, java.util.Optional<long[]> axes) {
5017 return new CenterCropPad(resultType, input_data, shape, axes);
5018 }
5019
5020 @OpFactoryHelper.OpDeclaration(Clip.NAME)
5021 public static final class Clip extends OnnxOp {
5022 public static final String NAME = "Clip";
5023
5024 public enum Attribute implements OnnxAttribute.None { }
5025
5026 public enum TypeConstraint implements OnnxTypeConstraint {
5027 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
5028 ;
5029
5030 final OnnxType.TypeVariable typeVariable;
5031
5032 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5033 assert typeVariable.name().equals(name());
5034 this.typeVariable = typeVariable;
5035 }
5036
5037 @Override
5038 public OnnxType.TypeVariable typeVariable() {
5039 return typeVariable;
5040 }
5041 }
5042
5043 public enum InputParameter implements OnnxParameter {
5044 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5045 min(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
5046 max(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
5047 ;
5048
5049 final OnnxType type;
5050 final Quantifier quantifier;
5051
5052 InputParameter(OnnxType type, Quantifier quantifier) {
5053 this.type = type;
5054 this.quantifier = quantifier;
5055 }
5056
5057 @Override
5058 public OnnxType type() {
5059 return type;
5060 }
5061
5062 @Override
5063 public Quantifier quantifier() {
5064 return quantifier;
5065 }
5066 }
5067
5068 public enum OutputParameter implements OnnxParameter {
5069 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5070 ;
5071
5072 final OnnxType type;
5073 final Quantifier quantifier;
5074
5075 OutputParameter(OnnxType type, Quantifier quantifier) {
5076 this.type = type;
5077 this.quantifier = quantifier;
5078 }
5079
5080 @Override
5081 public OnnxType type() {
5082 return type;
5083 }
5084
5085 @Override
5086 public Quantifier quantifier() {
5087 return quantifier;
5088 }
5089 }
5090
5091 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
5092 NAME,
5093 List.of(Attribute.values()),
5094 List.of(TypeConstraint.values()),
5095 List.of(InputParameter.values()),
5096 List.of(OutputParameter.values())
5097 );
5098
5099 public Clip(ExternalizedOp def) {
5100 super(SCHEMA, def);
5101 }
5102
5103 Clip(Clip that, CodeContext cc) {
5104 super(that, cc);
5105 }
5106
5107 @Override
5108 public Clip transform(CodeContext cc, CodeTransformer ot) {
5109 return new Clip(this, cc);
5110 }
5111
5112 Clip(CodeType resultType, Value input, java.util.Optional<Value> min, java.util.Optional<Value> max) {
5113 super(SCHEMA, resultType, Set.of(), List.of(input, min, max), List.of());
5114 }
5115
5116 @Override
5117 public SequencedSet<OnnxParameter> onnxOutputs() {
5118 return onnxOutputs(SCHEMA);
5119 }
5120
5121 @Override
5122 public SequencedMap<OnnxParameter, Object> onnxInputs() {
5123 return onnxInputs(SCHEMA, List.of(input(), min(), max()));
5124 }
5125
5126 public Value input() {
5127 return operands().get(0);
5128 }
5129
5130 public java.util.Optional<Value> min() {
5131 int i = optionalInputArguments.indexOf(InputParameter.min);
5132 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
5133 }
5134
5135 public java.util.Optional<Value> max() {
5136 int i = optionalInputArguments.indexOf(InputParameter.max);
5137 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
5138 }
5139
5140 }
5141
5142 public static Clip Clip(CodeType resultType, Value input, java.util.Optional<Value> min, java.util.Optional<Value> max) {
5143 return new Clip(resultType, input, min, max);
5144 }
5145
5146 @OpFactoryHelper.OpDeclaration(Col2Im.NAME)
5147 public static final class Col2Im extends OnnxOp {
5148 public static final String NAME = "Col2Im";
5149
5150 public enum Attribute implements OnnxAttribute {
5151 pads(long[].class, true, null),
5152 dilations(long[].class, true, null),
5153 strides(long[].class, true, null),
5154 ;
5155
5156 final Class<?> t;
5157 final boolean optional;
5158 final Object defaultValue;
5159
5160 Attribute(Class<?> type, boolean optional, Object defaultValue) {
5161 this.t = type;
5162 this.optional = optional;
5163 this.defaultValue = defaultValue;
5164 assert optional || defaultValue == null;
5165 }
5166
5167 public Class<?> type() {
5168 return t;
5169 }
5170
5171 public boolean isOptional() {
5172 return optional;
5173 }
5174
5175 public Object defaultValue() {
5176 return defaultValue;
5177 }
5178 }
5179
5180 public enum TypeConstraint implements OnnxTypeConstraint {
5181 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
5182 ;
5183
5184 final OnnxType.TypeVariable typeVariable;
5185
5186 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5187 assert typeVariable.name().equals(name());
5188 this.typeVariable = typeVariable;
5189 }
5190
5191 @Override
5192 public OnnxType.TypeVariable typeVariable() {
5193 return typeVariable;
5194 }
5195 }
5196
5197 public enum InputParameter implements OnnxParameter {
5198 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5199 image_shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
5200 block_shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
5201 ;
5202
5203 final OnnxType type;
5204 final Quantifier quantifier;
5205
5206 InputParameter(OnnxType type, Quantifier quantifier) {
5207 this.type = type;
5208 this.quantifier = quantifier;
5209 }
5210
5211 @Override
5212 public OnnxType type() {
5213 return type;
5214 }
5215
5216 @Override
5217 public Quantifier quantifier() {
5218 return quantifier;
5219 }
5220 }
5221
5222 public enum OutputParameter implements OnnxParameter {
5223 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5224 ;
5225
5226 final OnnxType type;
5227 final Quantifier quantifier;
5228
5229 OutputParameter(OnnxType type, Quantifier quantifier) {
5230 this.type = type;
5231 this.quantifier = quantifier;
5232 }
5233
5234 @Override
5235 public OnnxType type() {
5236 return type;
5237 }
5238
5239 @Override
5240 public Quantifier quantifier() {
5241 return quantifier;
5242 }
5243 }
5244
5245 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
5246 NAME,
5247 List.of(Attribute.values()),
5248 List.of(TypeConstraint.values()),
5249 List.of(InputParameter.values()),
5250 List.of(OutputParameter.values())
5251 );
5252
5253 public Col2Im(ExternalizedOp def) {
5254 super(SCHEMA, def);
5255 }
5256
5257 Col2Im(Col2Im that, CodeContext cc) {
5258 super(that, cc);
5259 }
5260
5261 @Override
5262 public Col2Im transform(CodeContext cc, CodeTransformer ot) {
5263 return new Col2Im(this, cc);
5264 }
5265
5266 Col2Im(CodeType resultType, Value input, Value image_shape, Value block_shape, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<long[]> strides) {
5267 super(SCHEMA, resultType, Set.of(), List.of(input, image_shape, block_shape), List.of(pads, dilations, strides));
5268 }
5269
5270 @Override
5271 public SequencedSet<OnnxParameter> onnxOutputs() {
5272 return onnxOutputs(SCHEMA);
5273 }
5274
5275 @Override
5276 public SequencedMap<OnnxParameter, Object> onnxInputs() {
5277 return onnxInputs(SCHEMA, List.of(input(), image_shape(), block_shape()));
5278 }
5279
5280 public Value input() {
5281 return operands().get(0);
5282 }
5283
5284 public Value image_shape() {
5285 return operands().get(1);
5286 }
5287
5288 public Value block_shape() {
5289 return operands().get(2);
5290 }
5291
5292 public java.util.Optional<long[]> pads() {
5293 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
5294 return java.util.Optional.ofNullable(pads).map(long[]::clone);
5295 }
5296
5297 public java.util.Optional<long[]> dilations() {
5298 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
5299 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
5300 }
5301
5302 public java.util.Optional<long[]> strides() {
5303 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
5304 return java.util.Optional.ofNullable(strides).map(long[]::clone);
5305 }
5306
5307 }
5308
5309 public static Col2Im Col2Im(CodeType resultType, Value input, Value image_shape, Value block_shape, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<long[]> strides) {
5310 return new Col2Im(resultType, input, image_shape, block_shape, pads, dilations, strides);
5311 }
5312
5313 @OpFactoryHelper.OpDeclaration(Compress.NAME)
5314 public static final class Compress extends OnnxOp {
5315 public static final String NAME = "Compress";
5316
5317 public enum Attribute implements OnnxAttribute {
5318 axis(Long.class, true, null),
5319 ;
5320
5321 final Class<?> t;
5322 final boolean optional;
5323 final Object defaultValue;
5324
5325 Attribute(Class<?> type, boolean optional, Object defaultValue) {
5326 this.t = type;
5327 this.optional = optional;
5328 this.defaultValue = defaultValue;
5329 assert optional || defaultValue == null;
5330 }
5331
5332 public Class<?> type() {
5333 return t;
5334 }
5335
5336 public boolean isOptional() {
5337 return optional;
5338 }
5339
5340 public Object defaultValue() {
5341 return defaultValue;
5342 }
5343 }
5344
5345 public enum TypeConstraint implements OnnxTypeConstraint {
5346 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
5347 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
5348 ;
5349
5350 final OnnxType.TypeVariable typeVariable;
5351
5352 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5353 assert typeVariable.name().equals(name());
5354 this.typeVariable = typeVariable;
5355 }
5356
5357 @Override
5358 public OnnxType.TypeVariable typeVariable() {
5359 return typeVariable;
5360 }
5361 }
5362
5363 public enum InputParameter implements OnnxParameter {
5364 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5365 condition(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
5366 ;
5367
5368 final OnnxType type;
5369 final Quantifier quantifier;
5370
5371 InputParameter(OnnxType type, Quantifier quantifier) {
5372 this.type = type;
5373 this.quantifier = quantifier;
5374 }
5375
5376 @Override
5377 public OnnxType type() {
5378 return type;
5379 }
5380
5381 @Override
5382 public Quantifier quantifier() {
5383 return quantifier;
5384 }
5385 }
5386
5387 public enum OutputParameter implements OnnxParameter {
5388 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5389 ;
5390
5391 final OnnxType type;
5392 final Quantifier quantifier;
5393
5394 OutputParameter(OnnxType type, Quantifier quantifier) {
5395 this.type = type;
5396 this.quantifier = quantifier;
5397 }
5398
5399 @Override
5400 public OnnxType type() {
5401 return type;
5402 }
5403
5404 @Override
5405 public Quantifier quantifier() {
5406 return quantifier;
5407 }
5408 }
5409
5410 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
5411 NAME,
5412 List.of(Attribute.values()),
5413 List.of(TypeConstraint.values()),
5414 List.of(InputParameter.values()),
5415 List.of(OutputParameter.values())
5416 );
5417
5418 public Compress(ExternalizedOp def) {
5419 super(SCHEMA, def);
5420 }
5421
5422 Compress(Compress that, CodeContext cc) {
5423 super(that, cc);
5424 }
5425
5426 @Override
5427 public Compress transform(CodeContext cc, CodeTransformer ot) {
5428 return new Compress(this, cc);
5429 }
5430
5431 Compress(CodeType resultType, Value input, Value condition, java.util.Optional<Long> axis) {
5432 super(SCHEMA, resultType, Set.of(), List.of(input, condition), List.of(axis));
5433 }
5434
5435 @Override
5436 public SequencedSet<OnnxParameter> onnxOutputs() {
5437 return onnxOutputs(SCHEMA);
5438 }
5439
5440 @Override
5441 public SequencedMap<OnnxParameter, Object> onnxInputs() {
5442 return onnxInputs(SCHEMA, List.of(input(), condition()));
5443 }
5444
5445 public Value input() {
5446 return operands().get(0);
5447 }
5448
5449 public Value condition() {
5450 return operands().get(1);
5451 }
5452
5453 public java.util.Optional<Long> axis() {
5454 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
5455 return java.util.Optional.ofNullable(axis);
5456 }
5457
5458 }
5459
5460 public static Compress Compress(CodeType resultType, Value input, Value condition, java.util.Optional<Long> axis) {
5461 return new Compress(resultType, input, condition, axis);
5462 }
5463
5464 @OpFactoryHelper.OpDeclaration(Concat.NAME)
5465 public static final class Concat extends OnnxOp {
5466 public static final String NAME = "Concat";
5467
5468 public enum Attribute implements OnnxAttribute {
5469 axis(Long.class, false, null),
5470 ;
5471
5472 final Class<?> t;
5473 final boolean optional;
5474 final Object defaultValue;
5475
5476 Attribute(Class<?> type, boolean optional, Object defaultValue) {
5477 this.t = type;
5478 this.optional = optional;
5479 this.defaultValue = defaultValue;
5480 assert optional || defaultValue == null;
5481 }
5482
5483 public Class<?> type() {
5484 return t;
5485 }
5486
5487 public boolean isOptional() {
5488 return optional;
5489 }
5490
5491 public Object defaultValue() {
5492 return defaultValue;
5493 }
5494 }
5495
5496 public enum TypeConstraint implements OnnxTypeConstraint {
5497 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
5498 ;
5499
5500 final OnnxType.TypeVariable typeVariable;
5501
5502 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5503 assert typeVariable.name().equals(name());
5504 this.typeVariable = typeVariable;
5505 }
5506
5507 @Override
5508 public OnnxType.TypeVariable typeVariable() {
5509 return typeVariable;
5510 }
5511 }
5512
5513 public enum InputParameter implements OnnxParameter {
5514 inputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
5515 ;
5516
5517 final OnnxType type;
5518 final Quantifier quantifier;
5519
5520 InputParameter(OnnxType type, Quantifier quantifier) {
5521 this.type = type;
5522 this.quantifier = quantifier;
5523 }
5524
5525 @Override
5526 public OnnxType type() {
5527 return type;
5528 }
5529
5530 @Override
5531 public Quantifier quantifier() {
5532 return quantifier;
5533 }
5534 }
5535
5536 public enum OutputParameter implements OnnxParameter {
5537 concat_result(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5538 ;
5539
5540 final OnnxType type;
5541 final Quantifier quantifier;
5542
5543 OutputParameter(OnnxType type, Quantifier quantifier) {
5544 this.type = type;
5545 this.quantifier = quantifier;
5546 }
5547
5548 @Override
5549 public OnnxType type() {
5550 return type;
5551 }
5552
5553 @Override
5554 public Quantifier quantifier() {
5555 return quantifier;
5556 }
5557 }
5558
5559 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
5560 NAME,
5561 List.of(Attribute.values()),
5562 List.of(TypeConstraint.values()),
5563 List.of(InputParameter.values()),
5564 List.of(OutputParameter.values())
5565 );
5566
5567 public Concat(ExternalizedOp def) {
5568 super(SCHEMA, def);
5569 }
5570
5571 Concat(Concat that, CodeContext cc) {
5572 super(that, cc);
5573 }
5574
5575 @Override
5576 public Concat transform(CodeContext cc, CodeTransformer ot) {
5577 return new Concat(this, cc);
5578 }
5579
5580 Concat(CodeType resultType, List<Value> inputs, long axis) {
5581 super(SCHEMA, resultType, Set.of(), List.of(inputs), List.of(axis));
5582 }
5583
5584 @Override
5585 public SequencedSet<OnnxParameter> onnxOutputs() {
5586 return onnxOutputs(SCHEMA);
5587 }
5588
5589 @Override
5590 public SequencedMap<OnnxParameter, Object> onnxInputs() {
5591 return onnxInputs(SCHEMA, List.of(inputs()));
5592 }
5593
5594 public List<Value> inputs() {
5595 return operands();
5596 }
5597
5598 public long axis() {
5599 long axis = Attribute.axis.access(Long.class, onnxAttributes);
5600 return axis;
5601 }
5602
5603 }
5604
5605 public static Concat Concat(CodeType resultType, List<Value> inputs, long axis) {
5606 return new Concat(resultType, inputs, axis);
5607 }
5608
5609 @OpFactoryHelper.OpDeclaration(ConcatFromSequence.NAME)
5610 public static final class ConcatFromSequence extends OnnxOp {
5611 public static final String NAME = "ConcatFromSequence";
5612
5613 public enum Attribute implements OnnxAttribute {
5614 axis(Long.class, false, null),
5615 new_axis(Long.class, true, 0),
5616 ;
5617
5618 final Class<?> t;
5619 final boolean optional;
5620 final Object defaultValue;
5621
5622 Attribute(Class<?> type, boolean optional, Object defaultValue) {
5623 this.t = type;
5624 this.optional = optional;
5625 this.defaultValue = defaultValue;
5626 assert optional || defaultValue == null;
5627 }
5628
5629 public Class<?> type() {
5630 return t;
5631 }
5632
5633 public boolean isOptional() {
5634 return optional;
5635 }
5636
5637 public Object defaultValue() {
5638 return defaultValue;
5639 }
5640 }
5641
5642 public enum TypeConstraint implements OnnxTypeConstraint {
5643 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
5644 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
5645 ;
5646
5647 final OnnxType.TypeVariable typeVariable;
5648
5649 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5650 assert typeVariable.name().equals(name());
5651 this.typeVariable = typeVariable;
5652 }
5653
5654 @Override
5655 public OnnxType.TypeVariable typeVariable() {
5656 return typeVariable;
5657 }
5658 }
5659
5660 public enum InputParameter implements OnnxParameter {
5661 input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
5662 ;
5663
5664 final OnnxType type;
5665 final Quantifier quantifier;
5666
5667 InputParameter(OnnxType type, Quantifier quantifier) {
5668 this.type = type;
5669 this.quantifier = quantifier;
5670 }
5671
5672 @Override
5673 public OnnxType type() {
5674 return type;
5675 }
5676
5677 @Override
5678 public Quantifier quantifier() {
5679 return quantifier;
5680 }
5681 }
5682
5683 public enum OutputParameter implements OnnxParameter {
5684 concat_result(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5685 ;
5686
5687 final OnnxType type;
5688 final Quantifier quantifier;
5689
5690 OutputParameter(OnnxType type, Quantifier quantifier) {
5691 this.type = type;
5692 this.quantifier = quantifier;
5693 }
5694
5695 @Override
5696 public OnnxType type() {
5697 return type;
5698 }
5699
5700 @Override
5701 public Quantifier quantifier() {
5702 return quantifier;
5703 }
5704 }
5705
5706 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
5707 NAME,
5708 List.of(Attribute.values()),
5709 List.of(TypeConstraint.values()),
5710 List.of(InputParameter.values()),
5711 List.of(OutputParameter.values())
5712 );
5713
5714 public ConcatFromSequence(ExternalizedOp def) {
5715 super(SCHEMA, def);
5716 }
5717
5718 ConcatFromSequence(ConcatFromSequence that, CodeContext cc) {
5719 super(that, cc);
5720 }
5721
5722 @Override
5723 public ConcatFromSequence transform(CodeContext cc, CodeTransformer ot) {
5724 return new ConcatFromSequence(this, cc);
5725 }
5726
5727 ConcatFromSequence(CodeType resultType, Value input_sequence, long axis, java.util.Optional<Long> new_axis) {
5728 super(SCHEMA, resultType, Set.of(), List.of(input_sequence), List.of(axis, new_axis));
5729 }
5730
5731 @Override
5732 public SequencedSet<OnnxParameter> onnxOutputs() {
5733 return onnxOutputs(SCHEMA);
5734 }
5735
5736 @Override
5737 public SequencedMap<OnnxParameter, Object> onnxInputs() {
5738 return onnxInputs(SCHEMA, List.of(input_sequence()));
5739 }
5740
5741 public Value input_sequence() {
5742 return operands().get(0);
5743 }
5744
5745 public long axis() {
5746 long axis = Attribute.axis.access(Long.class, onnxAttributes);
5747 return axis;
5748 }
5749
5750 public java.util.Optional<Long> new_axis() {
5751 Long new_axis = Attribute.new_axis.access(Long.class, onnxAttributes);
5752 return java.util.Optional.ofNullable(new_axis);
5753 }
5754
5755 }
5756
5757 public static ConcatFromSequence ConcatFromSequence(CodeType resultType, Value input_sequence, long axis, java.util.Optional<Long> new_axis) {
5758 return new ConcatFromSequence(resultType, input_sequence, axis, new_axis);
5759 }
5760
5761 @OpFactoryHelper.OpDeclaration(Constant.NAME)
5762 public static final class Constant extends OnnxOp {
5763 public static final String NAME = "Constant";
5764
5765 public enum Attribute implements OnnxAttribute {
5766 value_int(Long.class, true, null),
5767 value_floats(float[].class, true, null),
5768 value_strings(String[].class, true, null),
5769 value_float(Float.class, true, null),
5770 value_string(String.class, true, null),
5771 value_ints(long[].class, true, null),
5772 sparse_value(byte[].class, true, null),
5773 value(Tensor.class, true, null),
5774 ;
5775
5776 final Class<?> t;
5777 final boolean optional;
5778 final Object defaultValue;
5779
5780 Attribute(Class<?> type, boolean optional, Object defaultValue) {
5781 this.t = type;
5782 this.optional = optional;
5783 this.defaultValue = defaultValue;
5784 assert optional || defaultValue == null;
5785 }
5786
5787 public Class<?> type() {
5788 return t;
5789 }
5790
5791 public boolean isOptional() {
5792 return optional;
5793 }
5794
5795 public Object defaultValue() {
5796 return defaultValue;
5797 }
5798 }
5799
5800 public enum TypeConstraint implements OnnxTypeConstraint {
5801 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
5802 ;
5803
5804 final OnnxType.TypeVariable typeVariable;
5805
5806 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5807 assert typeVariable.name().equals(name());
5808 this.typeVariable = typeVariable;
5809 }
5810
5811 @Override
5812 public OnnxType.TypeVariable typeVariable() {
5813 return typeVariable;
5814 }
5815 }
5816
5817 public enum InputParameter implements OnnxParameter.None { }
5818
5819 public enum OutputParameter implements OnnxParameter {
5820 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
5821 ;
5822
5823 final OnnxType type;
5824 final Quantifier quantifier;
5825
5826 OutputParameter(OnnxType type, Quantifier quantifier) {
5827 this.type = type;
5828 this.quantifier = quantifier;
5829 }
5830
5831 @Override
5832 public OnnxType type() {
5833 return type;
5834 }
5835
5836 @Override
5837 public Quantifier quantifier() {
5838 return quantifier;
5839 }
5840 }
5841
5842 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
5843 NAME,
5844 List.of(Attribute.values()),
5845 List.of(TypeConstraint.values()),
5846 List.of(InputParameter.values()),
5847 List.of(OutputParameter.values())
5848 );
5849
5850 public Constant(ExternalizedOp def) {
5851 super(SCHEMA, def);
5852 }
5853
5854 Constant(Constant that, CodeContext cc) {
5855 super(that, cc);
5856 }
5857
5858 @Override
5859 public Constant transform(CodeContext cc, CodeTransformer ot) {
5860 return new Constant(this, cc);
5861 }
5862
5863 Constant(CodeType resultType, java.util.Optional<Long> value_int, java.util.Optional<float[]> value_floats, java.util.Optional<String[]> value_strings, java.util.Optional<Float> value_float, java.util.Optional<String> value_string, java.util.Optional<long[]> value_ints, java.util.Optional<byte[]> sparse_value, java.util.Optional<Tensor> value) {
5864 super(SCHEMA, resultType, Set.of(), List.of(), List.of(value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value));
5865 }
5866
5867 @Override
5868 public SequencedSet<OnnxParameter> onnxOutputs() {
5869 return onnxOutputs(SCHEMA);
5870 }
5871
5872 @Override
5873 public SequencedMap<OnnxParameter, Object> onnxInputs() {
5874 return onnxInputs(SCHEMA, List.of());
5875 }
5876
5877 public java.util.Optional<Long> value_int() {
5878 Long value_int = Attribute.value_int.access(Long.class, onnxAttributes);
5879 return java.util.Optional.ofNullable(value_int);
5880 }
5881
5882 public java.util.Optional<float[]> value_floats() {
5883 float[] value_floats = Attribute.value_floats.access(float[].class, onnxAttributes);
5884 return java.util.Optional.ofNullable(value_floats).map(float[]::clone);
5885 }
5886
5887 public java.util.Optional<String[]> value_strings() {
5888 String[] value_strings = Attribute.value_strings.access(String[].class, onnxAttributes);
5889 return java.util.Optional.ofNullable(value_strings).map(String[]::clone);
5890 }
5891
5892 public java.util.Optional<Float> value_float() {
5893 Float value_float = Attribute.value_float.access(Float.class, onnxAttributes);
5894 return java.util.Optional.ofNullable(value_float);
5895 }
5896
5897 public java.util.Optional<String> value_string() {
5898 String value_string = Attribute.value_string.access(String.class, onnxAttributes);
5899 return java.util.Optional.ofNullable(value_string);
5900 }
5901
5902 public java.util.Optional<long[]> value_ints() {
5903 long[] value_ints = Attribute.value_ints.access(long[].class, onnxAttributes);
5904 return java.util.Optional.ofNullable(value_ints).map(long[]::clone);
5905 }
5906
5907 public java.util.Optional<byte[]> sparse_value() {
5908 byte[] sparse_value = Attribute.sparse_value.access(byte[].class, onnxAttributes);
5909 return java.util.Optional.ofNullable(sparse_value).map(byte[]::clone);
5910 }
5911
5912 public java.util.Optional<Tensor> value() {
5913 Tensor value = Attribute.value.access(Tensor.class, onnxAttributes);
5914 return java.util.Optional.ofNullable(value);
5915 }
5916
5917 }
5918
5919 public static Constant Constant(CodeType resultType, java.util.Optional<Long> value_int, java.util.Optional<float[]> value_floats, java.util.Optional<String[]> value_strings, java.util.Optional<Float> value_float, java.util.Optional<String> value_string, java.util.Optional<long[]> value_ints, java.util.Optional<byte[]> sparse_value, java.util.Optional<Tensor> value) {
5920 return new Constant(resultType, value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value);
5921 }
5922
5923 @OpFactoryHelper.OpDeclaration(ConstantOfShape.NAME)
5924 public static final class ConstantOfShape extends OnnxOp {
5925 public static final String NAME = "ConstantOfShape";
5926
5927 public enum Attribute implements OnnxAttribute {
5928 value(Tensor.class, true, null),
5929 ;
5930
5931 final Class<?> t;
5932 final boolean optional;
5933 final Object defaultValue;
5934
5935 Attribute(Class<?> type, boolean optional, Object defaultValue) {
5936 this.t = type;
5937 this.optional = optional;
5938 this.defaultValue = defaultValue;
5939 assert optional || defaultValue == null;
5940 }
5941
5942 public Class<?> type() {
5943 return t;
5944 }
5945
5946 public boolean isOptional() {
5947 return optional;
5948 }
5949
5950 public Object defaultValue() {
5951 return defaultValue;
5952 }
5953 }
5954
5955 public enum TypeConstraint implements OnnxTypeConstraint {
5956 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))),
5957 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
5958 ;
5959
5960 final OnnxType.TypeVariable typeVariable;
5961
5962 TypeConstraint(OnnxType.TypeVariable typeVariable) {
5963 assert typeVariable.name().equals(name());
5964 this.typeVariable = typeVariable;
5965 }
5966
5967 @Override
5968 public OnnxType.TypeVariable typeVariable() {
5969 return typeVariable;
5970 }
5971 }
5972
5973 public enum InputParameter implements OnnxParameter {
5974 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
5975 ;
5976
5977 final OnnxType type;
5978 final Quantifier quantifier;
5979
5980 InputParameter(OnnxType type, Quantifier quantifier) {
5981 this.type = type;
5982 this.quantifier = quantifier;
5983 }
5984
5985 @Override
5986 public OnnxType type() {
5987 return type;
5988 }
5989
5990 @Override
5991 public Quantifier quantifier() {
5992 return quantifier;
5993 }
5994 }
5995
5996 public enum OutputParameter implements OnnxParameter {
5997 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
5998 ;
5999
6000 final OnnxType type;
6001 final Quantifier quantifier;
6002
6003 OutputParameter(OnnxType type, Quantifier quantifier) {
6004 this.type = type;
6005 this.quantifier = quantifier;
6006 }
6007
6008 @Override
6009 public OnnxType type() {
6010 return type;
6011 }
6012
6013 @Override
6014 public Quantifier quantifier() {
6015 return quantifier;
6016 }
6017 }
6018
6019 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6020 NAME,
6021 List.of(Attribute.values()),
6022 List.of(TypeConstraint.values()),
6023 List.of(InputParameter.values()),
6024 List.of(OutputParameter.values())
6025 );
6026
6027 public ConstantOfShape(ExternalizedOp def) {
6028 super(SCHEMA, def);
6029 }
6030
6031 ConstantOfShape(ConstantOfShape that, CodeContext cc) {
6032 super(that, cc);
6033 }
6034
6035 @Override
6036 public ConstantOfShape transform(CodeContext cc, CodeTransformer ot) {
6037 return new ConstantOfShape(this, cc);
6038 }
6039
6040 ConstantOfShape(CodeType resultType, Value input, java.util.Optional<Tensor> value) {
6041 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(value));
6042 }
6043
6044 @Override
6045 public SequencedSet<OnnxParameter> onnxOutputs() {
6046 return onnxOutputs(SCHEMA);
6047 }
6048
6049 @Override
6050 public SequencedMap<OnnxParameter, Object> onnxInputs() {
6051 return onnxInputs(SCHEMA, List.of(input()));
6052 }
6053
6054 public Value input() {
6055 return operands().get(0);
6056 }
6057
6058 public java.util.Optional<Tensor> value() {
6059 Tensor value = Attribute.value.access(Tensor.class, onnxAttributes);
6060 return java.util.Optional.ofNullable(value);
6061 }
6062
6063 }
6064
6065 public static ConstantOfShape ConstantOfShape(CodeType resultType, Value input, java.util.Optional<Tensor> value) {
6066 return new ConstantOfShape(resultType, input, value);
6067 }
6068
6069 @OpFactoryHelper.OpDeclaration(Conv.NAME)
6070 public static final class Conv extends OnnxOp {
6071 public static final String NAME = "Conv";
6072
6073 public enum Attribute implements OnnxAttribute {
6074 pads(long[].class, true, null),
6075 dilations(long[].class, true, null),
6076 auto_pad(String.class, true, "NOTSET"),
6077 strides(long[].class, true, null),
6078 group(Long.class, true, 1),
6079 kernel_shape(long[].class, true, null),
6080 ;
6081
6082 final Class<?> t;
6083 final boolean optional;
6084 final Object defaultValue;
6085
6086 Attribute(Class<?> type, boolean optional, Object defaultValue) {
6087 this.t = type;
6088 this.optional = optional;
6089 this.defaultValue = defaultValue;
6090 assert optional || defaultValue == null;
6091 }
6092
6093 public Class<?> type() {
6094 return t;
6095 }
6096
6097 public boolean isOptional() {
6098 return optional;
6099 }
6100
6101 public Object defaultValue() {
6102 return defaultValue;
6103 }
6104 }
6105
6106 public enum TypeConstraint implements OnnxTypeConstraint {
6107 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
6108 ;
6109
6110 final OnnxType.TypeVariable typeVariable;
6111
6112 TypeConstraint(OnnxType.TypeVariable typeVariable) {
6113 assert typeVariable.name().equals(name());
6114 this.typeVariable = typeVariable;
6115 }
6116
6117 @Override
6118 public OnnxType.TypeVariable typeVariable() {
6119 return typeVariable;
6120 }
6121 }
6122
6123 public enum InputParameter implements OnnxParameter {
6124 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6125 W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6126 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
6127 ;
6128
6129 final OnnxType type;
6130 final Quantifier quantifier;
6131
6132 InputParameter(OnnxType type, Quantifier quantifier) {
6133 this.type = type;
6134 this.quantifier = quantifier;
6135 }
6136
6137 @Override
6138 public OnnxType type() {
6139 return type;
6140 }
6141
6142 @Override
6143 public Quantifier quantifier() {
6144 return quantifier;
6145 }
6146 }
6147
6148 public enum OutputParameter implements OnnxParameter {
6149 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6150 ;
6151
6152 final OnnxType type;
6153 final Quantifier quantifier;
6154
6155 OutputParameter(OnnxType type, Quantifier quantifier) {
6156 this.type = type;
6157 this.quantifier = quantifier;
6158 }
6159
6160 @Override
6161 public OnnxType type() {
6162 return type;
6163 }
6164
6165 @Override
6166 public Quantifier quantifier() {
6167 return quantifier;
6168 }
6169 }
6170
6171 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6172 NAME,
6173 List.of(Attribute.values()),
6174 List.of(TypeConstraint.values()),
6175 List.of(InputParameter.values()),
6176 List.of(OutputParameter.values())
6177 );
6178
6179 public Conv(ExternalizedOp def) {
6180 super(SCHEMA, def);
6181 }
6182
6183 Conv(Conv that, CodeContext cc) {
6184 super(that, cc);
6185 }
6186
6187 @Override
6188 public Conv transform(CodeContext cc, CodeTransformer ot) {
6189 return new Conv(this, cc);
6190 }
6191
6192 Conv(CodeType resultType, Value X, Value W, java.util.Optional<Value> B, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
6193 super(SCHEMA, resultType, Set.of(), List.of(X, W, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape));
6194 }
6195
6196 @Override
6197 public SequencedSet<OnnxParameter> onnxOutputs() {
6198 return onnxOutputs(SCHEMA);
6199 }
6200
6201 @Override
6202 public SequencedMap<OnnxParameter, Object> onnxInputs() {
6203 return onnxInputs(SCHEMA, List.of(X(), W(), B()));
6204 }
6205
6206 public Value X() {
6207 return operands().get(0);
6208 }
6209
6210 public Value W() {
6211 return operands().get(1);
6212 }
6213
6214 public java.util.Optional<Value> B() {
6215 int i = optionalInputArguments.indexOf(InputParameter.B);
6216 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
6217 }
6218
6219 public java.util.Optional<long[]> pads() {
6220 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
6221 return java.util.Optional.ofNullable(pads).map(long[]::clone);
6222 }
6223
6224 public java.util.Optional<long[]> dilations() {
6225 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
6226 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
6227 }
6228
6229 public java.util.Optional<String> auto_pad() {
6230 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
6231 return java.util.Optional.ofNullable(auto_pad);
6232 }
6233
6234 public java.util.Optional<long[]> strides() {
6235 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
6236 return java.util.Optional.ofNullable(strides).map(long[]::clone);
6237 }
6238
6239 public java.util.Optional<Long> group() {
6240 Long group = Attribute.group.access(Long.class, onnxAttributes);
6241 return java.util.Optional.ofNullable(group);
6242 }
6243
6244 public java.util.Optional<long[]> kernel_shape() {
6245 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
6246 return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone);
6247 }
6248
6249 }
6250
6251 public static Conv Conv(CodeType resultType, Value X, Value W, java.util.Optional<Value> B, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
6252 return new Conv(resultType, X, W, B, pads, dilations, auto_pad, strides, group, kernel_shape);
6253 }
6254
6255 @OpFactoryHelper.OpDeclaration(ConvInteger.NAME)
6256 public static final class ConvInteger extends OnnxOp {
6257 public static final String NAME = "ConvInteger";
6258
6259 public enum Attribute implements OnnxAttribute {
6260 pads(long[].class, true, null),
6261 dilations(long[].class, true, null),
6262 auto_pad(String.class, true, "NOTSET"),
6263 strides(long[].class, true, null),
6264 group(Long.class, true, 1),
6265 kernel_shape(long[].class, true, null),
6266 ;
6267
6268 final Class<?> t;
6269 final boolean optional;
6270 final Object defaultValue;
6271
6272 Attribute(Class<?> type, boolean optional, Object defaultValue) {
6273 this.t = type;
6274 this.optional = optional;
6275 this.defaultValue = defaultValue;
6276 assert optional || defaultValue == null;
6277 }
6278
6279 public Class<?> type() {
6280 return t;
6281 }
6282
6283 public boolean isOptional() {
6284 return optional;
6285 }
6286
6287 public Object defaultValue() {
6288 return defaultValue;
6289 }
6290 }
6291
6292 public enum TypeConstraint implements OnnxTypeConstraint {
6293 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
6294 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
6295 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int32())))),
6296 ;
6297
6298 final OnnxType.TypeVariable typeVariable;
6299
6300 TypeConstraint(OnnxType.TypeVariable typeVariable) {
6301 assert typeVariable.name().equals(name());
6302 this.typeVariable = typeVariable;
6303 }
6304
6305 @Override
6306 public OnnxType.TypeVariable typeVariable() {
6307 return typeVariable;
6308 }
6309 }
6310
6311 public enum InputParameter implements OnnxParameter {
6312 x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
6313 w(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
6314 x_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
6315 w_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
6316 ;
6317
6318 final OnnxType type;
6319 final Quantifier quantifier;
6320
6321 InputParameter(OnnxType type, Quantifier quantifier) {
6322 this.type = type;
6323 this.quantifier = quantifier;
6324 }
6325
6326 @Override
6327 public OnnxType type() {
6328 return type;
6329 }
6330
6331 @Override
6332 public Quantifier quantifier() {
6333 return quantifier;
6334 }
6335 }
6336
6337 public enum OutputParameter implements OnnxParameter {
6338 y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
6339 ;
6340
6341 final OnnxType type;
6342 final Quantifier quantifier;
6343
6344 OutputParameter(OnnxType type, Quantifier quantifier) {
6345 this.type = type;
6346 this.quantifier = quantifier;
6347 }
6348
6349 @Override
6350 public OnnxType type() {
6351 return type;
6352 }
6353
6354 @Override
6355 public Quantifier quantifier() {
6356 return quantifier;
6357 }
6358 }
6359
6360 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6361 NAME,
6362 List.of(Attribute.values()),
6363 List.of(TypeConstraint.values()),
6364 List.of(InputParameter.values()),
6365 List.of(OutputParameter.values())
6366 );
6367
6368 public ConvInteger(ExternalizedOp def) {
6369 super(SCHEMA, def);
6370 }
6371
6372 ConvInteger(ConvInteger that, CodeContext cc) {
6373 super(that, cc);
6374 }
6375
6376 @Override
6377 public ConvInteger transform(CodeContext cc, CodeTransformer ot) {
6378 return new ConvInteger(this, cc);
6379 }
6380
6381 ConvInteger(CodeType resultType, Value x, Value w, java.util.Optional<Value> x_zero_point, java.util.Optional<Value> w_zero_point, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
6382 super(SCHEMA, resultType, Set.of(), List.of(x, w, x_zero_point, w_zero_point), List.of(pads, dilations, auto_pad, strides, group, kernel_shape));
6383 }
6384
6385 @Override
6386 public SequencedSet<OnnxParameter> onnxOutputs() {
6387 return onnxOutputs(SCHEMA);
6388 }
6389
6390 @Override
6391 public SequencedMap<OnnxParameter, Object> onnxInputs() {
6392 return onnxInputs(SCHEMA, List.of(x(), w(), x_zero_point(), w_zero_point()));
6393 }
6394
6395 public Value x() {
6396 return operands().get(0);
6397 }
6398
6399 public Value w() {
6400 return operands().get(1);
6401 }
6402
6403 public java.util.Optional<Value> x_zero_point() {
6404 int i = optionalInputArguments.indexOf(InputParameter.x_zero_point);
6405 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
6406 }
6407
6408 public java.util.Optional<Value> w_zero_point() {
6409 int i = optionalInputArguments.indexOf(InputParameter.w_zero_point);
6410 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
6411 }
6412
6413 public java.util.Optional<long[]> pads() {
6414 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
6415 return java.util.Optional.ofNullable(pads).map(long[]::clone);
6416 }
6417
6418 public java.util.Optional<long[]> dilations() {
6419 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
6420 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
6421 }
6422
6423 public java.util.Optional<String> auto_pad() {
6424 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
6425 return java.util.Optional.ofNullable(auto_pad);
6426 }
6427
6428 public java.util.Optional<long[]> strides() {
6429 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
6430 return java.util.Optional.ofNullable(strides).map(long[]::clone);
6431 }
6432
6433 public java.util.Optional<Long> group() {
6434 Long group = Attribute.group.access(Long.class, onnxAttributes);
6435 return java.util.Optional.ofNullable(group);
6436 }
6437
6438 public java.util.Optional<long[]> kernel_shape() {
6439 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
6440 return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone);
6441 }
6442
6443 }
6444
6445 public static ConvInteger ConvInteger(CodeType resultType, Value x, Value w, java.util.Optional<Value> x_zero_point, java.util.Optional<Value> w_zero_point, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
6446 return new ConvInteger(resultType, x, w, x_zero_point, w_zero_point, pads, dilations, auto_pad, strides, group, kernel_shape);
6447 }
6448
6449 @OpFactoryHelper.OpDeclaration(ConvTranspose.NAME)
6450 public static final class ConvTranspose extends OnnxOp {
6451 public static final String NAME = "ConvTranspose";
6452
6453 public enum Attribute implements OnnxAttribute {
6454 output_shape(long[].class, true, null),
6455 pads(long[].class, true, null),
6456 dilations(long[].class, true, null),
6457 auto_pad(String.class, true, "NOTSET"),
6458 strides(long[].class, true, null),
6459 group(Long.class, true, 1),
6460 kernel_shape(long[].class, true, null),
6461 output_padding(long[].class, true, null),
6462 ;
6463
6464 final Class<?> t;
6465 final boolean optional;
6466 final Object defaultValue;
6467
6468 Attribute(Class<?> type, boolean optional, Object defaultValue) {
6469 this.t = type;
6470 this.optional = optional;
6471 this.defaultValue = defaultValue;
6472 assert optional || defaultValue == null;
6473 }
6474
6475 public Class<?> type() {
6476 return t;
6477 }
6478
6479 public boolean isOptional() {
6480 return optional;
6481 }
6482
6483 public Object defaultValue() {
6484 return defaultValue;
6485 }
6486 }
6487
6488 public enum TypeConstraint implements OnnxTypeConstraint {
6489 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
6490 ;
6491
6492 final OnnxType.TypeVariable typeVariable;
6493
6494 TypeConstraint(OnnxType.TypeVariable typeVariable) {
6495 assert typeVariable.name().equals(name());
6496 this.typeVariable = typeVariable;
6497 }
6498
6499 @Override
6500 public OnnxType.TypeVariable typeVariable() {
6501 return typeVariable;
6502 }
6503 }
6504
6505 public enum InputParameter implements OnnxParameter {
6506 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6507 W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6508 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
6509 ;
6510
6511 final OnnxType type;
6512 final Quantifier quantifier;
6513
6514 InputParameter(OnnxType type, Quantifier quantifier) {
6515 this.type = type;
6516 this.quantifier = quantifier;
6517 }
6518
6519 @Override
6520 public OnnxType type() {
6521 return type;
6522 }
6523
6524 @Override
6525 public Quantifier quantifier() {
6526 return quantifier;
6527 }
6528 }
6529
6530 public enum OutputParameter implements OnnxParameter {
6531 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6532 ;
6533
6534 final OnnxType type;
6535 final Quantifier quantifier;
6536
6537 OutputParameter(OnnxType type, Quantifier quantifier) {
6538 this.type = type;
6539 this.quantifier = quantifier;
6540 }
6541
6542 @Override
6543 public OnnxType type() {
6544 return type;
6545 }
6546
6547 @Override
6548 public Quantifier quantifier() {
6549 return quantifier;
6550 }
6551 }
6552
6553 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6554 NAME,
6555 List.of(Attribute.values()),
6556 List.of(TypeConstraint.values()),
6557 List.of(InputParameter.values()),
6558 List.of(OutputParameter.values())
6559 );
6560
6561 public ConvTranspose(ExternalizedOp def) {
6562 super(SCHEMA, def);
6563 }
6564
6565 ConvTranspose(ConvTranspose that, CodeContext cc) {
6566 super(that, cc);
6567 }
6568
6569 @Override
6570 public ConvTranspose transform(CodeContext cc, CodeTransformer ot) {
6571 return new ConvTranspose(this, cc);
6572 }
6573
6574 ConvTranspose(CodeType resultType, Value X, Value W, java.util.Optional<Value> B, java.util.Optional<long[]> output_shape, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape, java.util.Optional<long[]> output_padding) {
6575 super(SCHEMA, resultType, Set.of(), List.of(X, W, B), List.of(output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding));
6576 }
6577
6578 @Override
6579 public SequencedSet<OnnxParameter> onnxOutputs() {
6580 return onnxOutputs(SCHEMA);
6581 }
6582
6583 @Override
6584 public SequencedMap<OnnxParameter, Object> onnxInputs() {
6585 return onnxInputs(SCHEMA, List.of(X(), W(), B()));
6586 }
6587
6588 public Value X() {
6589 return operands().get(0);
6590 }
6591
6592 public Value W() {
6593 return operands().get(1);
6594 }
6595
6596 public java.util.Optional<Value> B() {
6597 int i = optionalInputArguments.indexOf(InputParameter.B);
6598 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
6599 }
6600
6601 public java.util.Optional<long[]> output_shape() {
6602 long[] output_shape = Attribute.output_shape.access(long[].class, onnxAttributes);
6603 return java.util.Optional.ofNullable(output_shape).map(long[]::clone);
6604 }
6605
6606 public java.util.Optional<long[]> pads() {
6607 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
6608 return java.util.Optional.ofNullable(pads).map(long[]::clone);
6609 }
6610
6611 public java.util.Optional<long[]> dilations() {
6612 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
6613 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
6614 }
6615
6616 public java.util.Optional<String> auto_pad() {
6617 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
6618 return java.util.Optional.ofNullable(auto_pad);
6619 }
6620
6621 public java.util.Optional<long[]> strides() {
6622 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
6623 return java.util.Optional.ofNullable(strides).map(long[]::clone);
6624 }
6625
6626 public java.util.Optional<Long> group() {
6627 Long group = Attribute.group.access(Long.class, onnxAttributes);
6628 return java.util.Optional.ofNullable(group);
6629 }
6630
6631 public java.util.Optional<long[]> kernel_shape() {
6632 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
6633 return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone);
6634 }
6635
6636 public java.util.Optional<long[]> output_padding() {
6637 long[] output_padding = Attribute.output_padding.access(long[].class, onnxAttributes);
6638 return java.util.Optional.ofNullable(output_padding).map(long[]::clone);
6639 }
6640
6641 }
6642
6643 public static ConvTranspose ConvTranspose(CodeType resultType, Value X, Value W, java.util.Optional<Value> B, java.util.Optional<long[]> output_shape, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape, java.util.Optional<long[]> output_padding) {
6644 return new ConvTranspose(resultType, X, W, B, output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding);
6645 }
6646
6647 @OpFactoryHelper.OpDeclaration(Cos.NAME)
6648 public static final class Cos extends OnnxOp {
6649 public static final String NAME = "Cos";
6650
6651 public enum Attribute implements OnnxAttribute.None { }
6652
6653 public enum TypeConstraint implements OnnxTypeConstraint {
6654 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
6655 ;
6656
6657 final OnnxType.TypeVariable typeVariable;
6658
6659 TypeConstraint(OnnxType.TypeVariable typeVariable) {
6660 assert typeVariable.name().equals(name());
6661 this.typeVariable = typeVariable;
6662 }
6663
6664 @Override
6665 public OnnxType.TypeVariable typeVariable() {
6666 return typeVariable;
6667 }
6668 }
6669
6670 public enum InputParameter implements OnnxParameter {
6671 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6672 ;
6673
6674 final OnnxType type;
6675 final Quantifier quantifier;
6676
6677 InputParameter(OnnxType type, Quantifier quantifier) {
6678 this.type = type;
6679 this.quantifier = quantifier;
6680 }
6681
6682 @Override
6683 public OnnxType type() {
6684 return type;
6685 }
6686
6687 @Override
6688 public Quantifier quantifier() {
6689 return quantifier;
6690 }
6691 }
6692
6693 public enum OutputParameter implements OnnxParameter {
6694 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6695 ;
6696
6697 final OnnxType type;
6698 final Quantifier quantifier;
6699
6700 OutputParameter(OnnxType type, Quantifier quantifier) {
6701 this.type = type;
6702 this.quantifier = quantifier;
6703 }
6704
6705 @Override
6706 public OnnxType type() {
6707 return type;
6708 }
6709
6710 @Override
6711 public Quantifier quantifier() {
6712 return quantifier;
6713 }
6714 }
6715
6716 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6717 NAME,
6718 List.of(Attribute.values()),
6719 List.of(TypeConstraint.values()),
6720 List.of(InputParameter.values()),
6721 List.of(OutputParameter.values())
6722 );
6723
6724 public Cos(ExternalizedOp def) {
6725 super(SCHEMA, def);
6726 }
6727
6728 Cos(Cos that, CodeContext cc) {
6729 super(that, cc);
6730 }
6731
6732 @Override
6733 public Cos transform(CodeContext cc, CodeTransformer ot) {
6734 return new Cos(this, cc);
6735 }
6736
6737 Cos(CodeType resultType, Value input) {
6738 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
6739 }
6740
6741 @Override
6742 public SequencedSet<OnnxParameter> onnxOutputs() {
6743 return onnxOutputs(SCHEMA);
6744 }
6745
6746 @Override
6747 public SequencedMap<OnnxParameter, Object> onnxInputs() {
6748 return onnxInputs(SCHEMA, List.of(input()));
6749 }
6750
6751 public Value input() {
6752 return operands().get(0);
6753 }
6754
6755 }
6756
6757 public static Cos Cos(CodeType resultType, Value input) {
6758 return new Cos(resultType, input);
6759 }
6760
6761 @OpFactoryHelper.OpDeclaration(Cosh.NAME)
6762 public static final class Cosh extends OnnxOp {
6763 public static final String NAME = "Cosh";
6764
6765 public enum Attribute implements OnnxAttribute.None { }
6766
6767 public enum TypeConstraint implements OnnxTypeConstraint {
6768 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
6769 ;
6770
6771 final OnnxType.TypeVariable typeVariable;
6772
6773 TypeConstraint(OnnxType.TypeVariable typeVariable) {
6774 assert typeVariable.name().equals(name());
6775 this.typeVariable = typeVariable;
6776 }
6777
6778 @Override
6779 public OnnxType.TypeVariable typeVariable() {
6780 return typeVariable;
6781 }
6782 }
6783
6784 public enum InputParameter implements OnnxParameter {
6785 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6786 ;
6787
6788 final OnnxType type;
6789 final Quantifier quantifier;
6790
6791 InputParameter(OnnxType type, Quantifier quantifier) {
6792 this.type = type;
6793 this.quantifier = quantifier;
6794 }
6795
6796 @Override
6797 public OnnxType type() {
6798 return type;
6799 }
6800
6801 @Override
6802 public Quantifier quantifier() {
6803 return quantifier;
6804 }
6805 }
6806
6807 public enum OutputParameter implements OnnxParameter {
6808 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6809 ;
6810
6811 final OnnxType type;
6812 final Quantifier quantifier;
6813
6814 OutputParameter(OnnxType type, Quantifier quantifier) {
6815 this.type = type;
6816 this.quantifier = quantifier;
6817 }
6818
6819 @Override
6820 public OnnxType type() {
6821 return type;
6822 }
6823
6824 @Override
6825 public Quantifier quantifier() {
6826 return quantifier;
6827 }
6828 }
6829
6830 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6831 NAME,
6832 List.of(Attribute.values()),
6833 List.of(TypeConstraint.values()),
6834 List.of(InputParameter.values()),
6835 List.of(OutputParameter.values())
6836 );
6837
6838 public Cosh(ExternalizedOp def) {
6839 super(SCHEMA, def);
6840 }
6841
6842 Cosh(Cosh that, CodeContext cc) {
6843 super(that, cc);
6844 }
6845
6846 @Override
6847 public Cosh transform(CodeContext cc, CodeTransformer ot) {
6848 return new Cosh(this, cc);
6849 }
6850
6851 Cosh(CodeType resultType, Value input) {
6852 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
6853 }
6854
6855 @Override
6856 public SequencedSet<OnnxParameter> onnxOutputs() {
6857 return onnxOutputs(SCHEMA);
6858 }
6859
6860 @Override
6861 public SequencedMap<OnnxParameter, Object> onnxInputs() {
6862 return onnxInputs(SCHEMA, List.of(input()));
6863 }
6864
6865 public Value input() {
6866 return operands().get(0);
6867 }
6868
6869 }
6870
6871 public static Cosh Cosh(CodeType resultType, Value input) {
6872 return new Cosh(resultType, input);
6873 }
6874
6875 @OpFactoryHelper.OpDeclaration(CumProd.NAME)
6876 public static final class CumProd extends OnnxOp {
6877 public static final String NAME = "CumProd";
6878
6879 public enum Attribute implements OnnxAttribute {
6880 exclusive(Long.class, true, 0),
6881 reverse(Long.class, true, 0),
6882 ;
6883
6884 final Class<?> t;
6885 final boolean optional;
6886 final Object defaultValue;
6887
6888 Attribute(Class<?> type, boolean optional, Object defaultValue) {
6889 this.t = type;
6890 this.optional = optional;
6891 this.defaultValue = defaultValue;
6892 assert optional || defaultValue == null;
6893 }
6894
6895 public Class<?> type() {
6896 return t;
6897 }
6898
6899 public boolean isOptional() {
6900 return optional;
6901 }
6902
6903 public Object defaultValue() {
6904 return defaultValue;
6905 }
6906 }
6907
6908 public enum TypeConstraint implements OnnxTypeConstraint {
6909 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
6910 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
6911 ;
6912
6913 final OnnxType.TypeVariable typeVariable;
6914
6915 TypeConstraint(OnnxType.TypeVariable typeVariable) {
6916 assert typeVariable.name().equals(name());
6917 this.typeVariable = typeVariable;
6918 }
6919
6920 @Override
6921 public OnnxType.TypeVariable typeVariable() {
6922 return typeVariable;
6923 }
6924 }
6925
6926 public enum InputParameter implements OnnxParameter {
6927 x(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6928 axis(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
6929 ;
6930
6931 final OnnxType type;
6932 final Quantifier quantifier;
6933
6934 InputParameter(OnnxType type, Quantifier quantifier) {
6935 this.type = type;
6936 this.quantifier = quantifier;
6937 }
6938
6939 @Override
6940 public OnnxType type() {
6941 return type;
6942 }
6943
6944 @Override
6945 public Quantifier quantifier() {
6946 return quantifier;
6947 }
6948 }
6949
6950 public enum OutputParameter implements OnnxParameter {
6951 y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
6952 ;
6953
6954 final OnnxType type;
6955 final Quantifier quantifier;
6956
6957 OutputParameter(OnnxType type, Quantifier quantifier) {
6958 this.type = type;
6959 this.quantifier = quantifier;
6960 }
6961
6962 @Override
6963 public OnnxType type() {
6964 return type;
6965 }
6966
6967 @Override
6968 public Quantifier quantifier() {
6969 return quantifier;
6970 }
6971 }
6972
6973 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
6974 NAME,
6975 List.of(Attribute.values()),
6976 List.of(TypeConstraint.values()),
6977 List.of(InputParameter.values()),
6978 List.of(OutputParameter.values())
6979 );
6980
6981 public CumProd(ExternalizedOp def) {
6982 super(SCHEMA, def);
6983 }
6984
6985 CumProd(CumProd that, CodeContext cc) {
6986 super(that, cc);
6987 }
6988
6989 @Override
6990 public CumProd transform(CodeContext cc, CodeTransformer ot) {
6991 return new CumProd(this, cc);
6992 }
6993
6994 CumProd(CodeType resultType, Value x, Value axis, java.util.Optional<Long> exclusive, java.util.Optional<Long> reverse) {
6995 super(SCHEMA, resultType, Set.of(), List.of(x, axis), List.of(exclusive, reverse));
6996 }
6997
6998 @Override
6999 public SequencedSet<OnnxParameter> onnxOutputs() {
7000 return onnxOutputs(SCHEMA);
7001 }
7002
7003 @Override
7004 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7005 return onnxInputs(SCHEMA, List.of(x(), axis()));
7006 }
7007
7008 public Value x() {
7009 return operands().get(0);
7010 }
7011
7012 public Value axis() {
7013 return operands().get(1);
7014 }
7015
7016 public java.util.Optional<Long> exclusive() {
7017 Long exclusive = Attribute.exclusive.access(Long.class, onnxAttributes);
7018 return java.util.Optional.ofNullable(exclusive);
7019 }
7020
7021 public java.util.Optional<Long> reverse() {
7022 Long reverse = Attribute.reverse.access(Long.class, onnxAttributes);
7023 return java.util.Optional.ofNullable(reverse);
7024 }
7025
7026 }
7027
7028 public static CumProd CumProd(CodeType resultType, Value x, Value axis, java.util.Optional<Long> exclusive, java.util.Optional<Long> reverse) {
7029 return new CumProd(resultType, x, axis, exclusive, reverse);
7030 }
7031
7032 @OpFactoryHelper.OpDeclaration(CumSum.NAME)
7033 public static final class CumSum extends OnnxOp {
7034 public static final String NAME = "CumSum";
7035
7036 public enum Attribute implements OnnxAttribute {
7037 exclusive(Long.class, true, 0),
7038 reverse(Long.class, true, 0),
7039 ;
7040
7041 final Class<?> t;
7042 final boolean optional;
7043 final Object defaultValue;
7044
7045 Attribute(Class<?> type, boolean optional, Object defaultValue) {
7046 this.t = type;
7047 this.optional = optional;
7048 this.defaultValue = defaultValue;
7049 assert optional || defaultValue == null;
7050 }
7051
7052 public Class<?> type() {
7053 return t;
7054 }
7055
7056 public boolean isOptional() {
7057 return optional;
7058 }
7059
7060 public Object defaultValue() {
7061 return defaultValue;
7062 }
7063 }
7064
7065 public enum TypeConstraint implements OnnxTypeConstraint {
7066 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
7067 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
7068 ;
7069
7070 final OnnxType.TypeVariable typeVariable;
7071
7072 TypeConstraint(OnnxType.TypeVariable typeVariable) {
7073 assert typeVariable.name().equals(name());
7074 this.typeVariable = typeVariable;
7075 }
7076
7077 @Override
7078 public OnnxType.TypeVariable typeVariable() {
7079 return typeVariable;
7080 }
7081 }
7082
7083 public enum InputParameter implements OnnxParameter {
7084 x(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7085 axis(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
7086 ;
7087
7088 final OnnxType type;
7089 final Quantifier quantifier;
7090
7091 InputParameter(OnnxType type, Quantifier quantifier) {
7092 this.type = type;
7093 this.quantifier = quantifier;
7094 }
7095
7096 @Override
7097 public OnnxType type() {
7098 return type;
7099 }
7100
7101 @Override
7102 public Quantifier quantifier() {
7103 return quantifier;
7104 }
7105 }
7106
7107 public enum OutputParameter implements OnnxParameter {
7108 y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7109 ;
7110
7111 final OnnxType type;
7112 final Quantifier quantifier;
7113
7114 OutputParameter(OnnxType type, Quantifier quantifier) {
7115 this.type = type;
7116 this.quantifier = quantifier;
7117 }
7118
7119 @Override
7120 public OnnxType type() {
7121 return type;
7122 }
7123
7124 @Override
7125 public Quantifier quantifier() {
7126 return quantifier;
7127 }
7128 }
7129
7130 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
7131 NAME,
7132 List.of(Attribute.values()),
7133 List.of(TypeConstraint.values()),
7134 List.of(InputParameter.values()),
7135 List.of(OutputParameter.values())
7136 );
7137
7138 public CumSum(ExternalizedOp def) {
7139 super(SCHEMA, def);
7140 }
7141
7142 CumSum(CumSum that, CodeContext cc) {
7143 super(that, cc);
7144 }
7145
7146 @Override
7147 public CumSum transform(CodeContext cc, CodeTransformer ot) {
7148 return new CumSum(this, cc);
7149 }
7150
7151 CumSum(CodeType resultType, Value x, Value axis, java.util.Optional<Long> exclusive, java.util.Optional<Long> reverse) {
7152 super(SCHEMA, resultType, Set.of(), List.of(x, axis), List.of(exclusive, reverse));
7153 }
7154
7155 @Override
7156 public SequencedSet<OnnxParameter> onnxOutputs() {
7157 return onnxOutputs(SCHEMA);
7158 }
7159
7160 @Override
7161 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7162 return onnxInputs(SCHEMA, List.of(x(), axis()));
7163 }
7164
7165 public Value x() {
7166 return operands().get(0);
7167 }
7168
7169 public Value axis() {
7170 return operands().get(1);
7171 }
7172
7173 public java.util.Optional<Long> exclusive() {
7174 Long exclusive = Attribute.exclusive.access(Long.class, onnxAttributes);
7175 return java.util.Optional.ofNullable(exclusive);
7176 }
7177
7178 public java.util.Optional<Long> reverse() {
7179 Long reverse = Attribute.reverse.access(Long.class, onnxAttributes);
7180 return java.util.Optional.ofNullable(reverse);
7181 }
7182
7183 }
7184
7185 public static CumSum CumSum(CodeType resultType, Value x, Value axis, java.util.Optional<Long> exclusive, java.util.Optional<Long> reverse) {
7186 return new CumSum(resultType, x, axis, exclusive, reverse);
7187 }
7188
7189 @OpFactoryHelper.OpDeclaration(DFT.NAME)
7190 public static final class DFT extends OnnxOp {
7191 public static final String NAME = "DFT";
7192
7193 public enum Attribute implements OnnxAttribute {
7194 inverse(Long.class, true, 0),
7195 onesided(Long.class, true, 0),
7196 ;
7197
7198 final Class<?> t;
7199 final boolean optional;
7200 final Object defaultValue;
7201
7202 Attribute(Class<?> type, boolean optional, Object defaultValue) {
7203 this.t = type;
7204 this.optional = optional;
7205 this.defaultValue = defaultValue;
7206 assert optional || defaultValue == null;
7207 }
7208
7209 public Class<?> type() {
7210 return t;
7211 }
7212
7213 public boolean isOptional() {
7214 return optional;
7215 }
7216
7217 public Object defaultValue() {
7218 return defaultValue;
7219 }
7220 }
7221
7222 public enum TypeConstraint implements OnnxTypeConstraint {
7223 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
7224 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
7225 ;
7226
7227 final OnnxType.TypeVariable typeVariable;
7228
7229 TypeConstraint(OnnxType.TypeVariable typeVariable) {
7230 assert typeVariable.name().equals(name());
7231 this.typeVariable = typeVariable;
7232 }
7233
7234 @Override
7235 public OnnxType.TypeVariable typeVariable() {
7236 return typeVariable;
7237 }
7238 }
7239
7240 public enum InputParameter implements OnnxParameter {
7241 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
7242 dft_length(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
7243 axis(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
7244 ;
7245
7246 final OnnxType type;
7247 final Quantifier quantifier;
7248
7249 InputParameter(OnnxType type, Quantifier quantifier) {
7250 this.type = type;
7251 this.quantifier = quantifier;
7252 }
7253
7254 @Override
7255 public OnnxType type() {
7256 return type;
7257 }
7258
7259 @Override
7260 public Quantifier quantifier() {
7261 return quantifier;
7262 }
7263 }
7264
7265 public enum OutputParameter implements OnnxParameter {
7266 output(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
7267 ;
7268
7269 final OnnxType type;
7270 final Quantifier quantifier;
7271
7272 OutputParameter(OnnxType type, Quantifier quantifier) {
7273 this.type = type;
7274 this.quantifier = quantifier;
7275 }
7276
7277 @Override
7278 public OnnxType type() {
7279 return type;
7280 }
7281
7282 @Override
7283 public Quantifier quantifier() {
7284 return quantifier;
7285 }
7286 }
7287
7288 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
7289 NAME,
7290 List.of(Attribute.values()),
7291 List.of(TypeConstraint.values()),
7292 List.of(InputParameter.values()),
7293 List.of(OutputParameter.values())
7294 );
7295
7296 public DFT(ExternalizedOp def) {
7297 super(SCHEMA, def);
7298 }
7299
7300 DFT(DFT that, CodeContext cc) {
7301 super(that, cc);
7302 }
7303
7304 @Override
7305 public DFT transform(CodeContext cc, CodeTransformer ot) {
7306 return new DFT(this, cc);
7307 }
7308
7309 DFT(CodeType resultType, Value input, java.util.Optional<Value> dft_length, java.util.Optional<Value> axis, java.util.Optional<Long> inverse, java.util.Optional<Long> onesided) {
7310 super(SCHEMA, resultType, Set.of(), List.of(input, dft_length, axis), List.of(inverse, onesided));
7311 }
7312
7313 @Override
7314 public SequencedSet<OnnxParameter> onnxOutputs() {
7315 return onnxOutputs(SCHEMA);
7316 }
7317
7318 @Override
7319 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7320 return onnxInputs(SCHEMA, List.of(input(), dft_length(), axis()));
7321 }
7322
7323 public Value input() {
7324 return operands().get(0);
7325 }
7326
7327 public java.util.Optional<Value> dft_length() {
7328 int i = optionalInputArguments.indexOf(InputParameter.dft_length);
7329 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
7330 }
7331
7332 public java.util.Optional<Value> axis() {
7333 int i = optionalInputArguments.indexOf(InputParameter.axis);
7334 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
7335 }
7336
7337 public java.util.Optional<Long> inverse() {
7338 Long inverse = Attribute.inverse.access(Long.class, onnxAttributes);
7339 return java.util.Optional.ofNullable(inverse);
7340 }
7341
7342 public java.util.Optional<Long> onesided() {
7343 Long onesided = Attribute.onesided.access(Long.class, onnxAttributes);
7344 return java.util.Optional.ofNullable(onesided);
7345 }
7346
7347 }
7348
7349 public static DFT DFT(CodeType resultType, Value input, java.util.Optional<Value> dft_length, java.util.Optional<Value> axis, java.util.Optional<Long> inverse, java.util.Optional<Long> onesided) {
7350 return new DFT(resultType, input, dft_length, axis, inverse, onesided);
7351 }
7352
7353 @OpFactoryHelper.OpDeclaration(DeformConv.NAME)
7354 public static final class DeformConv extends OnnxOp {
7355 public static final String NAME = "DeformConv";
7356
7357 public enum Attribute implements OnnxAttribute {
7358 pads(long[].class, true, null),
7359 dilations(long[].class, true, null),
7360 strides(long[].class, true, null),
7361 offset_group(Long.class, true, 1),
7362 group(Long.class, true, 1),
7363 kernel_shape(long[].class, true, null),
7364 ;
7365
7366 final Class<?> t;
7367 final boolean optional;
7368 final Object defaultValue;
7369
7370 Attribute(Class<?> type, boolean optional, Object defaultValue) {
7371 this.t = type;
7372 this.optional = optional;
7373 this.defaultValue = defaultValue;
7374 assert optional || defaultValue == null;
7375 }
7376
7377 public Class<?> type() {
7378 return t;
7379 }
7380
7381 public boolean isOptional() {
7382 return optional;
7383 }
7384
7385 public Object defaultValue() {
7386 return defaultValue;
7387 }
7388 }
7389
7390 public enum TypeConstraint implements OnnxTypeConstraint {
7391 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
7392 ;
7393
7394 final OnnxType.TypeVariable typeVariable;
7395
7396 TypeConstraint(OnnxType.TypeVariable typeVariable) {
7397 assert typeVariable.name().equals(name());
7398 this.typeVariable = typeVariable;
7399 }
7400
7401 @Override
7402 public OnnxType.TypeVariable typeVariable() {
7403 return typeVariable;
7404 }
7405 }
7406
7407 public enum InputParameter implements OnnxParameter {
7408 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7409 W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7410 offset(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7411 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
7412 mask(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
7413 ;
7414
7415 final OnnxType type;
7416 final Quantifier quantifier;
7417
7418 InputParameter(OnnxType type, Quantifier quantifier) {
7419 this.type = type;
7420 this.quantifier = quantifier;
7421 }
7422
7423 @Override
7424 public OnnxType type() {
7425 return type;
7426 }
7427
7428 @Override
7429 public Quantifier quantifier() {
7430 return quantifier;
7431 }
7432 }
7433
7434 public enum OutputParameter implements OnnxParameter {
7435 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7436 ;
7437
7438 final OnnxType type;
7439 final Quantifier quantifier;
7440
7441 OutputParameter(OnnxType type, Quantifier quantifier) {
7442 this.type = type;
7443 this.quantifier = quantifier;
7444 }
7445
7446 @Override
7447 public OnnxType type() {
7448 return type;
7449 }
7450
7451 @Override
7452 public Quantifier quantifier() {
7453 return quantifier;
7454 }
7455 }
7456
7457 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
7458 NAME,
7459 List.of(Attribute.values()),
7460 List.of(TypeConstraint.values()),
7461 List.of(InputParameter.values()),
7462 List.of(OutputParameter.values())
7463 );
7464
7465 public DeformConv(ExternalizedOp def) {
7466 super(SCHEMA, def);
7467 }
7468
7469 DeformConv(DeformConv that, CodeContext cc) {
7470 super(that, cc);
7471 }
7472
7473 @Override
7474 public DeformConv transform(CodeContext cc, CodeTransformer ot) {
7475 return new DeformConv(this, cc);
7476 }
7477
7478 DeformConv(CodeType resultType, Value X, Value W, Value offset, java.util.Optional<Value> B, java.util.Optional<Value> mask, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<long[]> strides, java.util.Optional<Long> offset_group, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
7479 super(SCHEMA, resultType, Set.of(), List.of(X, W, offset, B, mask), List.of(pads, dilations, strides, offset_group, group, kernel_shape));
7480 }
7481
7482 @Override
7483 public SequencedSet<OnnxParameter> onnxOutputs() {
7484 return onnxOutputs(SCHEMA);
7485 }
7486
7487 @Override
7488 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7489 return onnxInputs(SCHEMA, List.of(X(), W(), offset(), B(), mask()));
7490 }
7491
7492 public Value X() {
7493 return operands().get(0);
7494 }
7495
7496 public Value W() {
7497 return operands().get(1);
7498 }
7499
7500 public Value offset() {
7501 return operands().get(2);
7502 }
7503
7504 public java.util.Optional<Value> B() {
7505 int i = optionalInputArguments.indexOf(InputParameter.B);
7506 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
7507 }
7508
7509 public java.util.Optional<Value> mask() {
7510 int i = optionalInputArguments.indexOf(InputParameter.mask);
7511 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
7512 }
7513
7514 public java.util.Optional<long[]> pads() {
7515 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
7516 return java.util.Optional.ofNullable(pads).map(long[]::clone);
7517 }
7518
7519 public java.util.Optional<long[]> dilations() {
7520 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
7521 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
7522 }
7523
7524 public java.util.Optional<long[]> strides() {
7525 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
7526 return java.util.Optional.ofNullable(strides).map(long[]::clone);
7527 }
7528
7529 public java.util.Optional<Long> offset_group() {
7530 Long offset_group = Attribute.offset_group.access(Long.class, onnxAttributes);
7531 return java.util.Optional.ofNullable(offset_group);
7532 }
7533
7534 public java.util.Optional<Long> group() {
7535 Long group = Attribute.group.access(Long.class, onnxAttributes);
7536 return java.util.Optional.ofNullable(group);
7537 }
7538
7539 public java.util.Optional<long[]> kernel_shape() {
7540 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
7541 return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone);
7542 }
7543
7544 }
7545
7546 public static DeformConv DeformConv(CodeType resultType, Value X, Value W, Value offset, java.util.Optional<Value> B, java.util.Optional<Value> mask, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<long[]> strides, java.util.Optional<Long> offset_group, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
7547 return new DeformConv(resultType, X, W, offset, B, mask, pads, dilations, strides, offset_group, group, kernel_shape);
7548 }
7549
7550 @OpFactoryHelper.OpDeclaration(DepthToSpace.NAME)
7551 public static final class DepthToSpace extends OnnxOp {
7552 public static final String NAME = "DepthToSpace";
7553
7554 public enum Attribute implements OnnxAttribute {
7555 mode(String.class, true, "DCR"),
7556 blocksize(Long.class, false, null),
7557 ;
7558
7559 final Class<?> t;
7560 final boolean optional;
7561 final Object defaultValue;
7562
7563 Attribute(Class<?> type, boolean optional, Object defaultValue) {
7564 this.t = type;
7565 this.optional = optional;
7566 this.defaultValue = defaultValue;
7567 assert optional || defaultValue == null;
7568 }
7569
7570 public Class<?> type() {
7571 return t;
7572 }
7573
7574 public boolean isOptional() {
7575 return optional;
7576 }
7577
7578 public Object defaultValue() {
7579 return defaultValue;
7580 }
7581 }
7582
7583 public enum TypeConstraint implements OnnxTypeConstraint {
7584 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
7585 ;
7586
7587 final OnnxType.TypeVariable typeVariable;
7588
7589 TypeConstraint(OnnxType.TypeVariable typeVariable) {
7590 assert typeVariable.name().equals(name());
7591 this.typeVariable = typeVariable;
7592 }
7593
7594 @Override
7595 public OnnxType.TypeVariable typeVariable() {
7596 return typeVariable;
7597 }
7598 }
7599
7600 public enum InputParameter implements OnnxParameter {
7601 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7602 ;
7603
7604 final OnnxType type;
7605 final Quantifier quantifier;
7606
7607 InputParameter(OnnxType type, Quantifier quantifier) {
7608 this.type = type;
7609 this.quantifier = quantifier;
7610 }
7611
7612 @Override
7613 public OnnxType type() {
7614 return type;
7615 }
7616
7617 @Override
7618 public Quantifier quantifier() {
7619 return quantifier;
7620 }
7621 }
7622
7623 public enum OutputParameter implements OnnxParameter {
7624 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7625 ;
7626
7627 final OnnxType type;
7628 final Quantifier quantifier;
7629
7630 OutputParameter(OnnxType type, Quantifier quantifier) {
7631 this.type = type;
7632 this.quantifier = quantifier;
7633 }
7634
7635 @Override
7636 public OnnxType type() {
7637 return type;
7638 }
7639
7640 @Override
7641 public Quantifier quantifier() {
7642 return quantifier;
7643 }
7644 }
7645
7646 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
7647 NAME,
7648 List.of(Attribute.values()),
7649 List.of(TypeConstraint.values()),
7650 List.of(InputParameter.values()),
7651 List.of(OutputParameter.values())
7652 );
7653
7654 public DepthToSpace(ExternalizedOp def) {
7655 super(SCHEMA, def);
7656 }
7657
7658 DepthToSpace(DepthToSpace that, CodeContext cc) {
7659 super(that, cc);
7660 }
7661
7662 @Override
7663 public DepthToSpace transform(CodeContext cc, CodeTransformer ot) {
7664 return new DepthToSpace(this, cc);
7665 }
7666
7667 DepthToSpace(CodeType resultType, Value input, java.util.Optional<String> mode, long blocksize) {
7668 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(mode, blocksize));
7669 }
7670
7671 @Override
7672 public SequencedSet<OnnxParameter> onnxOutputs() {
7673 return onnxOutputs(SCHEMA);
7674 }
7675
7676 @Override
7677 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7678 return onnxInputs(SCHEMA, List.of(input()));
7679 }
7680
7681 public Value input() {
7682 return operands().get(0);
7683 }
7684
7685 public java.util.Optional<String> mode() {
7686 String mode = Attribute.mode.access(String.class, onnxAttributes);
7687 return java.util.Optional.ofNullable(mode);
7688 }
7689
7690 public long blocksize() {
7691 long blocksize = Attribute.blocksize.access(Long.class, onnxAttributes);
7692 return blocksize;
7693 }
7694
7695 }
7696
7697 public static DepthToSpace DepthToSpace(CodeType resultType, Value input, java.util.Optional<String> mode, long blocksize) {
7698 return new DepthToSpace(resultType, input, mode, blocksize);
7699 }
7700
7701 @OpFactoryHelper.OpDeclaration(DequantizeLinear.NAME)
7702 public static final class DequantizeLinear extends OnnxOp {
7703 public static final String NAME = "DequantizeLinear";
7704
7705 public enum Attribute implements OnnxAttribute {
7706 output_dtype(Long.class, true, 0),
7707 axis(Long.class, true, 1),
7708 block_size(Long.class, true, 0),
7709 ;
7710
7711 final Class<?> t;
7712 final boolean optional;
7713 final Object defaultValue;
7714
7715 Attribute(Class<?> type, boolean optional, Object defaultValue) {
7716 this.t = type;
7717 this.optional = optional;
7718 this.defaultValue = defaultValue;
7719 assert optional || defaultValue == null;
7720 }
7721
7722 public Class<?> type() {
7723 return t;
7724 }
7725
7726 public boolean isOptional() {
7727 return optional;
7728 }
7729
7730 public Object defaultValue() {
7731 return defaultValue;
7732 }
7733 }
7734
7735 public enum TypeConstraint implements OnnxTypeConstraint {
7736 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
7737 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float8e8m0())))),
7738 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))),
7739 ;
7740
7741 final OnnxType.TypeVariable typeVariable;
7742
7743 TypeConstraint(OnnxType.TypeVariable typeVariable) {
7744 assert typeVariable.name().equals(name());
7745 this.typeVariable = typeVariable;
7746 }
7747
7748 @Override
7749 public OnnxType.TypeVariable typeVariable() {
7750 return typeVariable;
7751 }
7752 }
7753
7754 public enum InputParameter implements OnnxParameter {
7755 x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
7756 x_scale(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
7757 x_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
7758 ;
7759
7760 final OnnxType type;
7761 final Quantifier quantifier;
7762
7763 InputParameter(OnnxType type, Quantifier quantifier) {
7764 this.type = type;
7765 this.quantifier = quantifier;
7766 }
7767
7768 @Override
7769 public OnnxType type() {
7770 return type;
7771 }
7772
7773 @Override
7774 public Quantifier quantifier() {
7775 return quantifier;
7776 }
7777 }
7778
7779 public enum OutputParameter implements OnnxParameter {
7780 y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
7781 ;
7782
7783 final OnnxType type;
7784 final Quantifier quantifier;
7785
7786 OutputParameter(OnnxType type, Quantifier quantifier) {
7787 this.type = type;
7788 this.quantifier = quantifier;
7789 }
7790
7791 @Override
7792 public OnnxType type() {
7793 return type;
7794 }
7795
7796 @Override
7797 public Quantifier quantifier() {
7798 return quantifier;
7799 }
7800 }
7801
7802 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
7803 NAME,
7804 List.of(Attribute.values()),
7805 List.of(TypeConstraint.values()),
7806 List.of(InputParameter.values()),
7807 List.of(OutputParameter.values())
7808 );
7809
7810 public DequantizeLinear(ExternalizedOp def) {
7811 super(SCHEMA, def);
7812 }
7813
7814 DequantizeLinear(DequantizeLinear that, CodeContext cc) {
7815 super(that, cc);
7816 }
7817
7818 @Override
7819 public DequantizeLinear transform(CodeContext cc, CodeTransformer ot) {
7820 return new DequantizeLinear(this, cc);
7821 }
7822
7823 DequantizeLinear(CodeType resultType, Value x, Value x_scale, java.util.Optional<Value> x_zero_point, java.util.Optional<Long> output_dtype, java.util.Optional<Long> axis, java.util.Optional<Long> block_size) {
7824 super(SCHEMA, resultType, Set.of(), List.of(x, x_scale, x_zero_point), List.of(output_dtype, axis, block_size));
7825 }
7826
7827 @Override
7828 public SequencedSet<OnnxParameter> onnxOutputs() {
7829 return onnxOutputs(SCHEMA);
7830 }
7831
7832 @Override
7833 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7834 return onnxInputs(SCHEMA, List.of(x(), x_scale(), x_zero_point()));
7835 }
7836
7837 public Value x() {
7838 return operands().get(0);
7839 }
7840
7841 public Value x_scale() {
7842 return operands().get(1);
7843 }
7844
7845 public java.util.Optional<Value> x_zero_point() {
7846 int i = optionalInputArguments.indexOf(InputParameter.x_zero_point);
7847 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
7848 }
7849
7850 public java.util.Optional<Long> output_dtype() {
7851 Long output_dtype = Attribute.output_dtype.access(Long.class, onnxAttributes);
7852 return java.util.Optional.ofNullable(output_dtype);
7853 }
7854
7855 public java.util.Optional<Long> axis() {
7856 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
7857 return java.util.Optional.ofNullable(axis);
7858 }
7859
7860 public java.util.Optional<Long> block_size() {
7861 Long block_size = Attribute.block_size.access(Long.class, onnxAttributes);
7862 return java.util.Optional.ofNullable(block_size);
7863 }
7864
7865 }
7866
7867 public static DequantizeLinear DequantizeLinear(CodeType resultType, Value x, Value x_scale, java.util.Optional<Value> x_zero_point, java.util.Optional<Long> output_dtype, java.util.Optional<Long> axis, java.util.Optional<Long> block_size) {
7868 return new DequantizeLinear(resultType, x, x_scale, x_zero_point, output_dtype, axis, block_size);
7869 }
7870
7871 @OpFactoryHelper.OpDeclaration(Det.NAME)
7872 public static final class Det extends OnnxOp {
7873 public static final String NAME = "Det";
7874
7875 public enum Attribute implements OnnxAttribute.None { }
7876
7877 public enum TypeConstraint implements OnnxTypeConstraint {
7878 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
7879 ;
7880
7881 final OnnxType.TypeVariable typeVariable;
7882
7883 TypeConstraint(OnnxType.TypeVariable typeVariable) {
7884 assert typeVariable.name().equals(name());
7885 this.typeVariable = typeVariable;
7886 }
7887
7888 @Override
7889 public OnnxType.TypeVariable typeVariable() {
7890 return typeVariable;
7891 }
7892 }
7893
7894 public enum InputParameter implements OnnxParameter {
7895 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7896 ;
7897
7898 final OnnxType type;
7899 final Quantifier quantifier;
7900
7901 InputParameter(OnnxType type, Quantifier quantifier) {
7902 this.type = type;
7903 this.quantifier = quantifier;
7904 }
7905
7906 @Override
7907 public OnnxType type() {
7908 return type;
7909 }
7910
7911 @Override
7912 public Quantifier quantifier() {
7913 return quantifier;
7914 }
7915 }
7916
7917 public enum OutputParameter implements OnnxParameter {
7918 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
7919 ;
7920
7921 final OnnxType type;
7922 final Quantifier quantifier;
7923
7924 OutputParameter(OnnxType type, Quantifier quantifier) {
7925 this.type = type;
7926 this.quantifier = quantifier;
7927 }
7928
7929 @Override
7930 public OnnxType type() {
7931 return type;
7932 }
7933
7934 @Override
7935 public Quantifier quantifier() {
7936 return quantifier;
7937 }
7938 }
7939
7940 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
7941 NAME,
7942 List.of(Attribute.values()),
7943 List.of(TypeConstraint.values()),
7944 List.of(InputParameter.values()),
7945 List.of(OutputParameter.values())
7946 );
7947
7948 public Det(ExternalizedOp def) {
7949 super(SCHEMA, def);
7950 }
7951
7952 Det(Det that, CodeContext cc) {
7953 super(that, cc);
7954 }
7955
7956 @Override
7957 public Det transform(CodeContext cc, CodeTransformer ot) {
7958 return new Det(this, cc);
7959 }
7960
7961 Det(CodeType resultType, Value X) {
7962 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
7963 }
7964
7965 @Override
7966 public SequencedSet<OnnxParameter> onnxOutputs() {
7967 return onnxOutputs(SCHEMA);
7968 }
7969
7970 @Override
7971 public SequencedMap<OnnxParameter, Object> onnxInputs() {
7972 return onnxInputs(SCHEMA, List.of(X()));
7973 }
7974
7975 public Value X() {
7976 return operands().get(0);
7977 }
7978
7979 }
7980
7981 public static Det Det(CodeType resultType, Value X) {
7982 return new Det(resultType, X);
7983 }
7984
7985 @OpFactoryHelper.OpDeclaration(DictVectorizer.NAME)
7986 public static final class DictVectorizer extends OnnxOp {
7987 public static final String NAME = "DictVectorizer";
7988
7989 public enum Attribute implements OnnxAttribute {
7990 string_vocabulary(String[].class, true, null),
7991 int64_vocabulary(long[].class, true, null),
7992 ;
7993
7994 final Class<?> t;
7995 final boolean optional;
7996 final Object defaultValue;
7997
7998 Attribute(Class<?> type, boolean optional, Object defaultValue) {
7999 this.t = type;
8000 this.optional = optional;
8001 this.defaultValue = defaultValue;
8002 assert optional || defaultValue == null;
8003 }
8004
8005 public Class<?> type() {
8006 return t;
8007 }
8008
8009 public boolean isOptional() {
8010 return optional;
8011 }
8012
8013 public Object defaultValue() {
8014 return defaultValue;
8015 }
8016 }
8017
8018 public enum TypeConstraint implements OnnxTypeConstraint {
8019 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.map(OnnxType.string(), OnnxType.int64()), OnnxType.map(OnnxType.int64(), OnnxType.string()), OnnxType.map(OnnxType.int64(), OnnxType.float32()), OnnxType.map(OnnxType.int64(), OnnxType.float64()), OnnxType.map(OnnxType.string(), OnnxType.float32()), OnnxType.map(OnnxType.string(), OnnxType.float64())))),
8020 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string())))),
8021 ;
8022
8023 final OnnxType.TypeVariable typeVariable;
8024
8025 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8026 assert typeVariable.name().equals(name());
8027 this.typeVariable = typeVariable;
8028 }
8029
8030 @Override
8031 public OnnxType.TypeVariable typeVariable() {
8032 return typeVariable;
8033 }
8034 }
8035
8036 public enum InputParameter implements OnnxParameter {
8037 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
8038 ;
8039
8040 final OnnxType type;
8041 final Quantifier quantifier;
8042
8043 InputParameter(OnnxType type, Quantifier quantifier) {
8044 this.type = type;
8045 this.quantifier = quantifier;
8046 }
8047
8048 @Override
8049 public OnnxType type() {
8050 return type;
8051 }
8052
8053 @Override
8054 public Quantifier quantifier() {
8055 return quantifier;
8056 }
8057 }
8058
8059 public enum OutputParameter implements OnnxParameter {
8060 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
8061 ;
8062
8063 final OnnxType type;
8064 final Quantifier quantifier;
8065
8066 OutputParameter(OnnxType type, Quantifier quantifier) {
8067 this.type = type;
8068 this.quantifier = quantifier;
8069 }
8070
8071 @Override
8072 public OnnxType type() {
8073 return type;
8074 }
8075
8076 @Override
8077 public Quantifier quantifier() {
8078 return quantifier;
8079 }
8080 }
8081
8082 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8083 NAME,
8084 List.of(Attribute.values()),
8085 List.of(TypeConstraint.values()),
8086 List.of(InputParameter.values()),
8087 List.of(OutputParameter.values())
8088 );
8089
8090 public DictVectorizer(ExternalizedOp def) {
8091 super(SCHEMA, def);
8092 }
8093
8094 DictVectorizer(DictVectorizer that, CodeContext cc) {
8095 super(that, cc);
8096 }
8097
8098 @Override
8099 public DictVectorizer transform(CodeContext cc, CodeTransformer ot) {
8100 return new DictVectorizer(this, cc);
8101 }
8102
8103 DictVectorizer(CodeType resultType, Value X, java.util.Optional<String[]> string_vocabulary, java.util.Optional<long[]> int64_vocabulary) {
8104 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(string_vocabulary, int64_vocabulary));
8105 }
8106
8107 @Override
8108 public SequencedSet<OnnxParameter> onnxOutputs() {
8109 return onnxOutputs(SCHEMA);
8110 }
8111
8112 @Override
8113 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8114 return onnxInputs(SCHEMA, List.of(X()));
8115 }
8116
8117 public Value X() {
8118 return operands().get(0);
8119 }
8120
8121 public java.util.Optional<String[]> string_vocabulary() {
8122 String[] string_vocabulary = Attribute.string_vocabulary.access(String[].class, onnxAttributes);
8123 return java.util.Optional.ofNullable(string_vocabulary).map(String[]::clone);
8124 }
8125
8126 public java.util.Optional<long[]> int64_vocabulary() {
8127 long[] int64_vocabulary = Attribute.int64_vocabulary.access(long[].class, onnxAttributes);
8128 return java.util.Optional.ofNullable(int64_vocabulary).map(long[]::clone);
8129 }
8130
8131 }
8132
8133 public static DictVectorizer DictVectorizer(CodeType resultType, Value X, java.util.Optional<String[]> string_vocabulary, java.util.Optional<long[]> int64_vocabulary) {
8134 return new DictVectorizer(resultType, X, string_vocabulary, int64_vocabulary);
8135 }
8136
8137 @OpFactoryHelper.OpDeclaration(Div.NAME)
8138 public static final class Div extends OnnxOp {
8139 public static final String NAME = "Div";
8140
8141 public enum Attribute implements OnnxAttribute.None { }
8142
8143 public enum TypeConstraint implements OnnxTypeConstraint {
8144 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
8145 ;
8146
8147 final OnnxType.TypeVariable typeVariable;
8148
8149 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8150 assert typeVariable.name().equals(name());
8151 this.typeVariable = typeVariable;
8152 }
8153
8154 @Override
8155 public OnnxType.TypeVariable typeVariable() {
8156 return typeVariable;
8157 }
8158 }
8159
8160 public enum InputParameter implements OnnxParameter {
8161 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8162 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8163 ;
8164
8165 final OnnxType type;
8166 final Quantifier quantifier;
8167
8168 InputParameter(OnnxType type, Quantifier quantifier) {
8169 this.type = type;
8170 this.quantifier = quantifier;
8171 }
8172
8173 @Override
8174 public OnnxType type() {
8175 return type;
8176 }
8177
8178 @Override
8179 public Quantifier quantifier() {
8180 return quantifier;
8181 }
8182 }
8183
8184 public enum OutputParameter implements OnnxParameter {
8185 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8186 ;
8187
8188 final OnnxType type;
8189 final Quantifier quantifier;
8190
8191 OutputParameter(OnnxType type, Quantifier quantifier) {
8192 this.type = type;
8193 this.quantifier = quantifier;
8194 }
8195
8196 @Override
8197 public OnnxType type() {
8198 return type;
8199 }
8200
8201 @Override
8202 public Quantifier quantifier() {
8203 return quantifier;
8204 }
8205 }
8206
8207 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8208 NAME,
8209 List.of(Attribute.values()),
8210 List.of(TypeConstraint.values()),
8211 List.of(InputParameter.values()),
8212 List.of(OutputParameter.values())
8213 );
8214
8215 public Div(ExternalizedOp def) {
8216 super(SCHEMA, def);
8217 }
8218
8219 Div(Div that, CodeContext cc) {
8220 super(that, cc);
8221 }
8222
8223 @Override
8224 public Div transform(CodeContext cc, CodeTransformer ot) {
8225 return new Div(this, cc);
8226 }
8227
8228 Div(CodeType resultType, Value A, Value B) {
8229 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
8230 }
8231
8232 @Override
8233 public SequencedSet<OnnxParameter> onnxOutputs() {
8234 return onnxOutputs(SCHEMA);
8235 }
8236
8237 @Override
8238 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8239 return onnxInputs(SCHEMA, List.of(A(), B()));
8240 }
8241
8242 public Value A() {
8243 return operands().get(0);
8244 }
8245
8246 public Value B() {
8247 return operands().get(1);
8248 }
8249
8250 }
8251
8252 public static Div Div(CodeType resultType, Value A, Value B) {
8253 return new Div(resultType, A, B);
8254 }
8255
8256 @OpFactoryHelper.OpDeclaration(Dropout.NAME)
8257 public static final class Dropout extends OnnxOp {
8258 public static final String NAME = "Dropout";
8259
8260 public enum Attribute implements OnnxAttribute {
8261 seed(Long.class, true, null),
8262 ;
8263
8264 final Class<?> t;
8265 final boolean optional;
8266 final Object defaultValue;
8267
8268 Attribute(Class<?> type, boolean optional, Object defaultValue) {
8269 this.t = type;
8270 this.optional = optional;
8271 this.defaultValue = defaultValue;
8272 assert optional || defaultValue == null;
8273 }
8274
8275 public Class<?> type() {
8276 return t;
8277 }
8278
8279 public boolean isOptional() {
8280 return optional;
8281 }
8282
8283 public Object defaultValue() {
8284 return defaultValue;
8285 }
8286 }
8287
8288 public enum TypeConstraint implements OnnxTypeConstraint {
8289 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
8290 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
8291 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))),
8292 ;
8293
8294 final OnnxType.TypeVariable typeVariable;
8295
8296 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8297 assert typeVariable.name().equals(name());
8298 this.typeVariable = typeVariable;
8299 }
8300
8301 @Override
8302 public OnnxType.TypeVariable typeVariable() {
8303 return typeVariable;
8304 }
8305 }
8306
8307 public enum InputParameter implements OnnxParameter {
8308 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8309 ratio(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
8310 training_mode(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
8311 ;
8312
8313 final OnnxType type;
8314 final Quantifier quantifier;
8315
8316 InputParameter(OnnxType type, Quantifier quantifier) {
8317 this.type = type;
8318 this.quantifier = quantifier;
8319 }
8320
8321 @Override
8322 public OnnxType type() {
8323 return type;
8324 }
8325
8326 @Override
8327 public Quantifier quantifier() {
8328 return quantifier;
8329 }
8330 }
8331
8332 public enum OutputParameter implements OnnxParameter {
8333 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8334 mask(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
8335 ;
8336
8337 final OnnxType type;
8338 final Quantifier quantifier;
8339
8340 OutputParameter(OnnxType type, Quantifier quantifier) {
8341 this.type = type;
8342 this.quantifier = quantifier;
8343 }
8344
8345 @Override
8346 public OnnxType type() {
8347 return type;
8348 }
8349
8350 @Override
8351 public Quantifier quantifier() {
8352 return quantifier;
8353 }
8354 }
8355
8356 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8357 NAME,
8358 List.of(Attribute.values()),
8359 List.of(TypeConstraint.values()),
8360 List.of(InputParameter.values()),
8361 List.of(OutputParameter.values())
8362 );
8363
8364 public Dropout(ExternalizedOp def) {
8365 super(SCHEMA, def);
8366 }
8367
8368 Dropout(Dropout that, CodeContext cc) {
8369 super(that, cc);
8370 }
8371
8372 @Override
8373 public Dropout transform(CodeContext cc, CodeTransformer ot) {
8374 return new Dropout(this, cc);
8375 }
8376
8377 Dropout(CodeType resultType, Set<OutputParameter> optionalOutputs, Value data, java.util.Optional<Value> ratio, java.util.Optional<Value> training_mode, java.util.Optional<Long> seed) {
8378 super(SCHEMA, resultType, optionalOutputs, List.of(data, ratio, training_mode), List.of(seed));
8379 }
8380
8381 @Override
8382 public SequencedSet<OnnxParameter> onnxOutputs() {
8383 return onnxOutputs(SCHEMA);
8384 }
8385
8386 @Override
8387 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8388 return onnxInputs(SCHEMA, List.of(data(), ratio(), training_mode()));
8389 }
8390
8391 public Value data() {
8392 return operands().get(0);
8393 }
8394
8395 public java.util.Optional<Value> ratio() {
8396 int i = optionalInputArguments.indexOf(InputParameter.ratio);
8397 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
8398 }
8399
8400 public java.util.Optional<Value> training_mode() {
8401 int i = optionalInputArguments.indexOf(InputParameter.training_mode);
8402 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
8403 }
8404
8405 public java.util.Optional<Long> seed() {
8406 Long seed = Attribute.seed.access(Long.class, onnxAttributes);
8407 return java.util.Optional.ofNullable(seed);
8408 }
8409
8410 }
8411
8412 public static Dropout Dropout(CodeType resultType, Set<Dropout.OutputParameter> optionalOutputs, Value data, java.util.Optional<Value> ratio, java.util.Optional<Value> training_mode, java.util.Optional<Long> seed) {
8413 return new Dropout(resultType, optionalOutputs, data, ratio, training_mode, seed);
8414 }
8415
8416 @OpFactoryHelper.OpDeclaration(DynamicQuantizeLinear.NAME)
8417 public static final class DynamicQuantizeLinear extends OnnxOp {
8418 public static final String NAME = "DynamicQuantizeLinear";
8419
8420 public enum Attribute implements OnnxAttribute.None { }
8421
8422 public enum TypeConstraint implements OnnxTypeConstraint {
8423 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32())))),
8424 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8())))),
8425 ;
8426
8427 final OnnxType.TypeVariable typeVariable;
8428
8429 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8430 assert typeVariable.name().equals(name());
8431 this.typeVariable = typeVariable;
8432 }
8433
8434 @Override
8435 public OnnxType.TypeVariable typeVariable() {
8436 return typeVariable;
8437 }
8438 }
8439
8440 public enum InputParameter implements OnnxParameter {
8441 x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
8442 ;
8443
8444 final OnnxType type;
8445 final Quantifier quantifier;
8446
8447 InputParameter(OnnxType type, Quantifier quantifier) {
8448 this.type = type;
8449 this.quantifier = quantifier;
8450 }
8451
8452 @Override
8453 public OnnxType type() {
8454 return type;
8455 }
8456
8457 @Override
8458 public Quantifier quantifier() {
8459 return quantifier;
8460 }
8461 }
8462
8463 public enum OutputParameter implements OnnxParameter {
8464 y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
8465 y_scale(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
8466 y_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
8467 ;
8468
8469 final OnnxType type;
8470 final Quantifier quantifier;
8471
8472 OutputParameter(OnnxType type, Quantifier quantifier) {
8473 this.type = type;
8474 this.quantifier = quantifier;
8475 }
8476
8477 @Override
8478 public OnnxType type() {
8479 return type;
8480 }
8481
8482 @Override
8483 public Quantifier quantifier() {
8484 return quantifier;
8485 }
8486 }
8487
8488 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8489 NAME,
8490 List.of(Attribute.values()),
8491 List.of(TypeConstraint.values()),
8492 List.of(InputParameter.values()),
8493 List.of(OutputParameter.values())
8494 );
8495
8496 public DynamicQuantizeLinear(ExternalizedOp def) {
8497 super(SCHEMA, def);
8498 }
8499
8500 DynamicQuantizeLinear(DynamicQuantizeLinear that, CodeContext cc) {
8501 super(that, cc);
8502 }
8503
8504 @Override
8505 public DynamicQuantizeLinear transform(CodeContext cc, CodeTransformer ot) {
8506 return new DynamicQuantizeLinear(this, cc);
8507 }
8508
8509 DynamicQuantizeLinear(CodeType resultType, Value x) {
8510 super(SCHEMA, resultType, Set.of(), List.of(x), List.of());
8511 }
8512
8513 @Override
8514 public SequencedSet<OnnxParameter> onnxOutputs() {
8515 return onnxOutputs(SCHEMA);
8516 }
8517
8518 @Override
8519 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8520 return onnxInputs(SCHEMA, List.of(x()));
8521 }
8522
8523 public Value x() {
8524 return operands().get(0);
8525 }
8526
8527 }
8528
8529 public static DynamicQuantizeLinear DynamicQuantizeLinear(CodeType resultType, Value x) {
8530 return new DynamicQuantizeLinear(resultType, x);
8531 }
8532
8533 @OpFactoryHelper.OpDeclaration(Einsum.NAME)
8534 public static final class Einsum extends OnnxOp {
8535 public static final String NAME = "Einsum";
8536
8537 public enum Attribute implements OnnxAttribute {
8538 equation(String.class, false, null),
8539 ;
8540
8541 final Class<?> t;
8542 final boolean optional;
8543 final Object defaultValue;
8544
8545 Attribute(Class<?> type, boolean optional, Object defaultValue) {
8546 this.t = type;
8547 this.optional = optional;
8548 this.defaultValue = defaultValue;
8549 assert optional || defaultValue == null;
8550 }
8551
8552 public Class<?> type() {
8553 return t;
8554 }
8555
8556 public boolean isOptional() {
8557 return optional;
8558 }
8559
8560 public Object defaultValue() {
8561 return defaultValue;
8562 }
8563 }
8564
8565 public enum TypeConstraint implements OnnxTypeConstraint {
8566 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
8567 ;
8568
8569 final OnnxType.TypeVariable typeVariable;
8570
8571 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8572 assert typeVariable.name().equals(name());
8573 this.typeVariable = typeVariable;
8574 }
8575
8576 @Override
8577 public OnnxType.TypeVariable typeVariable() {
8578 return typeVariable;
8579 }
8580 }
8581
8582 public enum InputParameter implements OnnxParameter {
8583 Inputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
8584 ;
8585
8586 final OnnxType type;
8587 final Quantifier quantifier;
8588
8589 InputParameter(OnnxType type, Quantifier quantifier) {
8590 this.type = type;
8591 this.quantifier = quantifier;
8592 }
8593
8594 @Override
8595 public OnnxType type() {
8596 return type;
8597 }
8598
8599 @Override
8600 public Quantifier quantifier() {
8601 return quantifier;
8602 }
8603 }
8604
8605 public enum OutputParameter implements OnnxParameter {
8606 Output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8607 ;
8608
8609 final OnnxType type;
8610 final Quantifier quantifier;
8611
8612 OutputParameter(OnnxType type, Quantifier quantifier) {
8613 this.type = type;
8614 this.quantifier = quantifier;
8615 }
8616
8617 @Override
8618 public OnnxType type() {
8619 return type;
8620 }
8621
8622 @Override
8623 public Quantifier quantifier() {
8624 return quantifier;
8625 }
8626 }
8627
8628 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8629 NAME,
8630 List.of(Attribute.values()),
8631 List.of(TypeConstraint.values()),
8632 List.of(InputParameter.values()),
8633 List.of(OutputParameter.values())
8634 );
8635
8636 public Einsum(ExternalizedOp def) {
8637 super(SCHEMA, def);
8638 }
8639
8640 Einsum(Einsum that, CodeContext cc) {
8641 super(that, cc);
8642 }
8643
8644 @Override
8645 public Einsum transform(CodeContext cc, CodeTransformer ot) {
8646 return new Einsum(this, cc);
8647 }
8648
8649 Einsum(CodeType resultType, List<Value> Inputs, String equation) {
8650 super(SCHEMA, resultType, Set.of(), List.of(Inputs), List.of(equation));
8651 }
8652
8653 @Override
8654 public SequencedSet<OnnxParameter> onnxOutputs() {
8655 return onnxOutputs(SCHEMA);
8656 }
8657
8658 @Override
8659 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8660 return onnxInputs(SCHEMA, List.of(Inputs()));
8661 }
8662
8663 public List<Value> Inputs() {
8664 return operands();
8665 }
8666
8667 public String equation() {
8668 String equation = Attribute.equation.access(String.class, onnxAttributes);
8669 return equation;
8670 }
8671
8672 }
8673
8674 public static Einsum Einsum(CodeType resultType, List<Value> Inputs, String equation) {
8675 return new Einsum(resultType, Inputs, equation);
8676 }
8677
8678 @OpFactoryHelper.OpDeclaration(Elu.NAME)
8679 public static final class Elu extends OnnxOp {
8680 public static final String NAME = "Elu";
8681
8682 public enum Attribute implements OnnxAttribute {
8683 alpha(Float.class, true, 1.0f),
8684 ;
8685
8686 final Class<?> t;
8687 final boolean optional;
8688 final Object defaultValue;
8689
8690 Attribute(Class<?> type, boolean optional, Object defaultValue) {
8691 this.t = type;
8692 this.optional = optional;
8693 this.defaultValue = defaultValue;
8694 assert optional || defaultValue == null;
8695 }
8696
8697 public Class<?> type() {
8698 return t;
8699 }
8700
8701 public boolean isOptional() {
8702 return optional;
8703 }
8704
8705 public Object defaultValue() {
8706 return defaultValue;
8707 }
8708 }
8709
8710 public enum TypeConstraint implements OnnxTypeConstraint {
8711 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
8712 ;
8713
8714 final OnnxType.TypeVariable typeVariable;
8715
8716 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8717 assert typeVariable.name().equals(name());
8718 this.typeVariable = typeVariable;
8719 }
8720
8721 @Override
8722 public OnnxType.TypeVariable typeVariable() {
8723 return typeVariable;
8724 }
8725 }
8726
8727 public enum InputParameter implements OnnxParameter {
8728 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8729 ;
8730
8731 final OnnxType type;
8732 final Quantifier quantifier;
8733
8734 InputParameter(OnnxType type, Quantifier quantifier) {
8735 this.type = type;
8736 this.quantifier = quantifier;
8737 }
8738
8739 @Override
8740 public OnnxType type() {
8741 return type;
8742 }
8743
8744 @Override
8745 public Quantifier quantifier() {
8746 return quantifier;
8747 }
8748 }
8749
8750 public enum OutputParameter implements OnnxParameter {
8751 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8752 ;
8753
8754 final OnnxType type;
8755 final Quantifier quantifier;
8756
8757 OutputParameter(OnnxType type, Quantifier quantifier) {
8758 this.type = type;
8759 this.quantifier = quantifier;
8760 }
8761
8762 @Override
8763 public OnnxType type() {
8764 return type;
8765 }
8766
8767 @Override
8768 public Quantifier quantifier() {
8769 return quantifier;
8770 }
8771 }
8772
8773 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8774 NAME,
8775 List.of(Attribute.values()),
8776 List.of(TypeConstraint.values()),
8777 List.of(InputParameter.values()),
8778 List.of(OutputParameter.values())
8779 );
8780
8781 public Elu(ExternalizedOp def) {
8782 super(SCHEMA, def);
8783 }
8784
8785 Elu(Elu that, CodeContext cc) {
8786 super(that, cc);
8787 }
8788
8789 @Override
8790 public Elu transform(CodeContext cc, CodeTransformer ot) {
8791 return new Elu(this, cc);
8792 }
8793
8794 Elu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
8795 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha));
8796 }
8797
8798 @Override
8799 public SequencedSet<OnnxParameter> onnxOutputs() {
8800 return onnxOutputs(SCHEMA);
8801 }
8802
8803 @Override
8804 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8805 return onnxInputs(SCHEMA, List.of(X()));
8806 }
8807
8808 public Value X() {
8809 return operands().get(0);
8810 }
8811
8812 public java.util.Optional<Float> alpha() {
8813 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
8814 return java.util.Optional.ofNullable(alpha);
8815 }
8816
8817 }
8818
8819 public static Elu Elu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
8820 return new Elu(resultType, X, alpha);
8821 }
8822
8823 @OpFactoryHelper.OpDeclaration(Equal.NAME)
8824 public static final class Equal extends OnnxOp {
8825 public static final String NAME = "Equal";
8826
8827 public enum Attribute implements OnnxAttribute.None { }
8828
8829 public enum TypeConstraint implements OnnxTypeConstraint {
8830 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.string())))),
8831 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
8832 ;
8833
8834 final OnnxType.TypeVariable typeVariable;
8835
8836 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8837 assert typeVariable.name().equals(name());
8838 this.typeVariable = typeVariable;
8839 }
8840
8841 @Override
8842 public OnnxType.TypeVariable typeVariable() {
8843 return typeVariable;
8844 }
8845 }
8846
8847 public enum InputParameter implements OnnxParameter {
8848 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8849 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8850 ;
8851
8852 final OnnxType type;
8853 final Quantifier quantifier;
8854
8855 InputParameter(OnnxType type, Quantifier quantifier) {
8856 this.type = type;
8857 this.quantifier = quantifier;
8858 }
8859
8860 @Override
8861 public OnnxType type() {
8862 return type;
8863 }
8864
8865 @Override
8866 public Quantifier quantifier() {
8867 return quantifier;
8868 }
8869 }
8870
8871 public enum OutputParameter implements OnnxParameter {
8872 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
8873 ;
8874
8875 final OnnxType type;
8876 final Quantifier quantifier;
8877
8878 OutputParameter(OnnxType type, Quantifier quantifier) {
8879 this.type = type;
8880 this.quantifier = quantifier;
8881 }
8882
8883 @Override
8884 public OnnxType type() {
8885 return type;
8886 }
8887
8888 @Override
8889 public Quantifier quantifier() {
8890 return quantifier;
8891 }
8892 }
8893
8894 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
8895 NAME,
8896 List.of(Attribute.values()),
8897 List.of(TypeConstraint.values()),
8898 List.of(InputParameter.values()),
8899 List.of(OutputParameter.values())
8900 );
8901
8902 public Equal(ExternalizedOp def) {
8903 super(SCHEMA, def);
8904 }
8905
8906 Equal(Equal that, CodeContext cc) {
8907 super(that, cc);
8908 }
8909
8910 @Override
8911 public Equal transform(CodeContext cc, CodeTransformer ot) {
8912 return new Equal(this, cc);
8913 }
8914
8915 Equal(CodeType resultType, Value A, Value B) {
8916 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
8917 }
8918
8919 @Override
8920 public SequencedSet<OnnxParameter> onnxOutputs() {
8921 return onnxOutputs(SCHEMA);
8922 }
8923
8924 @Override
8925 public SequencedMap<OnnxParameter, Object> onnxInputs() {
8926 return onnxInputs(SCHEMA, List.of(A(), B()));
8927 }
8928
8929 public Value A() {
8930 return operands().get(0);
8931 }
8932
8933 public Value B() {
8934 return operands().get(1);
8935 }
8936
8937 }
8938
8939 public static Equal Equal(CodeType resultType, Value A, Value B) {
8940 return new Equal(resultType, A, B);
8941 }
8942
8943 @OpFactoryHelper.OpDeclaration(Erf.NAME)
8944 public static final class Erf extends OnnxOp {
8945 public static final String NAME = "Erf";
8946
8947 public enum Attribute implements OnnxAttribute.None { }
8948
8949 public enum TypeConstraint implements OnnxTypeConstraint {
8950 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
8951 ;
8952
8953 final OnnxType.TypeVariable typeVariable;
8954
8955 TypeConstraint(OnnxType.TypeVariable typeVariable) {
8956 assert typeVariable.name().equals(name());
8957 this.typeVariable = typeVariable;
8958 }
8959
8960 @Override
8961 public OnnxType.TypeVariable typeVariable() {
8962 return typeVariable;
8963 }
8964 }
8965
8966 public enum InputParameter implements OnnxParameter {
8967 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8968 ;
8969
8970 final OnnxType type;
8971 final Quantifier quantifier;
8972
8973 InputParameter(OnnxType type, Quantifier quantifier) {
8974 this.type = type;
8975 this.quantifier = quantifier;
8976 }
8977
8978 @Override
8979 public OnnxType type() {
8980 return type;
8981 }
8982
8983 @Override
8984 public Quantifier quantifier() {
8985 return quantifier;
8986 }
8987 }
8988
8989 public enum OutputParameter implements OnnxParameter {
8990 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
8991 ;
8992
8993 final OnnxType type;
8994 final Quantifier quantifier;
8995
8996 OutputParameter(OnnxType type, Quantifier quantifier) {
8997 this.type = type;
8998 this.quantifier = quantifier;
8999 }
9000
9001 @Override
9002 public OnnxType type() {
9003 return type;
9004 }
9005
9006 @Override
9007 public Quantifier quantifier() {
9008 return quantifier;
9009 }
9010 }
9011
9012 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9013 NAME,
9014 List.of(Attribute.values()),
9015 List.of(TypeConstraint.values()),
9016 List.of(InputParameter.values()),
9017 List.of(OutputParameter.values())
9018 );
9019
9020 public Erf(ExternalizedOp def) {
9021 super(SCHEMA, def);
9022 }
9023
9024 Erf(Erf that, CodeContext cc) {
9025 super(that, cc);
9026 }
9027
9028 @Override
9029 public Erf transform(CodeContext cc, CodeTransformer ot) {
9030 return new Erf(this, cc);
9031 }
9032
9033 Erf(CodeType resultType, Value input) {
9034 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
9035 }
9036
9037 @Override
9038 public SequencedSet<OnnxParameter> onnxOutputs() {
9039 return onnxOutputs(SCHEMA);
9040 }
9041
9042 @Override
9043 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9044 return onnxInputs(SCHEMA, List.of(input()));
9045 }
9046
9047 public Value input() {
9048 return operands().get(0);
9049 }
9050
9051 }
9052
9053 public static Erf Erf(CodeType resultType, Value input) {
9054 return new Erf(resultType, input);
9055 }
9056
9057 @OpFactoryHelper.OpDeclaration(Exp.NAME)
9058 public static final class Exp extends OnnxOp {
9059 public static final String NAME = "Exp";
9060
9061 public enum Attribute implements OnnxAttribute.None { }
9062
9063 public enum TypeConstraint implements OnnxTypeConstraint {
9064 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
9065 ;
9066
9067 final OnnxType.TypeVariable typeVariable;
9068
9069 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9070 assert typeVariable.name().equals(name());
9071 this.typeVariable = typeVariable;
9072 }
9073
9074 @Override
9075 public OnnxType.TypeVariable typeVariable() {
9076 return typeVariable;
9077 }
9078 }
9079
9080 public enum InputParameter implements OnnxParameter {
9081 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9082 ;
9083
9084 final OnnxType type;
9085 final Quantifier quantifier;
9086
9087 InputParameter(OnnxType type, Quantifier quantifier) {
9088 this.type = type;
9089 this.quantifier = quantifier;
9090 }
9091
9092 @Override
9093 public OnnxType type() {
9094 return type;
9095 }
9096
9097 @Override
9098 public Quantifier quantifier() {
9099 return quantifier;
9100 }
9101 }
9102
9103 public enum OutputParameter implements OnnxParameter {
9104 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9105 ;
9106
9107 final OnnxType type;
9108 final Quantifier quantifier;
9109
9110 OutputParameter(OnnxType type, Quantifier quantifier) {
9111 this.type = type;
9112 this.quantifier = quantifier;
9113 }
9114
9115 @Override
9116 public OnnxType type() {
9117 return type;
9118 }
9119
9120 @Override
9121 public Quantifier quantifier() {
9122 return quantifier;
9123 }
9124 }
9125
9126 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9127 NAME,
9128 List.of(Attribute.values()),
9129 List.of(TypeConstraint.values()),
9130 List.of(InputParameter.values()),
9131 List.of(OutputParameter.values())
9132 );
9133
9134 public Exp(ExternalizedOp def) {
9135 super(SCHEMA, def);
9136 }
9137
9138 Exp(Exp that, CodeContext cc) {
9139 super(that, cc);
9140 }
9141
9142 @Override
9143 public Exp transform(CodeContext cc, CodeTransformer ot) {
9144 return new Exp(this, cc);
9145 }
9146
9147 Exp(CodeType resultType, Value input) {
9148 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
9149 }
9150
9151 @Override
9152 public SequencedSet<OnnxParameter> onnxOutputs() {
9153 return onnxOutputs(SCHEMA);
9154 }
9155
9156 @Override
9157 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9158 return onnxInputs(SCHEMA, List.of(input()));
9159 }
9160
9161 public Value input() {
9162 return operands().get(0);
9163 }
9164
9165 }
9166
9167 public static Exp Exp(CodeType resultType, Value input) {
9168 return new Exp(resultType, input);
9169 }
9170
9171 @OpFactoryHelper.OpDeclaration(Expand.NAME)
9172 public static final class Expand extends OnnxOp {
9173 public static final String NAME = "Expand";
9174
9175 public enum Attribute implements OnnxAttribute.None { }
9176
9177 public enum TypeConstraint implements OnnxTypeConstraint {
9178 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
9179 ;
9180
9181 final OnnxType.TypeVariable typeVariable;
9182
9183 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9184 assert typeVariable.name().equals(name());
9185 this.typeVariable = typeVariable;
9186 }
9187
9188 @Override
9189 public OnnxType.TypeVariable typeVariable() {
9190 return typeVariable;
9191 }
9192 }
9193
9194 public enum InputParameter implements OnnxParameter {
9195 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9196 shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
9197 ;
9198
9199 final OnnxType type;
9200 final Quantifier quantifier;
9201
9202 InputParameter(OnnxType type, Quantifier quantifier) {
9203 this.type = type;
9204 this.quantifier = quantifier;
9205 }
9206
9207 @Override
9208 public OnnxType type() {
9209 return type;
9210 }
9211
9212 @Override
9213 public Quantifier quantifier() {
9214 return quantifier;
9215 }
9216 }
9217
9218 public enum OutputParameter implements OnnxParameter {
9219 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9220 ;
9221
9222 final OnnxType type;
9223 final Quantifier quantifier;
9224
9225 OutputParameter(OnnxType type, Quantifier quantifier) {
9226 this.type = type;
9227 this.quantifier = quantifier;
9228 }
9229
9230 @Override
9231 public OnnxType type() {
9232 return type;
9233 }
9234
9235 @Override
9236 public Quantifier quantifier() {
9237 return quantifier;
9238 }
9239 }
9240
9241 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9242 NAME,
9243 List.of(Attribute.values()),
9244 List.of(TypeConstraint.values()),
9245 List.of(InputParameter.values()),
9246 List.of(OutputParameter.values())
9247 );
9248
9249 public Expand(ExternalizedOp def) {
9250 super(SCHEMA, def);
9251 }
9252
9253 Expand(Expand that, CodeContext cc) {
9254 super(that, cc);
9255 }
9256
9257 @Override
9258 public Expand transform(CodeContext cc, CodeTransformer ot) {
9259 return new Expand(this, cc);
9260 }
9261
9262 Expand(CodeType resultType, Value input, Value shape) {
9263 super(SCHEMA, resultType, Set.of(), List.of(input, shape), List.of());
9264 }
9265
9266 @Override
9267 public SequencedSet<OnnxParameter> onnxOutputs() {
9268 return onnxOutputs(SCHEMA);
9269 }
9270
9271 @Override
9272 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9273 return onnxInputs(SCHEMA, List.of(input(), shape()));
9274 }
9275
9276 public Value input() {
9277 return operands().get(0);
9278 }
9279
9280 public Value shape() {
9281 return operands().get(1);
9282 }
9283
9284 }
9285
9286 public static Expand Expand(CodeType resultType, Value input, Value shape) {
9287 return new Expand(resultType, input, shape);
9288 }
9289
9290 @OpFactoryHelper.OpDeclaration(EyeLike.NAME)
9291 public static final class EyeLike extends OnnxOp {
9292 public static final String NAME = "EyeLike";
9293
9294 public enum Attribute implements OnnxAttribute {
9295 dtype(Long.class, true, null),
9296 k(Long.class, true, 0),
9297 ;
9298
9299 final Class<?> t;
9300 final boolean optional;
9301 final Object defaultValue;
9302
9303 Attribute(Class<?> type, boolean optional, Object defaultValue) {
9304 this.t = type;
9305 this.optional = optional;
9306 this.defaultValue = defaultValue;
9307 assert optional || defaultValue == null;
9308 }
9309
9310 public Class<?> type() {
9311 return t;
9312 }
9313
9314 public boolean isOptional() {
9315 return optional;
9316 }
9317
9318 public Object defaultValue() {
9319 return defaultValue;
9320 }
9321 }
9322
9323 public enum TypeConstraint implements OnnxTypeConstraint {
9324 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))),
9325 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))),
9326 ;
9327
9328 final OnnxType.TypeVariable typeVariable;
9329
9330 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9331 assert typeVariable.name().equals(name());
9332 this.typeVariable = typeVariable;
9333 }
9334
9335 @Override
9336 public OnnxType.TypeVariable typeVariable() {
9337 return typeVariable;
9338 }
9339 }
9340
9341 public enum InputParameter implements OnnxParameter {
9342 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
9343 ;
9344
9345 final OnnxType type;
9346 final Quantifier quantifier;
9347
9348 InputParameter(OnnxType type, Quantifier quantifier) {
9349 this.type = type;
9350 this.quantifier = quantifier;
9351 }
9352
9353 @Override
9354 public OnnxType type() {
9355 return type;
9356 }
9357
9358 @Override
9359 public Quantifier quantifier() {
9360 return quantifier;
9361 }
9362 }
9363
9364 public enum OutputParameter implements OnnxParameter {
9365 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
9366 ;
9367
9368 final OnnxType type;
9369 final Quantifier quantifier;
9370
9371 OutputParameter(OnnxType type, Quantifier quantifier) {
9372 this.type = type;
9373 this.quantifier = quantifier;
9374 }
9375
9376 @Override
9377 public OnnxType type() {
9378 return type;
9379 }
9380
9381 @Override
9382 public Quantifier quantifier() {
9383 return quantifier;
9384 }
9385 }
9386
9387 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9388 NAME,
9389 List.of(Attribute.values()),
9390 List.of(TypeConstraint.values()),
9391 List.of(InputParameter.values()),
9392 List.of(OutputParameter.values())
9393 );
9394
9395 public EyeLike(ExternalizedOp def) {
9396 super(SCHEMA, def);
9397 }
9398
9399 EyeLike(EyeLike that, CodeContext cc) {
9400 super(that, cc);
9401 }
9402
9403 @Override
9404 public EyeLike transform(CodeContext cc, CodeTransformer ot) {
9405 return new EyeLike(this, cc);
9406 }
9407
9408 EyeLike(CodeType resultType, Value input, java.util.Optional<Long> dtype, java.util.Optional<Long> k) {
9409 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(dtype, k));
9410 }
9411
9412 @Override
9413 public SequencedSet<OnnxParameter> onnxOutputs() {
9414 return onnxOutputs(SCHEMA);
9415 }
9416
9417 @Override
9418 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9419 return onnxInputs(SCHEMA, List.of(input()));
9420 }
9421
9422 public Value input() {
9423 return operands().get(0);
9424 }
9425
9426 public java.util.Optional<Long> dtype() {
9427 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
9428 return java.util.Optional.ofNullable(dtype);
9429 }
9430
9431 public java.util.Optional<Long> k() {
9432 Long k = Attribute.k.access(Long.class, onnxAttributes);
9433 return java.util.Optional.ofNullable(k);
9434 }
9435
9436 }
9437
9438 public static EyeLike EyeLike(CodeType resultType, Value input, java.util.Optional<Long> dtype, java.util.Optional<Long> k) {
9439 return new EyeLike(resultType, input, dtype, k);
9440 }
9441
9442 @OpFactoryHelper.OpDeclaration(FeatureVectorizer.NAME)
9443 public static final class FeatureVectorizer extends OnnxOp {
9444 public static final String NAME = "FeatureVectorizer";
9445
9446 public enum Attribute implements OnnxAttribute {
9447 inputdimensions(long[].class, true, null),
9448 ;
9449
9450 final Class<?> t;
9451 final boolean optional;
9452 final Object defaultValue;
9453
9454 Attribute(Class<?> type, boolean optional, Object defaultValue) {
9455 this.t = type;
9456 this.optional = optional;
9457 this.defaultValue = defaultValue;
9458 assert optional || defaultValue == null;
9459 }
9460
9461 public Class<?> type() {
9462 return t;
9463 }
9464
9465 public boolean isOptional() {
9466 return optional;
9467 }
9468
9469 public Object defaultValue() {
9470 return defaultValue;
9471 }
9472 }
9473
9474 public enum TypeConstraint implements OnnxTypeConstraint {
9475 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
9476 ;
9477
9478 final OnnxType.TypeVariable typeVariable;
9479
9480 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9481 assert typeVariable.name().equals(name());
9482 this.typeVariable = typeVariable;
9483 }
9484
9485 @Override
9486 public OnnxType.TypeVariable typeVariable() {
9487 return typeVariable;
9488 }
9489 }
9490
9491 public enum InputParameter implements OnnxParameter {
9492 X(TypeConstraint.T1.typeVariable(), Quantifier.VARIADIC),
9493 ;
9494
9495 final OnnxType type;
9496 final Quantifier quantifier;
9497
9498 InputParameter(OnnxType type, Quantifier quantifier) {
9499 this.type = type;
9500 this.quantifier = quantifier;
9501 }
9502
9503 @Override
9504 public OnnxType type() {
9505 return type;
9506 }
9507
9508 @Override
9509 public Quantifier quantifier() {
9510 return quantifier;
9511 }
9512 }
9513
9514 public enum OutputParameter implements OnnxParameter {
9515 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
9516 ;
9517
9518 final OnnxType type;
9519 final Quantifier quantifier;
9520
9521 OutputParameter(OnnxType type, Quantifier quantifier) {
9522 this.type = type;
9523 this.quantifier = quantifier;
9524 }
9525
9526 @Override
9527 public OnnxType type() {
9528 return type;
9529 }
9530
9531 @Override
9532 public Quantifier quantifier() {
9533 return quantifier;
9534 }
9535 }
9536
9537 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9538 NAME,
9539 List.of(Attribute.values()),
9540 List.of(TypeConstraint.values()),
9541 List.of(InputParameter.values()),
9542 List.of(OutputParameter.values())
9543 );
9544
9545 public FeatureVectorizer(ExternalizedOp def) {
9546 super(SCHEMA, def);
9547 }
9548
9549 FeatureVectorizer(FeatureVectorizer that, CodeContext cc) {
9550 super(that, cc);
9551 }
9552
9553 @Override
9554 public FeatureVectorizer transform(CodeContext cc, CodeTransformer ot) {
9555 return new FeatureVectorizer(this, cc);
9556 }
9557
9558 FeatureVectorizer(CodeType resultType, List<Value> X, java.util.Optional<long[]> inputdimensions) {
9559 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(inputdimensions));
9560 }
9561
9562 @Override
9563 public SequencedSet<OnnxParameter> onnxOutputs() {
9564 return onnxOutputs(SCHEMA);
9565 }
9566
9567 @Override
9568 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9569 return onnxInputs(SCHEMA, List.of(X()));
9570 }
9571
9572 public List<Value> X() {
9573 return operands();
9574 }
9575
9576 public java.util.Optional<long[]> inputdimensions() {
9577 long[] inputdimensions = Attribute.inputdimensions.access(long[].class, onnxAttributes);
9578 return java.util.Optional.ofNullable(inputdimensions).map(long[]::clone);
9579 }
9580
9581 }
9582
9583 public static FeatureVectorizer FeatureVectorizer(CodeType resultType, List<Value> X, java.util.Optional<long[]> inputdimensions) {
9584 return new FeatureVectorizer(resultType, X, inputdimensions);
9585 }
9586
9587 @OpFactoryHelper.OpDeclaration(Flatten.NAME)
9588 public static final class Flatten extends OnnxOp {
9589 public static final String NAME = "Flatten";
9590
9591 public enum Attribute implements OnnxAttribute {
9592 axis(Long.class, true, 1),
9593 ;
9594
9595 final Class<?> t;
9596 final boolean optional;
9597 final Object defaultValue;
9598
9599 Attribute(Class<?> type, boolean optional, Object defaultValue) {
9600 this.t = type;
9601 this.optional = optional;
9602 this.defaultValue = defaultValue;
9603 assert optional || defaultValue == null;
9604 }
9605
9606 public Class<?> type() {
9607 return t;
9608 }
9609
9610 public boolean isOptional() {
9611 return optional;
9612 }
9613
9614 public Object defaultValue() {
9615 return defaultValue;
9616 }
9617 }
9618
9619 public enum TypeConstraint implements OnnxTypeConstraint {
9620 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
9621 ;
9622
9623 final OnnxType.TypeVariable typeVariable;
9624
9625 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9626 assert typeVariable.name().equals(name());
9627 this.typeVariable = typeVariable;
9628 }
9629
9630 @Override
9631 public OnnxType.TypeVariable typeVariable() {
9632 return typeVariable;
9633 }
9634 }
9635
9636 public enum InputParameter implements OnnxParameter {
9637 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9638 ;
9639
9640 final OnnxType type;
9641 final Quantifier quantifier;
9642
9643 InputParameter(OnnxType type, Quantifier quantifier) {
9644 this.type = type;
9645 this.quantifier = quantifier;
9646 }
9647
9648 @Override
9649 public OnnxType type() {
9650 return type;
9651 }
9652
9653 @Override
9654 public Quantifier quantifier() {
9655 return quantifier;
9656 }
9657 }
9658
9659 public enum OutputParameter implements OnnxParameter {
9660 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9661 ;
9662
9663 final OnnxType type;
9664 final Quantifier quantifier;
9665
9666 OutputParameter(OnnxType type, Quantifier quantifier) {
9667 this.type = type;
9668 this.quantifier = quantifier;
9669 }
9670
9671 @Override
9672 public OnnxType type() {
9673 return type;
9674 }
9675
9676 @Override
9677 public Quantifier quantifier() {
9678 return quantifier;
9679 }
9680 }
9681
9682 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9683 NAME,
9684 List.of(Attribute.values()),
9685 List.of(TypeConstraint.values()),
9686 List.of(InputParameter.values()),
9687 List.of(OutputParameter.values())
9688 );
9689
9690 public Flatten(ExternalizedOp def) {
9691 super(SCHEMA, def);
9692 }
9693
9694 Flatten(Flatten that, CodeContext cc) {
9695 super(that, cc);
9696 }
9697
9698 @Override
9699 public Flatten transform(CodeContext cc, CodeTransformer ot) {
9700 return new Flatten(this, cc);
9701 }
9702
9703 Flatten(CodeType resultType, Value input, java.util.Optional<Long> axis) {
9704 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis));
9705 }
9706
9707 @Override
9708 public SequencedSet<OnnxParameter> onnxOutputs() {
9709 return onnxOutputs(SCHEMA);
9710 }
9711
9712 @Override
9713 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9714 return onnxInputs(SCHEMA, List.of(input()));
9715 }
9716
9717 public Value input() {
9718 return operands().get(0);
9719 }
9720
9721 public java.util.Optional<Long> axis() {
9722 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
9723 return java.util.Optional.ofNullable(axis);
9724 }
9725
9726 }
9727
9728 public static Flatten Flatten(CodeType resultType, Value input, java.util.Optional<Long> axis) {
9729 return new Flatten(resultType, input, axis);
9730 }
9731
9732 @OpFactoryHelper.OpDeclaration(Floor.NAME)
9733 public static final class Floor extends OnnxOp {
9734 public static final String NAME = "Floor";
9735
9736 public enum Attribute implements OnnxAttribute.None { }
9737
9738 public enum TypeConstraint implements OnnxTypeConstraint {
9739 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
9740 ;
9741
9742 final OnnxType.TypeVariable typeVariable;
9743
9744 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9745 assert typeVariable.name().equals(name());
9746 this.typeVariable = typeVariable;
9747 }
9748
9749 @Override
9750 public OnnxType.TypeVariable typeVariable() {
9751 return typeVariable;
9752 }
9753 }
9754
9755 public enum InputParameter implements OnnxParameter {
9756 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9757 ;
9758
9759 final OnnxType type;
9760 final Quantifier quantifier;
9761
9762 InputParameter(OnnxType type, Quantifier quantifier) {
9763 this.type = type;
9764 this.quantifier = quantifier;
9765 }
9766
9767 @Override
9768 public OnnxType type() {
9769 return type;
9770 }
9771
9772 @Override
9773 public Quantifier quantifier() {
9774 return quantifier;
9775 }
9776 }
9777
9778 public enum OutputParameter implements OnnxParameter {
9779 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9780 ;
9781
9782 final OnnxType type;
9783 final Quantifier quantifier;
9784
9785 OutputParameter(OnnxType type, Quantifier quantifier) {
9786 this.type = type;
9787 this.quantifier = quantifier;
9788 }
9789
9790 @Override
9791 public OnnxType type() {
9792 return type;
9793 }
9794
9795 @Override
9796 public Quantifier quantifier() {
9797 return quantifier;
9798 }
9799 }
9800
9801 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9802 NAME,
9803 List.of(Attribute.values()),
9804 List.of(TypeConstraint.values()),
9805 List.of(InputParameter.values()),
9806 List.of(OutputParameter.values())
9807 );
9808
9809 public Floor(ExternalizedOp def) {
9810 super(SCHEMA, def);
9811 }
9812
9813 Floor(Floor that, CodeContext cc) {
9814 super(that, cc);
9815 }
9816
9817 @Override
9818 public Floor transform(CodeContext cc, CodeTransformer ot) {
9819 return new Floor(this, cc);
9820 }
9821
9822 Floor(CodeType resultType, Value X) {
9823 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
9824 }
9825
9826 @Override
9827 public SequencedSet<OnnxParameter> onnxOutputs() {
9828 return onnxOutputs(SCHEMA);
9829 }
9830
9831 @Override
9832 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9833 return onnxInputs(SCHEMA, List.of(X()));
9834 }
9835
9836 public Value X() {
9837 return operands().get(0);
9838 }
9839
9840 }
9841
9842 public static Floor Floor(CodeType resultType, Value X) {
9843 return new Floor(resultType, X);
9844 }
9845
9846 @OpFactoryHelper.OpDeclaration(GRU.NAME)
9847 public static final class GRU extends OnnxOp {
9848 public static final String NAME = "GRU";
9849
9850 public enum Attribute implements OnnxAttribute {
9851 layout(Long.class, true, 0),
9852 activation_alpha(float[].class, true, null),
9853 hidden_size(Long.class, true, null),
9854 activation_beta(float[].class, true, null),
9855 activations(String[].class, true, null),
9856 linear_before_reset(Long.class, true, 0),
9857 clip(Float.class, true, null),
9858 direction(String.class, true, "forward"),
9859 ;
9860
9861 final Class<?> t;
9862 final boolean optional;
9863 final Object defaultValue;
9864
9865 Attribute(Class<?> type, boolean optional, Object defaultValue) {
9866 this.t = type;
9867 this.optional = optional;
9868 this.defaultValue = defaultValue;
9869 assert optional || defaultValue == null;
9870 }
9871
9872 public Class<?> type() {
9873 return t;
9874 }
9875
9876 public boolean isOptional() {
9877 return optional;
9878 }
9879
9880 public Object defaultValue() {
9881 return defaultValue;
9882 }
9883 }
9884
9885 public enum TypeConstraint implements OnnxTypeConstraint {
9886 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
9887 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32())))),
9888 ;
9889
9890 final OnnxType.TypeVariable typeVariable;
9891
9892 TypeConstraint(OnnxType.TypeVariable typeVariable) {
9893 assert typeVariable.name().equals(name());
9894 this.typeVariable = typeVariable;
9895 }
9896
9897 @Override
9898 public OnnxType.TypeVariable typeVariable() {
9899 return typeVariable;
9900 }
9901 }
9902
9903 public enum InputParameter implements OnnxParameter {
9904 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9905 W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9906 R(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
9907 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
9908 sequence_lens(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
9909 initial_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
9910 ;
9911
9912 final OnnxType type;
9913 final Quantifier quantifier;
9914
9915 InputParameter(OnnxType type, Quantifier quantifier) {
9916 this.type = type;
9917 this.quantifier = quantifier;
9918 }
9919
9920 @Override
9921 public OnnxType type() {
9922 return type;
9923 }
9924
9925 @Override
9926 public Quantifier quantifier() {
9927 return quantifier;
9928 }
9929 }
9930
9931 public enum OutputParameter implements OnnxParameter {
9932 Y(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
9933 Y_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
9934 ;
9935
9936 final OnnxType type;
9937 final Quantifier quantifier;
9938
9939 OutputParameter(OnnxType type, Quantifier quantifier) {
9940 this.type = type;
9941 this.quantifier = quantifier;
9942 }
9943
9944 @Override
9945 public OnnxType type() {
9946 return type;
9947 }
9948
9949 @Override
9950 public Quantifier quantifier() {
9951 return quantifier;
9952 }
9953 }
9954
9955 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
9956 NAME,
9957 List.of(Attribute.values()),
9958 List.of(TypeConstraint.values()),
9959 List.of(InputParameter.values()),
9960 List.of(OutputParameter.values())
9961 );
9962
9963 public GRU(ExternalizedOp def) {
9964 super(SCHEMA, def);
9965 }
9966
9967 GRU(GRU that, CodeContext cc) {
9968 super(that, cc);
9969 }
9970
9971 @Override
9972 public GRU transform(CodeContext cc, CodeTransformer ot) {
9973 return new GRU(this, cc);
9974 }
9975
9976 GRU(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, Value W, Value R, java.util.Optional<Value> B, java.util.Optional<Value> sequence_lens, java.util.Optional<Value> initial_h, java.util.Optional<Long> layout, java.util.Optional<float[]> activation_alpha, java.util.Optional<Long> hidden_size, java.util.Optional<float[]> activation_beta, java.util.Optional<String[]> activations, java.util.Optional<Long> linear_before_reset, java.util.Optional<Float> clip, java.util.Optional<String> direction) {
9977 super(SCHEMA, resultType, optionalOutputs, List.of(X, W, R, B, sequence_lens, initial_h), List.of(layout, activation_alpha, hidden_size, activation_beta, activations, linear_before_reset, clip, direction));
9978 }
9979
9980 @Override
9981 public SequencedSet<OnnxParameter> onnxOutputs() {
9982 return onnxOutputs(SCHEMA);
9983 }
9984
9985 @Override
9986 public SequencedMap<OnnxParameter, Object> onnxInputs() {
9987 return onnxInputs(SCHEMA, List.of(X(), W(), R(), B(), sequence_lens(), initial_h()));
9988 }
9989
9990 public Value X() {
9991 return operands().get(0);
9992 }
9993
9994 public Value W() {
9995 return operands().get(1);
9996 }
9997
9998 public Value R() {
9999 return operands().get(2);
10000 }
10001
10002 public java.util.Optional<Value> B() {
10003 int i = optionalInputArguments.indexOf(InputParameter.B);
10004 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
10005 }
10006
10007 public java.util.Optional<Value> sequence_lens() {
10008 int i = optionalInputArguments.indexOf(InputParameter.sequence_lens);
10009 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
10010 }
10011
10012 public java.util.Optional<Value> initial_h() {
10013 int i = optionalInputArguments.indexOf(InputParameter.initial_h);
10014 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
10015 }
10016
10017 public java.util.Optional<Long> layout() {
10018 Long layout = Attribute.layout.access(Long.class, onnxAttributes);
10019 return java.util.Optional.ofNullable(layout);
10020 }
10021
10022 public java.util.Optional<float[]> activation_alpha() {
10023 float[] activation_alpha = Attribute.activation_alpha.access(float[].class, onnxAttributes);
10024 return java.util.Optional.ofNullable(activation_alpha).map(float[]::clone);
10025 }
10026
10027 public java.util.Optional<Long> hidden_size() {
10028 Long hidden_size = Attribute.hidden_size.access(Long.class, onnxAttributes);
10029 return java.util.Optional.ofNullable(hidden_size);
10030 }
10031
10032 public java.util.Optional<float[]> activation_beta() {
10033 float[] activation_beta = Attribute.activation_beta.access(float[].class, onnxAttributes);
10034 return java.util.Optional.ofNullable(activation_beta).map(float[]::clone);
10035 }
10036
10037 public java.util.Optional<String[]> activations() {
10038 String[] activations = Attribute.activations.access(String[].class, onnxAttributes);
10039 return java.util.Optional.ofNullable(activations).map(String[]::clone);
10040 }
10041
10042 public java.util.Optional<Long> linear_before_reset() {
10043 Long linear_before_reset = Attribute.linear_before_reset.access(Long.class, onnxAttributes);
10044 return java.util.Optional.ofNullable(linear_before_reset);
10045 }
10046
10047 public java.util.Optional<Float> clip() {
10048 Float clip = Attribute.clip.access(Float.class, onnxAttributes);
10049 return java.util.Optional.ofNullable(clip);
10050 }
10051
10052 public java.util.Optional<String> direction() {
10053 String direction = Attribute.direction.access(String.class, onnxAttributes);
10054 return java.util.Optional.ofNullable(direction);
10055 }
10056
10057 }
10058
10059 public static GRU GRU(CodeType resultType, Set<GRU.OutputParameter> optionalOutputs, Value X, Value W, Value R, java.util.Optional<Value> B, java.util.Optional<Value> sequence_lens, java.util.Optional<Value> initial_h, java.util.Optional<Long> layout, java.util.Optional<float[]> activation_alpha, java.util.Optional<Long> hidden_size, java.util.Optional<float[]> activation_beta, java.util.Optional<String[]> activations, java.util.Optional<Long> linear_before_reset, java.util.Optional<Float> clip, java.util.Optional<String> direction) {
10060 return new GRU(resultType, optionalOutputs, X, W, R, B, sequence_lens, initial_h, layout, activation_alpha, hidden_size, activation_beta, activations, linear_before_reset, clip, direction);
10061 }
10062
10063 @OpFactoryHelper.OpDeclaration(Gather.NAME)
10064 public static final class Gather extends OnnxOp {
10065 public static final String NAME = "Gather";
10066
10067 public enum Attribute implements OnnxAttribute {
10068 axis(Long.class, true, 0),
10069 ;
10070
10071 final Class<?> t;
10072 final boolean optional;
10073 final Object defaultValue;
10074
10075 Attribute(Class<?> type, boolean optional, Object defaultValue) {
10076 this.t = type;
10077 this.optional = optional;
10078 this.defaultValue = defaultValue;
10079 assert optional || defaultValue == null;
10080 }
10081
10082 public Class<?> type() {
10083 return t;
10084 }
10085
10086 public boolean isOptional() {
10087 return optional;
10088 }
10089
10090 public Object defaultValue() {
10091 return defaultValue;
10092 }
10093 }
10094
10095 public enum TypeConstraint implements OnnxTypeConstraint {
10096 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
10097 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
10098 ;
10099
10100 final OnnxType.TypeVariable typeVariable;
10101
10102 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10103 assert typeVariable.name().equals(name());
10104 this.typeVariable = typeVariable;
10105 }
10106
10107 @Override
10108 public OnnxType.TypeVariable typeVariable() {
10109 return typeVariable;
10110 }
10111 }
10112
10113 public enum InputParameter implements OnnxParameter {
10114 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10115 indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
10116 ;
10117
10118 final OnnxType type;
10119 final Quantifier quantifier;
10120
10121 InputParameter(OnnxType type, Quantifier quantifier) {
10122 this.type = type;
10123 this.quantifier = quantifier;
10124 }
10125
10126 @Override
10127 public OnnxType type() {
10128 return type;
10129 }
10130
10131 @Override
10132 public Quantifier quantifier() {
10133 return quantifier;
10134 }
10135 }
10136
10137 public enum OutputParameter implements OnnxParameter {
10138 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10139 ;
10140
10141 final OnnxType type;
10142 final Quantifier quantifier;
10143
10144 OutputParameter(OnnxType type, Quantifier quantifier) {
10145 this.type = type;
10146 this.quantifier = quantifier;
10147 }
10148
10149 @Override
10150 public OnnxType type() {
10151 return type;
10152 }
10153
10154 @Override
10155 public Quantifier quantifier() {
10156 return quantifier;
10157 }
10158 }
10159
10160 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
10161 NAME,
10162 List.of(Attribute.values()),
10163 List.of(TypeConstraint.values()),
10164 List.of(InputParameter.values()),
10165 List.of(OutputParameter.values())
10166 );
10167
10168 public Gather(ExternalizedOp def) {
10169 super(SCHEMA, def);
10170 }
10171
10172 Gather(Gather that, CodeContext cc) {
10173 super(that, cc);
10174 }
10175
10176 @Override
10177 public Gather transform(CodeContext cc, CodeTransformer ot) {
10178 return new Gather(this, cc);
10179 }
10180
10181 Gather(CodeType resultType, Value data, Value indices, java.util.Optional<Long> axis) {
10182 super(SCHEMA, resultType, Set.of(), List.of(data, indices), List.of(axis));
10183 }
10184
10185 @Override
10186 public SequencedSet<OnnxParameter> onnxOutputs() {
10187 return onnxOutputs(SCHEMA);
10188 }
10189
10190 @Override
10191 public SequencedMap<OnnxParameter, Object> onnxInputs() {
10192 return onnxInputs(SCHEMA, List.of(data(), indices()));
10193 }
10194
10195 public Value data() {
10196 return operands().get(0);
10197 }
10198
10199 public Value indices() {
10200 return operands().get(1);
10201 }
10202
10203 public java.util.Optional<Long> axis() {
10204 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
10205 return java.util.Optional.ofNullable(axis);
10206 }
10207
10208 }
10209
10210 public static Gather Gather(CodeType resultType, Value data, Value indices, java.util.Optional<Long> axis) {
10211 return new Gather(resultType, data, indices, axis);
10212 }
10213
10214 @OpFactoryHelper.OpDeclaration(GatherElements.NAME)
10215 public static final class GatherElements extends OnnxOp {
10216 public static final String NAME = "GatherElements";
10217
10218 public enum Attribute implements OnnxAttribute {
10219 axis(Long.class, true, 0),
10220 ;
10221
10222 final Class<?> t;
10223 final boolean optional;
10224 final Object defaultValue;
10225
10226 Attribute(Class<?> type, boolean optional, Object defaultValue) {
10227 this.t = type;
10228 this.optional = optional;
10229 this.defaultValue = defaultValue;
10230 assert optional || defaultValue == null;
10231 }
10232
10233 public Class<?> type() {
10234 return t;
10235 }
10236
10237 public boolean isOptional() {
10238 return optional;
10239 }
10240
10241 public Object defaultValue() {
10242 return defaultValue;
10243 }
10244 }
10245
10246 public enum TypeConstraint implements OnnxTypeConstraint {
10247 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
10248 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
10249 ;
10250
10251 final OnnxType.TypeVariable typeVariable;
10252
10253 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10254 assert typeVariable.name().equals(name());
10255 this.typeVariable = typeVariable;
10256 }
10257
10258 @Override
10259 public OnnxType.TypeVariable typeVariable() {
10260 return typeVariable;
10261 }
10262 }
10263
10264 public enum InputParameter implements OnnxParameter {
10265 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10266 indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
10267 ;
10268
10269 final OnnxType type;
10270 final Quantifier quantifier;
10271
10272 InputParameter(OnnxType type, Quantifier quantifier) {
10273 this.type = type;
10274 this.quantifier = quantifier;
10275 }
10276
10277 @Override
10278 public OnnxType type() {
10279 return type;
10280 }
10281
10282 @Override
10283 public Quantifier quantifier() {
10284 return quantifier;
10285 }
10286 }
10287
10288 public enum OutputParameter implements OnnxParameter {
10289 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10290 ;
10291
10292 final OnnxType type;
10293 final Quantifier quantifier;
10294
10295 OutputParameter(OnnxType type, Quantifier quantifier) {
10296 this.type = type;
10297 this.quantifier = quantifier;
10298 }
10299
10300 @Override
10301 public OnnxType type() {
10302 return type;
10303 }
10304
10305 @Override
10306 public Quantifier quantifier() {
10307 return quantifier;
10308 }
10309 }
10310
10311 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
10312 NAME,
10313 List.of(Attribute.values()),
10314 List.of(TypeConstraint.values()),
10315 List.of(InputParameter.values()),
10316 List.of(OutputParameter.values())
10317 );
10318
10319 public GatherElements(ExternalizedOp def) {
10320 super(SCHEMA, def);
10321 }
10322
10323 GatherElements(GatherElements that, CodeContext cc) {
10324 super(that, cc);
10325 }
10326
10327 @Override
10328 public GatherElements transform(CodeContext cc, CodeTransformer ot) {
10329 return new GatherElements(this, cc);
10330 }
10331
10332 GatherElements(CodeType resultType, Value data, Value indices, java.util.Optional<Long> axis) {
10333 super(SCHEMA, resultType, Set.of(), List.of(data, indices), List.of(axis));
10334 }
10335
10336 @Override
10337 public SequencedSet<OnnxParameter> onnxOutputs() {
10338 return onnxOutputs(SCHEMA);
10339 }
10340
10341 @Override
10342 public SequencedMap<OnnxParameter, Object> onnxInputs() {
10343 return onnxInputs(SCHEMA, List.of(data(), indices()));
10344 }
10345
10346 public Value data() {
10347 return operands().get(0);
10348 }
10349
10350 public Value indices() {
10351 return operands().get(1);
10352 }
10353
10354 public java.util.Optional<Long> axis() {
10355 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
10356 return java.util.Optional.ofNullable(axis);
10357 }
10358
10359 }
10360
10361 public static GatherElements GatherElements(CodeType resultType, Value data, Value indices, java.util.Optional<Long> axis) {
10362 return new GatherElements(resultType, data, indices, axis);
10363 }
10364
10365 @OpFactoryHelper.OpDeclaration(GatherND.NAME)
10366 public static final class GatherND extends OnnxOp {
10367 public static final String NAME = "GatherND";
10368
10369 public enum Attribute implements OnnxAttribute {
10370 batch_dims(Long.class, true, 0),
10371 ;
10372
10373 final Class<?> t;
10374 final boolean optional;
10375 final Object defaultValue;
10376
10377 Attribute(Class<?> type, boolean optional, Object defaultValue) {
10378 this.t = type;
10379 this.optional = optional;
10380 this.defaultValue = defaultValue;
10381 assert optional || defaultValue == null;
10382 }
10383
10384 public Class<?> type() {
10385 return t;
10386 }
10387
10388 public boolean isOptional() {
10389 return optional;
10390 }
10391
10392 public Object defaultValue() {
10393 return defaultValue;
10394 }
10395 }
10396
10397 public enum TypeConstraint implements OnnxTypeConstraint {
10398 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
10399 ;
10400
10401 final OnnxType.TypeVariable typeVariable;
10402
10403 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10404 assert typeVariable.name().equals(name());
10405 this.typeVariable = typeVariable;
10406 }
10407
10408 @Override
10409 public OnnxType.TypeVariable typeVariable() {
10410 return typeVariable;
10411 }
10412 }
10413
10414 public enum InputParameter implements OnnxParameter {
10415 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10416 indices(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
10417 ;
10418
10419 final OnnxType type;
10420 final Quantifier quantifier;
10421
10422 InputParameter(OnnxType type, Quantifier quantifier) {
10423 this.type = type;
10424 this.quantifier = quantifier;
10425 }
10426
10427 @Override
10428 public OnnxType type() {
10429 return type;
10430 }
10431
10432 @Override
10433 public Quantifier quantifier() {
10434 return quantifier;
10435 }
10436 }
10437
10438 public enum OutputParameter implements OnnxParameter {
10439 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10440 ;
10441
10442 final OnnxType type;
10443 final Quantifier quantifier;
10444
10445 OutputParameter(OnnxType type, Quantifier quantifier) {
10446 this.type = type;
10447 this.quantifier = quantifier;
10448 }
10449
10450 @Override
10451 public OnnxType type() {
10452 return type;
10453 }
10454
10455 @Override
10456 public Quantifier quantifier() {
10457 return quantifier;
10458 }
10459 }
10460
10461 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
10462 NAME,
10463 List.of(Attribute.values()),
10464 List.of(TypeConstraint.values()),
10465 List.of(InputParameter.values()),
10466 List.of(OutputParameter.values())
10467 );
10468
10469 public GatherND(ExternalizedOp def) {
10470 super(SCHEMA, def);
10471 }
10472
10473 GatherND(GatherND that, CodeContext cc) {
10474 super(that, cc);
10475 }
10476
10477 @Override
10478 public GatherND transform(CodeContext cc, CodeTransformer ot) {
10479 return new GatherND(this, cc);
10480 }
10481
10482 GatherND(CodeType resultType, Value data, Value indices, java.util.Optional<Long> batch_dims) {
10483 super(SCHEMA, resultType, Set.of(), List.of(data, indices), List.of(batch_dims));
10484 }
10485
10486 @Override
10487 public SequencedSet<OnnxParameter> onnxOutputs() {
10488 return onnxOutputs(SCHEMA);
10489 }
10490
10491 @Override
10492 public SequencedMap<OnnxParameter, Object> onnxInputs() {
10493 return onnxInputs(SCHEMA, List.of(data(), indices()));
10494 }
10495
10496 public Value data() {
10497 return operands().get(0);
10498 }
10499
10500 public Value indices() {
10501 return operands().get(1);
10502 }
10503
10504 public java.util.Optional<Long> batch_dims() {
10505 Long batch_dims = Attribute.batch_dims.access(Long.class, onnxAttributes);
10506 return java.util.Optional.ofNullable(batch_dims);
10507 }
10508
10509 }
10510
10511 public static GatherND GatherND(CodeType resultType, Value data, Value indices, java.util.Optional<Long> batch_dims) {
10512 return new GatherND(resultType, data, indices, batch_dims);
10513 }
10514
10515 @OpFactoryHelper.OpDeclaration(Gelu.NAME)
10516 public static final class Gelu extends OnnxOp {
10517 public static final String NAME = "Gelu";
10518
10519 public enum Attribute implements OnnxAttribute {
10520 approximate(String.class, true, "none"),
10521 ;
10522
10523 final Class<?> t;
10524 final boolean optional;
10525 final Object defaultValue;
10526
10527 Attribute(Class<?> type, boolean optional, Object defaultValue) {
10528 this.t = type;
10529 this.optional = optional;
10530 this.defaultValue = defaultValue;
10531 assert optional || defaultValue == null;
10532 }
10533
10534 public Class<?> type() {
10535 return t;
10536 }
10537
10538 public boolean isOptional() {
10539 return optional;
10540 }
10541
10542 public Object defaultValue() {
10543 return defaultValue;
10544 }
10545 }
10546
10547 public enum TypeConstraint implements OnnxTypeConstraint {
10548 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
10549 ;
10550
10551 final OnnxType.TypeVariable typeVariable;
10552
10553 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10554 assert typeVariable.name().equals(name());
10555 this.typeVariable = typeVariable;
10556 }
10557
10558 @Override
10559 public OnnxType.TypeVariable typeVariable() {
10560 return typeVariable;
10561 }
10562 }
10563
10564 public enum InputParameter implements OnnxParameter {
10565 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10566 ;
10567
10568 final OnnxType type;
10569 final Quantifier quantifier;
10570
10571 InputParameter(OnnxType type, Quantifier quantifier) {
10572 this.type = type;
10573 this.quantifier = quantifier;
10574 }
10575
10576 @Override
10577 public OnnxType type() {
10578 return type;
10579 }
10580
10581 @Override
10582 public Quantifier quantifier() {
10583 return quantifier;
10584 }
10585 }
10586
10587 public enum OutputParameter implements OnnxParameter {
10588 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10589 ;
10590
10591 final OnnxType type;
10592 final Quantifier quantifier;
10593
10594 OutputParameter(OnnxType type, Quantifier quantifier) {
10595 this.type = type;
10596 this.quantifier = quantifier;
10597 }
10598
10599 @Override
10600 public OnnxType type() {
10601 return type;
10602 }
10603
10604 @Override
10605 public Quantifier quantifier() {
10606 return quantifier;
10607 }
10608 }
10609
10610 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
10611 NAME,
10612 List.of(Attribute.values()),
10613 List.of(TypeConstraint.values()),
10614 List.of(InputParameter.values()),
10615 List.of(OutputParameter.values())
10616 );
10617
10618 public Gelu(ExternalizedOp def) {
10619 super(SCHEMA, def);
10620 }
10621
10622 Gelu(Gelu that, CodeContext cc) {
10623 super(that, cc);
10624 }
10625
10626 @Override
10627 public Gelu transform(CodeContext cc, CodeTransformer ot) {
10628 return new Gelu(this, cc);
10629 }
10630
10631 Gelu(CodeType resultType, Value X, java.util.Optional<String> approximate) {
10632 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(approximate));
10633 }
10634
10635 @Override
10636 public SequencedSet<OnnxParameter> onnxOutputs() {
10637 return onnxOutputs(SCHEMA);
10638 }
10639
10640 @Override
10641 public SequencedMap<OnnxParameter, Object> onnxInputs() {
10642 return onnxInputs(SCHEMA, List.of(X()));
10643 }
10644
10645 public Value X() {
10646 return operands().get(0);
10647 }
10648
10649 public java.util.Optional<String> approximate() {
10650 String approximate = Attribute.approximate.access(String.class, onnxAttributes);
10651 return java.util.Optional.ofNullable(approximate);
10652 }
10653
10654 }
10655
10656 public static Gelu Gelu(CodeType resultType, Value X, java.util.Optional<String> approximate) {
10657 return new Gelu(resultType, X, approximate);
10658 }
10659
10660 @OpFactoryHelper.OpDeclaration(Gemm.NAME)
10661 public static final class Gemm extends OnnxOp {
10662 public static final String NAME = "Gemm";
10663
10664 public enum Attribute implements OnnxAttribute {
10665 alpha(Float.class, true, 1.0f),
10666 transB(Long.class, true, 0),
10667 beta(Float.class, true, 1.0f),
10668 transA(Long.class, true, 0),
10669 ;
10670
10671 final Class<?> t;
10672 final boolean optional;
10673 final Object defaultValue;
10674
10675 Attribute(Class<?> type, boolean optional, Object defaultValue) {
10676 this.t = type;
10677 this.optional = optional;
10678 this.defaultValue = defaultValue;
10679 assert optional || defaultValue == null;
10680 }
10681
10682 public Class<?> type() {
10683 return t;
10684 }
10685
10686 public boolean isOptional() {
10687 return optional;
10688 }
10689
10690 public Object defaultValue() {
10691 return defaultValue;
10692 }
10693 }
10694
10695 public enum TypeConstraint implements OnnxTypeConstraint {
10696 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16())))),
10697 ;
10698
10699 final OnnxType.TypeVariable typeVariable;
10700
10701 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10702 assert typeVariable.name().equals(name());
10703 this.typeVariable = typeVariable;
10704 }
10705
10706 @Override
10707 public OnnxType.TypeVariable typeVariable() {
10708 return typeVariable;
10709 }
10710 }
10711
10712 public enum InputParameter implements OnnxParameter {
10713 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10714 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10715 C(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
10716 ;
10717
10718 final OnnxType type;
10719 final Quantifier quantifier;
10720
10721 InputParameter(OnnxType type, Quantifier quantifier) {
10722 this.type = type;
10723 this.quantifier = quantifier;
10724 }
10725
10726 @Override
10727 public OnnxType type() {
10728 return type;
10729 }
10730
10731 @Override
10732 public Quantifier quantifier() {
10733 return quantifier;
10734 }
10735 }
10736
10737 public enum OutputParameter implements OnnxParameter {
10738 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10739 ;
10740
10741 final OnnxType type;
10742 final Quantifier quantifier;
10743
10744 OutputParameter(OnnxType type, Quantifier quantifier) {
10745 this.type = type;
10746 this.quantifier = quantifier;
10747 }
10748
10749 @Override
10750 public OnnxType type() {
10751 return type;
10752 }
10753
10754 @Override
10755 public Quantifier quantifier() {
10756 return quantifier;
10757 }
10758 }
10759
10760 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
10761 NAME,
10762 List.of(Attribute.values()),
10763 List.of(TypeConstraint.values()),
10764 List.of(InputParameter.values()),
10765 List.of(OutputParameter.values())
10766 );
10767
10768 public Gemm(ExternalizedOp def) {
10769 super(SCHEMA, def);
10770 }
10771
10772 Gemm(Gemm that, CodeContext cc) {
10773 super(that, cc);
10774 }
10775
10776 @Override
10777 public Gemm transform(CodeContext cc, CodeTransformer ot) {
10778 return new Gemm(this, cc);
10779 }
10780
10781 Gemm(CodeType resultType, Value A, Value B, java.util.Optional<Value> C, java.util.Optional<Float> alpha, java.util.Optional<Long> transB, java.util.Optional<Float> beta, java.util.Optional<Long> transA) {
10782 super(SCHEMA, resultType, Set.of(), List.of(A, B, C), List.of(alpha, transB, beta, transA));
10783 }
10784
10785 @Override
10786 public SequencedSet<OnnxParameter> onnxOutputs() {
10787 return onnxOutputs(SCHEMA);
10788 }
10789
10790 @Override
10791 public SequencedMap<OnnxParameter, Object> onnxInputs() {
10792 return onnxInputs(SCHEMA, List.of(A(), B(), C()));
10793 }
10794
10795 public Value A() {
10796 return operands().get(0);
10797 }
10798
10799 public Value B() {
10800 return operands().get(1);
10801 }
10802
10803 public java.util.Optional<Value> C() {
10804 int i = optionalInputArguments.indexOf(InputParameter.C);
10805 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
10806 }
10807
10808 public java.util.Optional<Float> alpha() {
10809 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
10810 return java.util.Optional.ofNullable(alpha);
10811 }
10812
10813 public java.util.Optional<Long> transB() {
10814 Long transB = Attribute.transB.access(Long.class, onnxAttributes);
10815 return java.util.Optional.ofNullable(transB);
10816 }
10817
10818 public java.util.Optional<Float> beta() {
10819 Float beta = Attribute.beta.access(Float.class, onnxAttributes);
10820 return java.util.Optional.ofNullable(beta);
10821 }
10822
10823 public java.util.Optional<Long> transA() {
10824 Long transA = Attribute.transA.access(Long.class, onnxAttributes);
10825 return java.util.Optional.ofNullable(transA);
10826 }
10827
10828 }
10829
10830 public static Gemm Gemm(CodeType resultType, Value A, Value B, java.util.Optional<Value> C, java.util.Optional<Float> alpha, java.util.Optional<Long> transB, java.util.Optional<Float> beta, java.util.Optional<Long> transA) {
10831 return new Gemm(resultType, A, B, C, alpha, transB, beta, transA);
10832 }
10833
10834 @OpFactoryHelper.OpDeclaration(GlobalAveragePool.NAME)
10835 public static final class GlobalAveragePool extends OnnxOp {
10836 public static final String NAME = "GlobalAveragePool";
10837
10838 public enum Attribute implements OnnxAttribute.None { }
10839
10840 public enum TypeConstraint implements OnnxTypeConstraint {
10841 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
10842 ;
10843
10844 final OnnxType.TypeVariable typeVariable;
10845
10846 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10847 assert typeVariable.name().equals(name());
10848 this.typeVariable = typeVariable;
10849 }
10850
10851 @Override
10852 public OnnxType.TypeVariable typeVariable() {
10853 return typeVariable;
10854 }
10855 }
10856
10857 public enum InputParameter implements OnnxParameter {
10858 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10859 ;
10860
10861 final OnnxType type;
10862 final Quantifier quantifier;
10863
10864 InputParameter(OnnxType type, Quantifier quantifier) {
10865 this.type = type;
10866 this.quantifier = quantifier;
10867 }
10868
10869 @Override
10870 public OnnxType type() {
10871 return type;
10872 }
10873
10874 @Override
10875 public Quantifier quantifier() {
10876 return quantifier;
10877 }
10878 }
10879
10880 public enum OutputParameter implements OnnxParameter {
10881 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10882 ;
10883
10884 final OnnxType type;
10885 final Quantifier quantifier;
10886
10887 OutputParameter(OnnxType type, Quantifier quantifier) {
10888 this.type = type;
10889 this.quantifier = quantifier;
10890 }
10891
10892 @Override
10893 public OnnxType type() {
10894 return type;
10895 }
10896
10897 @Override
10898 public Quantifier quantifier() {
10899 return quantifier;
10900 }
10901 }
10902
10903 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
10904 NAME,
10905 List.of(Attribute.values()),
10906 List.of(TypeConstraint.values()),
10907 List.of(InputParameter.values()),
10908 List.of(OutputParameter.values())
10909 );
10910
10911 public GlobalAveragePool(ExternalizedOp def) {
10912 super(SCHEMA, def);
10913 }
10914
10915 GlobalAveragePool(GlobalAveragePool that, CodeContext cc) {
10916 super(that, cc);
10917 }
10918
10919 @Override
10920 public GlobalAveragePool transform(CodeContext cc, CodeTransformer ot) {
10921 return new GlobalAveragePool(this, cc);
10922 }
10923
10924 GlobalAveragePool(CodeType resultType, Value X) {
10925 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
10926 }
10927
10928 @Override
10929 public SequencedSet<OnnxParameter> onnxOutputs() {
10930 return onnxOutputs(SCHEMA);
10931 }
10932
10933 @Override
10934 public SequencedMap<OnnxParameter, Object> onnxInputs() {
10935 return onnxInputs(SCHEMA, List.of(X()));
10936 }
10937
10938 public Value X() {
10939 return operands().get(0);
10940 }
10941
10942 }
10943
10944 public static GlobalAveragePool GlobalAveragePool(CodeType resultType, Value X) {
10945 return new GlobalAveragePool(resultType, X);
10946 }
10947
10948 @OpFactoryHelper.OpDeclaration(GlobalLpPool.NAME)
10949 public static final class GlobalLpPool extends OnnxOp {
10950 public static final String NAME = "GlobalLpPool";
10951
10952 public enum Attribute implements OnnxAttribute {
10953 p(Long.class, true, 2),
10954 ;
10955
10956 final Class<?> t;
10957 final boolean optional;
10958 final Object defaultValue;
10959
10960 Attribute(Class<?> type, boolean optional, Object defaultValue) {
10961 this.t = type;
10962 this.optional = optional;
10963 this.defaultValue = defaultValue;
10964 assert optional || defaultValue == null;
10965 }
10966
10967 public Class<?> type() {
10968 return t;
10969 }
10970
10971 public boolean isOptional() {
10972 return optional;
10973 }
10974
10975 public Object defaultValue() {
10976 return defaultValue;
10977 }
10978 }
10979
10980 public enum TypeConstraint implements OnnxTypeConstraint {
10981 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
10982 ;
10983
10984 final OnnxType.TypeVariable typeVariable;
10985
10986 TypeConstraint(OnnxType.TypeVariable typeVariable) {
10987 assert typeVariable.name().equals(name());
10988 this.typeVariable = typeVariable;
10989 }
10990
10991 @Override
10992 public OnnxType.TypeVariable typeVariable() {
10993 return typeVariable;
10994 }
10995 }
10996
10997 public enum InputParameter implements OnnxParameter {
10998 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
10999 ;
11000
11001 final OnnxType type;
11002 final Quantifier quantifier;
11003
11004 InputParameter(OnnxType type, Quantifier quantifier) {
11005 this.type = type;
11006 this.quantifier = quantifier;
11007 }
11008
11009 @Override
11010 public OnnxType type() {
11011 return type;
11012 }
11013
11014 @Override
11015 public Quantifier quantifier() {
11016 return quantifier;
11017 }
11018 }
11019
11020 public enum OutputParameter implements OnnxParameter {
11021 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11022 ;
11023
11024 final OnnxType type;
11025 final Quantifier quantifier;
11026
11027 OutputParameter(OnnxType type, Quantifier quantifier) {
11028 this.type = type;
11029 this.quantifier = quantifier;
11030 }
11031
11032 @Override
11033 public OnnxType type() {
11034 return type;
11035 }
11036
11037 @Override
11038 public Quantifier quantifier() {
11039 return quantifier;
11040 }
11041 }
11042
11043 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11044 NAME,
11045 List.of(Attribute.values()),
11046 List.of(TypeConstraint.values()),
11047 List.of(InputParameter.values()),
11048 List.of(OutputParameter.values())
11049 );
11050
11051 public GlobalLpPool(ExternalizedOp def) {
11052 super(SCHEMA, def);
11053 }
11054
11055 GlobalLpPool(GlobalLpPool that, CodeContext cc) {
11056 super(that, cc);
11057 }
11058
11059 @Override
11060 public GlobalLpPool transform(CodeContext cc, CodeTransformer ot) {
11061 return new GlobalLpPool(this, cc);
11062 }
11063
11064 GlobalLpPool(CodeType resultType, Value X, java.util.Optional<Long> p) {
11065 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(p));
11066 }
11067
11068 @Override
11069 public SequencedSet<OnnxParameter> onnxOutputs() {
11070 return onnxOutputs(SCHEMA);
11071 }
11072
11073 @Override
11074 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11075 return onnxInputs(SCHEMA, List.of(X()));
11076 }
11077
11078 public Value X() {
11079 return operands().get(0);
11080 }
11081
11082 public java.util.Optional<Long> p() {
11083 Long p = Attribute.p.access(Long.class, onnxAttributes);
11084 return java.util.Optional.ofNullable(p);
11085 }
11086
11087 }
11088
11089 public static GlobalLpPool GlobalLpPool(CodeType resultType, Value X, java.util.Optional<Long> p) {
11090 return new GlobalLpPool(resultType, X, p);
11091 }
11092
11093 @OpFactoryHelper.OpDeclaration(GlobalMaxPool.NAME)
11094 public static final class GlobalMaxPool extends OnnxOp {
11095 public static final String NAME = "GlobalMaxPool";
11096
11097 public enum Attribute implements OnnxAttribute.None { }
11098
11099 public enum TypeConstraint implements OnnxTypeConstraint {
11100 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
11101 ;
11102
11103 final OnnxType.TypeVariable typeVariable;
11104
11105 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11106 assert typeVariable.name().equals(name());
11107 this.typeVariable = typeVariable;
11108 }
11109
11110 @Override
11111 public OnnxType.TypeVariable typeVariable() {
11112 return typeVariable;
11113 }
11114 }
11115
11116 public enum InputParameter implements OnnxParameter {
11117 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11118 ;
11119
11120 final OnnxType type;
11121 final Quantifier quantifier;
11122
11123 InputParameter(OnnxType type, Quantifier quantifier) {
11124 this.type = type;
11125 this.quantifier = quantifier;
11126 }
11127
11128 @Override
11129 public OnnxType type() {
11130 return type;
11131 }
11132
11133 @Override
11134 public Quantifier quantifier() {
11135 return quantifier;
11136 }
11137 }
11138
11139 public enum OutputParameter implements OnnxParameter {
11140 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11141 ;
11142
11143 final OnnxType type;
11144 final Quantifier quantifier;
11145
11146 OutputParameter(OnnxType type, Quantifier quantifier) {
11147 this.type = type;
11148 this.quantifier = quantifier;
11149 }
11150
11151 @Override
11152 public OnnxType type() {
11153 return type;
11154 }
11155
11156 @Override
11157 public Quantifier quantifier() {
11158 return quantifier;
11159 }
11160 }
11161
11162 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11163 NAME,
11164 List.of(Attribute.values()),
11165 List.of(TypeConstraint.values()),
11166 List.of(InputParameter.values()),
11167 List.of(OutputParameter.values())
11168 );
11169
11170 public GlobalMaxPool(ExternalizedOp def) {
11171 super(SCHEMA, def);
11172 }
11173
11174 GlobalMaxPool(GlobalMaxPool that, CodeContext cc) {
11175 super(that, cc);
11176 }
11177
11178 @Override
11179 public GlobalMaxPool transform(CodeContext cc, CodeTransformer ot) {
11180 return new GlobalMaxPool(this, cc);
11181 }
11182
11183 GlobalMaxPool(CodeType resultType, Value X) {
11184 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
11185 }
11186
11187 @Override
11188 public SequencedSet<OnnxParameter> onnxOutputs() {
11189 return onnxOutputs(SCHEMA);
11190 }
11191
11192 @Override
11193 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11194 return onnxInputs(SCHEMA, List.of(X()));
11195 }
11196
11197 public Value X() {
11198 return operands().get(0);
11199 }
11200
11201 }
11202
11203 public static GlobalMaxPool GlobalMaxPool(CodeType resultType, Value X) {
11204 return new GlobalMaxPool(resultType, X);
11205 }
11206
11207 @OpFactoryHelper.OpDeclaration(Gradient.NAME)
11208 public static final class Gradient extends OnnxOp {
11209 public static final String NAME = "Gradient";
11210
11211 public enum Attribute implements OnnxAttribute {
11212 y(String.class, false, null),
11213 zs(String[].class, true, null),
11214 xs(String[].class, false, null),
11215 ;
11216
11217 final Class<?> t;
11218 final boolean optional;
11219 final Object defaultValue;
11220
11221 Attribute(Class<?> type, boolean optional, Object defaultValue) {
11222 this.t = type;
11223 this.optional = optional;
11224 this.defaultValue = defaultValue;
11225 assert optional || defaultValue == null;
11226 }
11227
11228 public Class<?> type() {
11229 return t;
11230 }
11231
11232 public boolean isOptional() {
11233 return optional;
11234 }
11235
11236 public Object defaultValue() {
11237 return defaultValue;
11238 }
11239 }
11240
11241 public enum TypeConstraint implements OnnxTypeConstraint {
11242 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
11243 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
11244 ;
11245
11246 final OnnxType.TypeVariable typeVariable;
11247
11248 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11249 assert typeVariable.name().equals(name());
11250 this.typeVariable = typeVariable;
11251 }
11252
11253 @Override
11254 public OnnxType.TypeVariable typeVariable() {
11255 return typeVariable;
11256 }
11257 }
11258
11259 public enum InputParameter implements OnnxParameter {
11260 Inputs(TypeConstraint.T1.typeVariable(), Quantifier.VARIADIC),
11261 ;
11262
11263 final OnnxType type;
11264 final Quantifier quantifier;
11265
11266 InputParameter(OnnxType type, Quantifier quantifier) {
11267 this.type = type;
11268 this.quantifier = quantifier;
11269 }
11270
11271 @Override
11272 public OnnxType type() {
11273 return type;
11274 }
11275
11276 @Override
11277 public Quantifier quantifier() {
11278 return quantifier;
11279 }
11280 }
11281
11282 public enum OutputParameter implements OnnxParameter {
11283 Outputs(TypeConstraint.T2.typeVariable(), Quantifier.VARIADIC),
11284 ;
11285
11286 final OnnxType type;
11287 final Quantifier quantifier;
11288
11289 OutputParameter(OnnxType type, Quantifier quantifier) {
11290 this.type = type;
11291 this.quantifier = quantifier;
11292 }
11293
11294 @Override
11295 public OnnxType type() {
11296 return type;
11297 }
11298
11299 @Override
11300 public Quantifier quantifier() {
11301 return quantifier;
11302 }
11303 }
11304
11305 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11306 NAME,
11307 List.of(Attribute.values()),
11308 List.of(TypeConstraint.values()),
11309 List.of(InputParameter.values()),
11310 List.of(OutputParameter.values())
11311 );
11312
11313 public Gradient(ExternalizedOp def) {
11314 super(SCHEMA, def);
11315 }
11316
11317 Gradient(Gradient that, CodeContext cc) {
11318 super(that, cc);
11319 }
11320
11321 @Override
11322 public Gradient transform(CodeContext cc, CodeTransformer ot) {
11323 return new Gradient(this, cc);
11324 }
11325
11326 Gradient(CodeType resultType, List<Value> Inputs, String y, java.util.Optional<String[]> zs, String[] xs) {
11327 super(SCHEMA, resultType, Set.of(), List.of(Inputs), List.of(y, zs, xs));
11328 }
11329
11330 @Override
11331 public SequencedSet<OnnxParameter> onnxOutputs() {
11332 return onnxOutputs(SCHEMA);
11333 }
11334
11335 @Override
11336 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11337 return onnxInputs(SCHEMA, List.of(Inputs()));
11338 }
11339
11340 public List<Value> Inputs() {
11341 return operands();
11342 }
11343
11344 public String y() {
11345 String y = Attribute.y.access(String.class, onnxAttributes);
11346 return y;
11347 }
11348
11349 public java.util.Optional<String[]> zs() {
11350 String[] zs = Attribute.zs.access(String[].class, onnxAttributes);
11351 return java.util.Optional.ofNullable(zs).map(String[]::clone);
11352 }
11353
11354 public String[] xs() {
11355 String[] xs = Attribute.xs.access(String[].class, onnxAttributes);
11356 return xs.clone();
11357 }
11358
11359 }
11360
11361 public static Gradient Gradient(CodeType resultType, List<Value> Inputs, String y, java.util.Optional<String[]> zs, String[] xs) {
11362 return new Gradient(resultType, Inputs, y, zs, xs);
11363 }
11364
11365 @OpFactoryHelper.OpDeclaration(Greater.NAME)
11366 public static final class Greater extends OnnxOp {
11367 public static final String NAME = "Greater";
11368
11369 public enum Attribute implements OnnxAttribute.None { }
11370
11371 public enum TypeConstraint implements OnnxTypeConstraint {
11372 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
11373 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
11374 ;
11375
11376 final OnnxType.TypeVariable typeVariable;
11377
11378 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11379 assert typeVariable.name().equals(name());
11380 this.typeVariable = typeVariable;
11381 }
11382
11383 @Override
11384 public OnnxType.TypeVariable typeVariable() {
11385 return typeVariable;
11386 }
11387 }
11388
11389 public enum InputParameter implements OnnxParameter {
11390 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11391 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11392 ;
11393
11394 final OnnxType type;
11395 final Quantifier quantifier;
11396
11397 InputParameter(OnnxType type, Quantifier quantifier) {
11398 this.type = type;
11399 this.quantifier = quantifier;
11400 }
11401
11402 @Override
11403 public OnnxType type() {
11404 return type;
11405 }
11406
11407 @Override
11408 public Quantifier quantifier() {
11409 return quantifier;
11410 }
11411 }
11412
11413 public enum OutputParameter implements OnnxParameter {
11414 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
11415 ;
11416
11417 final OnnxType type;
11418 final Quantifier quantifier;
11419
11420 OutputParameter(OnnxType type, Quantifier quantifier) {
11421 this.type = type;
11422 this.quantifier = quantifier;
11423 }
11424
11425 @Override
11426 public OnnxType type() {
11427 return type;
11428 }
11429
11430 @Override
11431 public Quantifier quantifier() {
11432 return quantifier;
11433 }
11434 }
11435
11436 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11437 NAME,
11438 List.of(Attribute.values()),
11439 List.of(TypeConstraint.values()),
11440 List.of(InputParameter.values()),
11441 List.of(OutputParameter.values())
11442 );
11443
11444 public Greater(ExternalizedOp def) {
11445 super(SCHEMA, def);
11446 }
11447
11448 Greater(Greater that, CodeContext cc) {
11449 super(that, cc);
11450 }
11451
11452 @Override
11453 public Greater transform(CodeContext cc, CodeTransformer ot) {
11454 return new Greater(this, cc);
11455 }
11456
11457 Greater(CodeType resultType, Value A, Value B) {
11458 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
11459 }
11460
11461 @Override
11462 public SequencedSet<OnnxParameter> onnxOutputs() {
11463 return onnxOutputs(SCHEMA);
11464 }
11465
11466 @Override
11467 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11468 return onnxInputs(SCHEMA, List.of(A(), B()));
11469 }
11470
11471 public Value A() {
11472 return operands().get(0);
11473 }
11474
11475 public Value B() {
11476 return operands().get(1);
11477 }
11478
11479 }
11480
11481 public static Greater Greater(CodeType resultType, Value A, Value B) {
11482 return new Greater(resultType, A, B);
11483 }
11484
11485 @OpFactoryHelper.OpDeclaration(GreaterOrEqual.NAME)
11486 public static final class GreaterOrEqual extends OnnxOp {
11487 public static final String NAME = "GreaterOrEqual";
11488
11489 public enum Attribute implements OnnxAttribute.None { }
11490
11491 public enum TypeConstraint implements OnnxTypeConstraint {
11492 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
11493 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
11494 ;
11495
11496 final OnnxType.TypeVariable typeVariable;
11497
11498 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11499 assert typeVariable.name().equals(name());
11500 this.typeVariable = typeVariable;
11501 }
11502
11503 @Override
11504 public OnnxType.TypeVariable typeVariable() {
11505 return typeVariable;
11506 }
11507 }
11508
11509 public enum InputParameter implements OnnxParameter {
11510 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11511 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11512 ;
11513
11514 final OnnxType type;
11515 final Quantifier quantifier;
11516
11517 InputParameter(OnnxType type, Quantifier quantifier) {
11518 this.type = type;
11519 this.quantifier = quantifier;
11520 }
11521
11522 @Override
11523 public OnnxType type() {
11524 return type;
11525 }
11526
11527 @Override
11528 public Quantifier quantifier() {
11529 return quantifier;
11530 }
11531 }
11532
11533 public enum OutputParameter implements OnnxParameter {
11534 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
11535 ;
11536
11537 final OnnxType type;
11538 final Quantifier quantifier;
11539
11540 OutputParameter(OnnxType type, Quantifier quantifier) {
11541 this.type = type;
11542 this.quantifier = quantifier;
11543 }
11544
11545 @Override
11546 public OnnxType type() {
11547 return type;
11548 }
11549
11550 @Override
11551 public Quantifier quantifier() {
11552 return quantifier;
11553 }
11554 }
11555
11556 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11557 NAME,
11558 List.of(Attribute.values()),
11559 List.of(TypeConstraint.values()),
11560 List.of(InputParameter.values()),
11561 List.of(OutputParameter.values())
11562 );
11563
11564 public GreaterOrEqual(ExternalizedOp def) {
11565 super(SCHEMA, def);
11566 }
11567
11568 GreaterOrEqual(GreaterOrEqual that, CodeContext cc) {
11569 super(that, cc);
11570 }
11571
11572 @Override
11573 public GreaterOrEqual transform(CodeContext cc, CodeTransformer ot) {
11574 return new GreaterOrEqual(this, cc);
11575 }
11576
11577 GreaterOrEqual(CodeType resultType, Value A, Value B) {
11578 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
11579 }
11580
11581 @Override
11582 public SequencedSet<OnnxParameter> onnxOutputs() {
11583 return onnxOutputs(SCHEMA);
11584 }
11585
11586 @Override
11587 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11588 return onnxInputs(SCHEMA, List.of(A(), B()));
11589 }
11590
11591 public Value A() {
11592 return operands().get(0);
11593 }
11594
11595 public Value B() {
11596 return operands().get(1);
11597 }
11598
11599 }
11600
11601 public static GreaterOrEqual GreaterOrEqual(CodeType resultType, Value A, Value B) {
11602 return new GreaterOrEqual(resultType, A, B);
11603 }
11604
11605 @OpFactoryHelper.OpDeclaration(GridSample.NAME)
11606 public static final class GridSample extends OnnxOp {
11607 public static final String NAME = "GridSample";
11608
11609 public enum Attribute implements OnnxAttribute {
11610 mode(String.class, true, "linear"),
11611 align_corners(Long.class, true, 0),
11612 padding_mode(String.class, true, "zeros"),
11613 ;
11614
11615 final Class<?> t;
11616 final boolean optional;
11617 final Object defaultValue;
11618
11619 Attribute(Class<?> type, boolean optional, Object defaultValue) {
11620 this.t = type;
11621 this.optional = optional;
11622 this.defaultValue = defaultValue;
11623 assert optional || defaultValue == null;
11624 }
11625
11626 public Class<?> type() {
11627 return t;
11628 }
11629
11630 public boolean isOptional() {
11631 return optional;
11632 }
11633
11634 public Object defaultValue() {
11635 return defaultValue;
11636 }
11637 }
11638
11639 public enum TypeConstraint implements OnnxTypeConstraint {
11640 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
11641 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
11642 ;
11643
11644 final OnnxType.TypeVariable typeVariable;
11645
11646 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11647 assert typeVariable.name().equals(name());
11648 this.typeVariable = typeVariable;
11649 }
11650
11651 @Override
11652 public OnnxType.TypeVariable typeVariable() {
11653 return typeVariable;
11654 }
11655 }
11656
11657 public enum InputParameter implements OnnxParameter {
11658 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
11659 grid(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
11660 ;
11661
11662 final OnnxType type;
11663 final Quantifier quantifier;
11664
11665 InputParameter(OnnxType type, Quantifier quantifier) {
11666 this.type = type;
11667 this.quantifier = quantifier;
11668 }
11669
11670 @Override
11671 public OnnxType type() {
11672 return type;
11673 }
11674
11675 @Override
11676 public Quantifier quantifier() {
11677 return quantifier;
11678 }
11679 }
11680
11681 public enum OutputParameter implements OnnxParameter {
11682 Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
11683 ;
11684
11685 final OnnxType type;
11686 final Quantifier quantifier;
11687
11688 OutputParameter(OnnxType type, Quantifier quantifier) {
11689 this.type = type;
11690 this.quantifier = quantifier;
11691 }
11692
11693 @Override
11694 public OnnxType type() {
11695 return type;
11696 }
11697
11698 @Override
11699 public Quantifier quantifier() {
11700 return quantifier;
11701 }
11702 }
11703
11704 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11705 NAME,
11706 List.of(Attribute.values()),
11707 List.of(TypeConstraint.values()),
11708 List.of(InputParameter.values()),
11709 List.of(OutputParameter.values())
11710 );
11711
11712 public GridSample(ExternalizedOp def) {
11713 super(SCHEMA, def);
11714 }
11715
11716 GridSample(GridSample that, CodeContext cc) {
11717 super(that, cc);
11718 }
11719
11720 @Override
11721 public GridSample transform(CodeContext cc, CodeTransformer ot) {
11722 return new GridSample(this, cc);
11723 }
11724
11725 GridSample(CodeType resultType, Value X, Value grid, java.util.Optional<String> mode, java.util.Optional<Long> align_corners, java.util.Optional<String> padding_mode) {
11726 super(SCHEMA, resultType, Set.of(), List.of(X, grid), List.of(mode, align_corners, padding_mode));
11727 }
11728
11729 @Override
11730 public SequencedSet<OnnxParameter> onnxOutputs() {
11731 return onnxOutputs(SCHEMA);
11732 }
11733
11734 @Override
11735 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11736 return onnxInputs(SCHEMA, List.of(X(), grid()));
11737 }
11738
11739 public Value X() {
11740 return operands().get(0);
11741 }
11742
11743 public Value grid() {
11744 return operands().get(1);
11745 }
11746
11747 public java.util.Optional<String> mode() {
11748 String mode = Attribute.mode.access(String.class, onnxAttributes);
11749 return java.util.Optional.ofNullable(mode);
11750 }
11751
11752 public java.util.Optional<Long> align_corners() {
11753 Long align_corners = Attribute.align_corners.access(Long.class, onnxAttributes);
11754 return java.util.Optional.ofNullable(align_corners);
11755 }
11756
11757 public java.util.Optional<String> padding_mode() {
11758 String padding_mode = Attribute.padding_mode.access(String.class, onnxAttributes);
11759 return java.util.Optional.ofNullable(padding_mode);
11760 }
11761
11762 }
11763
11764 public static GridSample GridSample(CodeType resultType, Value X, Value grid, java.util.Optional<String> mode, java.util.Optional<Long> align_corners, java.util.Optional<String> padding_mode) {
11765 return new GridSample(resultType, X, grid, mode, align_corners, padding_mode);
11766 }
11767
11768 @OpFactoryHelper.OpDeclaration(GroupNormalization.NAME)
11769 public static final class GroupNormalization extends OnnxOp {
11770 public static final String NAME = "GroupNormalization";
11771
11772 public enum Attribute implements OnnxAttribute {
11773 epsilon(Float.class, true, 1.0E-5f),
11774 stash_type(Long.class, true, 1),
11775 num_groups(Long.class, false, null),
11776 ;
11777
11778 final Class<?> t;
11779 final boolean optional;
11780 final Object defaultValue;
11781
11782 Attribute(Class<?> type, boolean optional, Object defaultValue) {
11783 this.t = type;
11784 this.optional = optional;
11785 this.defaultValue = defaultValue;
11786 assert optional || defaultValue == null;
11787 }
11788
11789 public Class<?> type() {
11790 return t;
11791 }
11792
11793 public boolean isOptional() {
11794 return optional;
11795 }
11796
11797 public Object defaultValue() {
11798 return defaultValue;
11799 }
11800 }
11801
11802 public enum TypeConstraint implements OnnxTypeConstraint {
11803 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
11804 ;
11805
11806 final OnnxType.TypeVariable typeVariable;
11807
11808 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11809 assert typeVariable.name().equals(name());
11810 this.typeVariable = typeVariable;
11811 }
11812
11813 @Override
11814 public OnnxType.TypeVariable typeVariable() {
11815 return typeVariable;
11816 }
11817 }
11818
11819 public enum InputParameter implements OnnxParameter {
11820 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11821 scale(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11822 bias(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11823 ;
11824
11825 final OnnxType type;
11826 final Quantifier quantifier;
11827
11828 InputParameter(OnnxType type, Quantifier quantifier) {
11829 this.type = type;
11830 this.quantifier = quantifier;
11831 }
11832
11833 @Override
11834 public OnnxType type() {
11835 return type;
11836 }
11837
11838 @Override
11839 public Quantifier quantifier() {
11840 return quantifier;
11841 }
11842 }
11843
11844 public enum OutputParameter implements OnnxParameter {
11845 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
11846 ;
11847
11848 final OnnxType type;
11849 final Quantifier quantifier;
11850
11851 OutputParameter(OnnxType type, Quantifier quantifier) {
11852 this.type = type;
11853 this.quantifier = quantifier;
11854 }
11855
11856 @Override
11857 public OnnxType type() {
11858 return type;
11859 }
11860
11861 @Override
11862 public Quantifier quantifier() {
11863 return quantifier;
11864 }
11865 }
11866
11867 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
11868 NAME,
11869 List.of(Attribute.values()),
11870 List.of(TypeConstraint.values()),
11871 List.of(InputParameter.values()),
11872 List.of(OutputParameter.values())
11873 );
11874
11875 public GroupNormalization(ExternalizedOp def) {
11876 super(SCHEMA, def);
11877 }
11878
11879 GroupNormalization(GroupNormalization that, CodeContext cc) {
11880 super(that, cc);
11881 }
11882
11883 @Override
11884 public GroupNormalization transform(CodeContext cc, CodeTransformer ot) {
11885 return new GroupNormalization(this, cc);
11886 }
11887
11888 GroupNormalization(CodeType resultType, Value X, Value scale, Value bias, java.util.Optional<Float> epsilon, java.util.Optional<Long> stash_type, long num_groups) {
11889 super(SCHEMA, resultType, Set.of(), List.of(X, scale, bias), List.of(epsilon, stash_type, num_groups));
11890 }
11891
11892 @Override
11893 public SequencedSet<OnnxParameter> onnxOutputs() {
11894 return onnxOutputs(SCHEMA);
11895 }
11896
11897 @Override
11898 public SequencedMap<OnnxParameter, Object> onnxInputs() {
11899 return onnxInputs(SCHEMA, List.of(X(), scale(), bias()));
11900 }
11901
11902 public Value X() {
11903 return operands().get(0);
11904 }
11905
11906 public Value scale() {
11907 return operands().get(1);
11908 }
11909
11910 public Value bias() {
11911 return operands().get(2);
11912 }
11913
11914 public java.util.Optional<Float> epsilon() {
11915 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
11916 return java.util.Optional.ofNullable(epsilon);
11917 }
11918
11919 public java.util.Optional<Long> stash_type() {
11920 Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes);
11921 return java.util.Optional.ofNullable(stash_type);
11922 }
11923
11924 public long num_groups() {
11925 long num_groups = Attribute.num_groups.access(Long.class, onnxAttributes);
11926 return num_groups;
11927 }
11928
11929 }
11930
11931 public static GroupNormalization GroupNormalization(CodeType resultType, Value X, Value scale, Value bias, java.util.Optional<Float> epsilon, java.util.Optional<Long> stash_type, long num_groups) {
11932 return new GroupNormalization(resultType, X, scale, bias, epsilon, stash_type, num_groups);
11933 }
11934
11935 @OpFactoryHelper.OpDeclaration(HammingWindow.NAME)
11936 public static final class HammingWindow extends OnnxOp {
11937 public static final String NAME = "HammingWindow";
11938
11939 public enum Attribute implements OnnxAttribute {
11940 periodic(Long.class, true, 1),
11941 output_datatype(Long.class, true, 1),
11942 ;
11943
11944 final Class<?> t;
11945 final boolean optional;
11946 final Object defaultValue;
11947
11948 Attribute(Class<?> type, boolean optional, Object defaultValue) {
11949 this.t = type;
11950 this.optional = optional;
11951 this.defaultValue = defaultValue;
11952 assert optional || defaultValue == null;
11953 }
11954
11955 public Class<?> type() {
11956 return t;
11957 }
11958
11959 public boolean isOptional() {
11960 return optional;
11961 }
11962
11963 public Object defaultValue() {
11964 return defaultValue;
11965 }
11966 }
11967
11968 public enum TypeConstraint implements OnnxTypeConstraint {
11969 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
11970 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
11971 ;
11972
11973 final OnnxType.TypeVariable typeVariable;
11974
11975 TypeConstraint(OnnxType.TypeVariable typeVariable) {
11976 assert typeVariable.name().equals(name());
11977 this.typeVariable = typeVariable;
11978 }
11979
11980 @Override
11981 public OnnxType.TypeVariable typeVariable() {
11982 return typeVariable;
11983 }
11984 }
11985
11986 public enum InputParameter implements OnnxParameter {
11987 size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
11988 ;
11989
11990 final OnnxType type;
11991 final Quantifier quantifier;
11992
11993 InputParameter(OnnxType type, Quantifier quantifier) {
11994 this.type = type;
11995 this.quantifier = quantifier;
11996 }
11997
11998 @Override
11999 public OnnxType type() {
12000 return type;
12001 }
12002
12003 @Override
12004 public Quantifier quantifier() {
12005 return quantifier;
12006 }
12007 }
12008
12009 public enum OutputParameter implements OnnxParameter {
12010 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
12011 ;
12012
12013 final OnnxType type;
12014 final Quantifier quantifier;
12015
12016 OutputParameter(OnnxType type, Quantifier quantifier) {
12017 this.type = type;
12018 this.quantifier = quantifier;
12019 }
12020
12021 @Override
12022 public OnnxType type() {
12023 return type;
12024 }
12025
12026 @Override
12027 public Quantifier quantifier() {
12028 return quantifier;
12029 }
12030 }
12031
12032 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12033 NAME,
12034 List.of(Attribute.values()),
12035 List.of(TypeConstraint.values()),
12036 List.of(InputParameter.values()),
12037 List.of(OutputParameter.values())
12038 );
12039
12040 public HammingWindow(ExternalizedOp def) {
12041 super(SCHEMA, def);
12042 }
12043
12044 HammingWindow(HammingWindow that, CodeContext cc) {
12045 super(that, cc);
12046 }
12047
12048 @Override
12049 public HammingWindow transform(CodeContext cc, CodeTransformer ot) {
12050 return new HammingWindow(this, cc);
12051 }
12052
12053 HammingWindow(CodeType resultType, Value size, java.util.Optional<Long> periodic, java.util.Optional<Long> output_datatype) {
12054 super(SCHEMA, resultType, Set.of(), List.of(size), List.of(periodic, output_datatype));
12055 }
12056
12057 @Override
12058 public SequencedSet<OnnxParameter> onnxOutputs() {
12059 return onnxOutputs(SCHEMA);
12060 }
12061
12062 @Override
12063 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12064 return onnxInputs(SCHEMA, List.of(size()));
12065 }
12066
12067 public Value size() {
12068 return operands().get(0);
12069 }
12070
12071 public java.util.Optional<Long> periodic() {
12072 Long periodic = Attribute.periodic.access(Long.class, onnxAttributes);
12073 return java.util.Optional.ofNullable(periodic);
12074 }
12075
12076 public java.util.Optional<Long> output_datatype() {
12077 Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes);
12078 return java.util.Optional.ofNullable(output_datatype);
12079 }
12080
12081 }
12082
12083 public static HammingWindow HammingWindow(CodeType resultType, Value size, java.util.Optional<Long> periodic, java.util.Optional<Long> output_datatype) {
12084 return new HammingWindow(resultType, size, periodic, output_datatype);
12085 }
12086
12087 @OpFactoryHelper.OpDeclaration(HannWindow.NAME)
12088 public static final class HannWindow extends OnnxOp {
12089 public static final String NAME = "HannWindow";
12090
12091 public enum Attribute implements OnnxAttribute {
12092 periodic(Long.class, true, 1),
12093 output_datatype(Long.class, true, 1),
12094 ;
12095
12096 final Class<?> t;
12097 final boolean optional;
12098 final Object defaultValue;
12099
12100 Attribute(Class<?> type, boolean optional, Object defaultValue) {
12101 this.t = type;
12102 this.optional = optional;
12103 this.defaultValue = defaultValue;
12104 assert optional || defaultValue == null;
12105 }
12106
12107 public Class<?> type() {
12108 return t;
12109 }
12110
12111 public boolean isOptional() {
12112 return optional;
12113 }
12114
12115 public Object defaultValue() {
12116 return defaultValue;
12117 }
12118 }
12119
12120 public enum TypeConstraint implements OnnxTypeConstraint {
12121 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
12122 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
12123 ;
12124
12125 final OnnxType.TypeVariable typeVariable;
12126
12127 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12128 assert typeVariable.name().equals(name());
12129 this.typeVariable = typeVariable;
12130 }
12131
12132 @Override
12133 public OnnxType.TypeVariable typeVariable() {
12134 return typeVariable;
12135 }
12136 }
12137
12138 public enum InputParameter implements OnnxParameter {
12139 size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
12140 ;
12141
12142 final OnnxType type;
12143 final Quantifier quantifier;
12144
12145 InputParameter(OnnxType type, Quantifier quantifier) {
12146 this.type = type;
12147 this.quantifier = quantifier;
12148 }
12149
12150 @Override
12151 public OnnxType type() {
12152 return type;
12153 }
12154
12155 @Override
12156 public Quantifier quantifier() {
12157 return quantifier;
12158 }
12159 }
12160
12161 public enum OutputParameter implements OnnxParameter {
12162 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
12163 ;
12164
12165 final OnnxType type;
12166 final Quantifier quantifier;
12167
12168 OutputParameter(OnnxType type, Quantifier quantifier) {
12169 this.type = type;
12170 this.quantifier = quantifier;
12171 }
12172
12173 @Override
12174 public OnnxType type() {
12175 return type;
12176 }
12177
12178 @Override
12179 public Quantifier quantifier() {
12180 return quantifier;
12181 }
12182 }
12183
12184 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12185 NAME,
12186 List.of(Attribute.values()),
12187 List.of(TypeConstraint.values()),
12188 List.of(InputParameter.values()),
12189 List.of(OutputParameter.values())
12190 );
12191
12192 public HannWindow(ExternalizedOp def) {
12193 super(SCHEMA, def);
12194 }
12195
12196 HannWindow(HannWindow that, CodeContext cc) {
12197 super(that, cc);
12198 }
12199
12200 @Override
12201 public HannWindow transform(CodeContext cc, CodeTransformer ot) {
12202 return new HannWindow(this, cc);
12203 }
12204
12205 HannWindow(CodeType resultType, Value size, java.util.Optional<Long> periodic, java.util.Optional<Long> output_datatype) {
12206 super(SCHEMA, resultType, Set.of(), List.of(size), List.of(periodic, output_datatype));
12207 }
12208
12209 @Override
12210 public SequencedSet<OnnxParameter> onnxOutputs() {
12211 return onnxOutputs(SCHEMA);
12212 }
12213
12214 @Override
12215 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12216 return onnxInputs(SCHEMA, List.of(size()));
12217 }
12218
12219 public Value size() {
12220 return operands().get(0);
12221 }
12222
12223 public java.util.Optional<Long> periodic() {
12224 Long periodic = Attribute.periodic.access(Long.class, onnxAttributes);
12225 return java.util.Optional.ofNullable(periodic);
12226 }
12227
12228 public java.util.Optional<Long> output_datatype() {
12229 Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes);
12230 return java.util.Optional.ofNullable(output_datatype);
12231 }
12232
12233 }
12234
12235 public static HannWindow HannWindow(CodeType resultType, Value size, java.util.Optional<Long> periodic, java.util.Optional<Long> output_datatype) {
12236 return new HannWindow(resultType, size, periodic, output_datatype);
12237 }
12238
12239 @OpFactoryHelper.OpDeclaration(HardSigmoid.NAME)
12240 public static final class HardSigmoid extends OnnxOp {
12241 public static final String NAME = "HardSigmoid";
12242
12243 public enum Attribute implements OnnxAttribute {
12244 alpha(Float.class, true, 0.2f),
12245 beta(Float.class, true, 0.5f),
12246 ;
12247
12248 final Class<?> t;
12249 final boolean optional;
12250 final Object defaultValue;
12251
12252 Attribute(Class<?> type, boolean optional, Object defaultValue) {
12253 this.t = type;
12254 this.optional = optional;
12255 this.defaultValue = defaultValue;
12256 assert optional || defaultValue == null;
12257 }
12258
12259 public Class<?> type() {
12260 return t;
12261 }
12262
12263 public boolean isOptional() {
12264 return optional;
12265 }
12266
12267 public Object defaultValue() {
12268 return defaultValue;
12269 }
12270 }
12271
12272 public enum TypeConstraint implements OnnxTypeConstraint {
12273 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
12274 ;
12275
12276 final OnnxType.TypeVariable typeVariable;
12277
12278 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12279 assert typeVariable.name().equals(name());
12280 this.typeVariable = typeVariable;
12281 }
12282
12283 @Override
12284 public OnnxType.TypeVariable typeVariable() {
12285 return typeVariable;
12286 }
12287 }
12288
12289 public enum InputParameter implements OnnxParameter {
12290 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12291 ;
12292
12293 final OnnxType type;
12294 final Quantifier quantifier;
12295
12296 InputParameter(OnnxType type, Quantifier quantifier) {
12297 this.type = type;
12298 this.quantifier = quantifier;
12299 }
12300
12301 @Override
12302 public OnnxType type() {
12303 return type;
12304 }
12305
12306 @Override
12307 public Quantifier quantifier() {
12308 return quantifier;
12309 }
12310 }
12311
12312 public enum OutputParameter implements OnnxParameter {
12313 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12314 ;
12315
12316 final OnnxType type;
12317 final Quantifier quantifier;
12318
12319 OutputParameter(OnnxType type, Quantifier quantifier) {
12320 this.type = type;
12321 this.quantifier = quantifier;
12322 }
12323
12324 @Override
12325 public OnnxType type() {
12326 return type;
12327 }
12328
12329 @Override
12330 public Quantifier quantifier() {
12331 return quantifier;
12332 }
12333 }
12334
12335 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12336 NAME,
12337 List.of(Attribute.values()),
12338 List.of(TypeConstraint.values()),
12339 List.of(InputParameter.values()),
12340 List.of(OutputParameter.values())
12341 );
12342
12343 public HardSigmoid(ExternalizedOp def) {
12344 super(SCHEMA, def);
12345 }
12346
12347 HardSigmoid(HardSigmoid that, CodeContext cc) {
12348 super(that, cc);
12349 }
12350
12351 @Override
12352 public HardSigmoid transform(CodeContext cc, CodeTransformer ot) {
12353 return new HardSigmoid(this, cc);
12354 }
12355
12356 HardSigmoid(CodeType resultType, Value X, java.util.Optional<Float> alpha, java.util.Optional<Float> beta) {
12357 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha, beta));
12358 }
12359
12360 @Override
12361 public SequencedSet<OnnxParameter> onnxOutputs() {
12362 return onnxOutputs(SCHEMA);
12363 }
12364
12365 @Override
12366 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12367 return onnxInputs(SCHEMA, List.of(X()));
12368 }
12369
12370 public Value X() {
12371 return operands().get(0);
12372 }
12373
12374 public java.util.Optional<Float> alpha() {
12375 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
12376 return java.util.Optional.ofNullable(alpha);
12377 }
12378
12379 public java.util.Optional<Float> beta() {
12380 Float beta = Attribute.beta.access(Float.class, onnxAttributes);
12381 return java.util.Optional.ofNullable(beta);
12382 }
12383
12384 }
12385
12386 public static HardSigmoid HardSigmoid(CodeType resultType, Value X, java.util.Optional<Float> alpha, java.util.Optional<Float> beta) {
12387 return new HardSigmoid(resultType, X, alpha, beta);
12388 }
12389
12390 @OpFactoryHelper.OpDeclaration(HardSwish.NAME)
12391 public static final class HardSwish extends OnnxOp {
12392 public static final String NAME = "HardSwish";
12393
12394 public enum Attribute implements OnnxAttribute.None { }
12395
12396 public enum TypeConstraint implements OnnxTypeConstraint {
12397 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
12398 ;
12399
12400 final OnnxType.TypeVariable typeVariable;
12401
12402 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12403 assert typeVariable.name().equals(name());
12404 this.typeVariable = typeVariable;
12405 }
12406
12407 @Override
12408 public OnnxType.TypeVariable typeVariable() {
12409 return typeVariable;
12410 }
12411 }
12412
12413 public enum InputParameter implements OnnxParameter {
12414 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12415 ;
12416
12417 final OnnxType type;
12418 final Quantifier quantifier;
12419
12420 InputParameter(OnnxType type, Quantifier quantifier) {
12421 this.type = type;
12422 this.quantifier = quantifier;
12423 }
12424
12425 @Override
12426 public OnnxType type() {
12427 return type;
12428 }
12429
12430 @Override
12431 public Quantifier quantifier() {
12432 return quantifier;
12433 }
12434 }
12435
12436 public enum OutputParameter implements OnnxParameter {
12437 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12438 ;
12439
12440 final OnnxType type;
12441 final Quantifier quantifier;
12442
12443 OutputParameter(OnnxType type, Quantifier quantifier) {
12444 this.type = type;
12445 this.quantifier = quantifier;
12446 }
12447
12448 @Override
12449 public OnnxType type() {
12450 return type;
12451 }
12452
12453 @Override
12454 public Quantifier quantifier() {
12455 return quantifier;
12456 }
12457 }
12458
12459 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12460 NAME,
12461 List.of(Attribute.values()),
12462 List.of(TypeConstraint.values()),
12463 List.of(InputParameter.values()),
12464 List.of(OutputParameter.values())
12465 );
12466
12467 public HardSwish(ExternalizedOp def) {
12468 super(SCHEMA, def);
12469 }
12470
12471 HardSwish(HardSwish that, CodeContext cc) {
12472 super(that, cc);
12473 }
12474
12475 @Override
12476 public HardSwish transform(CodeContext cc, CodeTransformer ot) {
12477 return new HardSwish(this, cc);
12478 }
12479
12480 HardSwish(CodeType resultType, Value X) {
12481 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
12482 }
12483
12484 @Override
12485 public SequencedSet<OnnxParameter> onnxOutputs() {
12486 return onnxOutputs(SCHEMA);
12487 }
12488
12489 @Override
12490 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12491 return onnxInputs(SCHEMA, List.of(X()));
12492 }
12493
12494 public Value X() {
12495 return operands().get(0);
12496 }
12497
12498 }
12499
12500 public static HardSwish HardSwish(CodeType resultType, Value X) {
12501 return new HardSwish(resultType, X);
12502 }
12503
12504 @OpFactoryHelper.OpDeclaration(Hardmax.NAME)
12505 public static final class Hardmax extends OnnxOp {
12506 public static final String NAME = "Hardmax";
12507
12508 public enum Attribute implements OnnxAttribute {
12509 axis(Long.class, true, -1),
12510 ;
12511
12512 final Class<?> t;
12513 final boolean optional;
12514 final Object defaultValue;
12515
12516 Attribute(Class<?> type, boolean optional, Object defaultValue) {
12517 this.t = type;
12518 this.optional = optional;
12519 this.defaultValue = defaultValue;
12520 assert optional || defaultValue == null;
12521 }
12522
12523 public Class<?> type() {
12524 return t;
12525 }
12526
12527 public boolean isOptional() {
12528 return optional;
12529 }
12530
12531 public Object defaultValue() {
12532 return defaultValue;
12533 }
12534 }
12535
12536 public enum TypeConstraint implements OnnxTypeConstraint {
12537 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
12538 ;
12539
12540 final OnnxType.TypeVariable typeVariable;
12541
12542 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12543 assert typeVariable.name().equals(name());
12544 this.typeVariable = typeVariable;
12545 }
12546
12547 @Override
12548 public OnnxType.TypeVariable typeVariable() {
12549 return typeVariable;
12550 }
12551 }
12552
12553 public enum InputParameter implements OnnxParameter {
12554 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12555 ;
12556
12557 final OnnxType type;
12558 final Quantifier quantifier;
12559
12560 InputParameter(OnnxType type, Quantifier quantifier) {
12561 this.type = type;
12562 this.quantifier = quantifier;
12563 }
12564
12565 @Override
12566 public OnnxType type() {
12567 return type;
12568 }
12569
12570 @Override
12571 public Quantifier quantifier() {
12572 return quantifier;
12573 }
12574 }
12575
12576 public enum OutputParameter implements OnnxParameter {
12577 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12578 ;
12579
12580 final OnnxType type;
12581 final Quantifier quantifier;
12582
12583 OutputParameter(OnnxType type, Quantifier quantifier) {
12584 this.type = type;
12585 this.quantifier = quantifier;
12586 }
12587
12588 @Override
12589 public OnnxType type() {
12590 return type;
12591 }
12592
12593 @Override
12594 public Quantifier quantifier() {
12595 return quantifier;
12596 }
12597 }
12598
12599 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12600 NAME,
12601 List.of(Attribute.values()),
12602 List.of(TypeConstraint.values()),
12603 List.of(InputParameter.values()),
12604 List.of(OutputParameter.values())
12605 );
12606
12607 public Hardmax(ExternalizedOp def) {
12608 super(SCHEMA, def);
12609 }
12610
12611 Hardmax(Hardmax that, CodeContext cc) {
12612 super(that, cc);
12613 }
12614
12615 @Override
12616 public Hardmax transform(CodeContext cc, CodeTransformer ot) {
12617 return new Hardmax(this, cc);
12618 }
12619
12620 Hardmax(CodeType resultType, Value input, java.util.Optional<Long> axis) {
12621 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis));
12622 }
12623
12624 @Override
12625 public SequencedSet<OnnxParameter> onnxOutputs() {
12626 return onnxOutputs(SCHEMA);
12627 }
12628
12629 @Override
12630 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12631 return onnxInputs(SCHEMA, List.of(input()));
12632 }
12633
12634 public Value input() {
12635 return operands().get(0);
12636 }
12637
12638 public java.util.Optional<Long> axis() {
12639 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
12640 return java.util.Optional.ofNullable(axis);
12641 }
12642
12643 }
12644
12645 public static Hardmax Hardmax(CodeType resultType, Value input, java.util.Optional<Long> axis) {
12646 return new Hardmax(resultType, input, axis);
12647 }
12648
12649 @OpFactoryHelper.OpDeclaration(Identity.NAME)
12650 public static final class Identity extends OnnxOp {
12651 public static final String NAME = "Identity";
12652
12653 public enum Attribute implements OnnxAttribute.None { }
12654
12655 public enum TypeConstraint implements OnnxTypeConstraint {
12656 V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128())), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128()))))),
12657 ;
12658
12659 final OnnxType.TypeVariable typeVariable;
12660
12661 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12662 assert typeVariable.name().equals(name());
12663 this.typeVariable = typeVariable;
12664 }
12665
12666 @Override
12667 public OnnxType.TypeVariable typeVariable() {
12668 return typeVariable;
12669 }
12670 }
12671
12672 public enum InputParameter implements OnnxParameter {
12673 input(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED),
12674 ;
12675
12676 final OnnxType type;
12677 final Quantifier quantifier;
12678
12679 InputParameter(OnnxType type, Quantifier quantifier) {
12680 this.type = type;
12681 this.quantifier = quantifier;
12682 }
12683
12684 @Override
12685 public OnnxType type() {
12686 return type;
12687 }
12688
12689 @Override
12690 public Quantifier quantifier() {
12691 return quantifier;
12692 }
12693 }
12694
12695 public enum OutputParameter implements OnnxParameter {
12696 output(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED),
12697 ;
12698
12699 final OnnxType type;
12700 final Quantifier quantifier;
12701
12702 OutputParameter(OnnxType type, Quantifier quantifier) {
12703 this.type = type;
12704 this.quantifier = quantifier;
12705 }
12706
12707 @Override
12708 public OnnxType type() {
12709 return type;
12710 }
12711
12712 @Override
12713 public Quantifier quantifier() {
12714 return quantifier;
12715 }
12716 }
12717
12718 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12719 NAME,
12720 List.of(Attribute.values()),
12721 List.of(TypeConstraint.values()),
12722 List.of(InputParameter.values()),
12723 List.of(OutputParameter.values())
12724 );
12725
12726 public Identity(ExternalizedOp def) {
12727 super(SCHEMA, def);
12728 }
12729
12730 Identity(Identity that, CodeContext cc) {
12731 super(that, cc);
12732 }
12733
12734 @Override
12735 public Identity transform(CodeContext cc, CodeTransformer ot) {
12736 return new Identity(this, cc);
12737 }
12738
12739 Identity(CodeType resultType, Value input) {
12740 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
12741 }
12742
12743 @Override
12744 public SequencedSet<OnnxParameter> onnxOutputs() {
12745 return onnxOutputs(SCHEMA);
12746 }
12747
12748 @Override
12749 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12750 return onnxInputs(SCHEMA, List.of(input()));
12751 }
12752
12753 public Value input() {
12754 return operands().get(0);
12755 }
12756
12757 }
12758
12759 public static Identity Identity(CodeType resultType, Value input) {
12760 return new Identity(resultType, input);
12761 }
12762
12763 @OpFactoryHelper.OpDeclaration(ImageDecoder.NAME)
12764 public static final class ImageDecoder extends OnnxOp {
12765 public static final String NAME = "ImageDecoder";
12766
12767 public enum Attribute implements OnnxAttribute {
12768 pixel_format(String.class, true, "RGB"),
12769 ;
12770
12771 final Class<?> t;
12772 final boolean optional;
12773 final Object defaultValue;
12774
12775 Attribute(Class<?> type, boolean optional, Object defaultValue) {
12776 this.t = type;
12777 this.optional = optional;
12778 this.defaultValue = defaultValue;
12779 assert optional || defaultValue == null;
12780 }
12781
12782 public Class<?> type() {
12783 return t;
12784 }
12785
12786 public boolean isOptional() {
12787 return optional;
12788 }
12789
12790 public Object defaultValue() {
12791 return defaultValue;
12792 }
12793 }
12794
12795 public enum TypeConstraint implements OnnxTypeConstraint {
12796 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8())))),
12797 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8())))),
12798 ;
12799
12800 final OnnxType.TypeVariable typeVariable;
12801
12802 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12803 assert typeVariable.name().equals(name());
12804 this.typeVariable = typeVariable;
12805 }
12806
12807 @Override
12808 public OnnxType.TypeVariable typeVariable() {
12809 return typeVariable;
12810 }
12811 }
12812
12813 public enum InputParameter implements OnnxParameter {
12814 encoded_stream(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
12815 ;
12816
12817 final OnnxType type;
12818 final Quantifier quantifier;
12819
12820 InputParameter(OnnxType type, Quantifier quantifier) {
12821 this.type = type;
12822 this.quantifier = quantifier;
12823 }
12824
12825 @Override
12826 public OnnxType type() {
12827 return type;
12828 }
12829
12830 @Override
12831 public Quantifier quantifier() {
12832 return quantifier;
12833 }
12834 }
12835
12836 public enum OutputParameter implements OnnxParameter {
12837 image(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
12838 ;
12839
12840 final OnnxType type;
12841 final Quantifier quantifier;
12842
12843 OutputParameter(OnnxType type, Quantifier quantifier) {
12844 this.type = type;
12845 this.quantifier = quantifier;
12846 }
12847
12848 @Override
12849 public OnnxType type() {
12850 return type;
12851 }
12852
12853 @Override
12854 public Quantifier quantifier() {
12855 return quantifier;
12856 }
12857 }
12858
12859 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
12860 NAME,
12861 List.of(Attribute.values()),
12862 List.of(TypeConstraint.values()),
12863 List.of(InputParameter.values()),
12864 List.of(OutputParameter.values())
12865 );
12866
12867 public ImageDecoder(ExternalizedOp def) {
12868 super(SCHEMA, def);
12869 }
12870
12871 ImageDecoder(ImageDecoder that, CodeContext cc) {
12872 super(that, cc);
12873 }
12874
12875 @Override
12876 public ImageDecoder transform(CodeContext cc, CodeTransformer ot) {
12877 return new ImageDecoder(this, cc);
12878 }
12879
12880 ImageDecoder(CodeType resultType, Value encoded_stream, java.util.Optional<String> pixel_format) {
12881 super(SCHEMA, resultType, Set.of(), List.of(encoded_stream), List.of(pixel_format));
12882 }
12883
12884 @Override
12885 public SequencedSet<OnnxParameter> onnxOutputs() {
12886 return onnxOutputs(SCHEMA);
12887 }
12888
12889 @Override
12890 public SequencedMap<OnnxParameter, Object> onnxInputs() {
12891 return onnxInputs(SCHEMA, List.of(encoded_stream()));
12892 }
12893
12894 public Value encoded_stream() {
12895 return operands().get(0);
12896 }
12897
12898 public java.util.Optional<String> pixel_format() {
12899 String pixel_format = Attribute.pixel_format.access(String.class, onnxAttributes);
12900 return java.util.Optional.ofNullable(pixel_format);
12901 }
12902
12903 }
12904
12905 public static ImageDecoder ImageDecoder(CodeType resultType, Value encoded_stream, java.util.Optional<String> pixel_format) {
12906 return new ImageDecoder(resultType, encoded_stream, pixel_format);
12907 }
12908
12909 @OpFactoryHelper.OpDeclaration(Imputer.NAME)
12910 public static final class Imputer extends OnnxOp {
12911 public static final String NAME = "Imputer";
12912
12913 public enum Attribute implements OnnxAttribute {
12914 replaced_value_int64(Long.class, true, 0),
12915 replaced_value_float(Float.class, true, 0.0f),
12916 imputed_value_int64s(long[].class, true, null),
12917 imputed_value_floats(float[].class, true, null),
12918 ;
12919
12920 final Class<?> t;
12921 final boolean optional;
12922 final Object defaultValue;
12923
12924 Attribute(Class<?> type, boolean optional, Object defaultValue) {
12925 this.t = type;
12926 this.optional = optional;
12927 this.defaultValue = defaultValue;
12928 assert optional || defaultValue == null;
12929 }
12930
12931 public Class<?> type() {
12932 return t;
12933 }
12934
12935 public boolean isOptional() {
12936 return optional;
12937 }
12938
12939 public Object defaultValue() {
12940 return defaultValue;
12941 }
12942 }
12943
12944 public enum TypeConstraint implements OnnxTypeConstraint {
12945 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
12946 ;
12947
12948 final OnnxType.TypeVariable typeVariable;
12949
12950 TypeConstraint(OnnxType.TypeVariable typeVariable) {
12951 assert typeVariable.name().equals(name());
12952 this.typeVariable = typeVariable;
12953 }
12954
12955 @Override
12956 public OnnxType.TypeVariable typeVariable() {
12957 return typeVariable;
12958 }
12959 }
12960
12961 public enum InputParameter implements OnnxParameter {
12962 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12963 ;
12964
12965 final OnnxType type;
12966 final Quantifier quantifier;
12967
12968 InputParameter(OnnxType type, Quantifier quantifier) {
12969 this.type = type;
12970 this.quantifier = quantifier;
12971 }
12972
12973 @Override
12974 public OnnxType type() {
12975 return type;
12976 }
12977
12978 @Override
12979 public Quantifier quantifier() {
12980 return quantifier;
12981 }
12982 }
12983
12984 public enum OutputParameter implements OnnxParameter {
12985 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
12986 ;
12987
12988 final OnnxType type;
12989 final Quantifier quantifier;
12990
12991 OutputParameter(OnnxType type, Quantifier quantifier) {
12992 this.type = type;
12993 this.quantifier = quantifier;
12994 }
12995
12996 @Override
12997 public OnnxType type() {
12998 return type;
12999 }
13000
13001 @Override
13002 public Quantifier quantifier() {
13003 return quantifier;
13004 }
13005 }
13006
13007 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13008 NAME,
13009 List.of(Attribute.values()),
13010 List.of(TypeConstraint.values()),
13011 List.of(InputParameter.values()),
13012 List.of(OutputParameter.values())
13013 );
13014
13015 public Imputer(ExternalizedOp def) {
13016 super(SCHEMA, def);
13017 }
13018
13019 Imputer(Imputer that, CodeContext cc) {
13020 super(that, cc);
13021 }
13022
13023 @Override
13024 public Imputer transform(CodeContext cc, CodeTransformer ot) {
13025 return new Imputer(this, cc);
13026 }
13027
13028 Imputer(CodeType resultType, Value X, java.util.Optional<Long> replaced_value_int64, java.util.Optional<Float> replaced_value_float, java.util.Optional<long[]> imputed_value_int64s, java.util.Optional<float[]> imputed_value_floats) {
13029 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats));
13030 }
13031
13032 @Override
13033 public SequencedSet<OnnxParameter> onnxOutputs() {
13034 return onnxOutputs(SCHEMA);
13035 }
13036
13037 @Override
13038 public SequencedMap<OnnxParameter, Object> onnxInputs() {
13039 return onnxInputs(SCHEMA, List.of(X()));
13040 }
13041
13042 public Value X() {
13043 return operands().get(0);
13044 }
13045
13046 public java.util.Optional<Long> replaced_value_int64() {
13047 Long replaced_value_int64 = Attribute.replaced_value_int64.access(Long.class, onnxAttributes);
13048 return java.util.Optional.ofNullable(replaced_value_int64);
13049 }
13050
13051 public java.util.Optional<Float> replaced_value_float() {
13052 Float replaced_value_float = Attribute.replaced_value_float.access(Float.class, onnxAttributes);
13053 return java.util.Optional.ofNullable(replaced_value_float);
13054 }
13055
13056 public java.util.Optional<long[]> imputed_value_int64s() {
13057 long[] imputed_value_int64s = Attribute.imputed_value_int64s.access(long[].class, onnxAttributes);
13058 return java.util.Optional.ofNullable(imputed_value_int64s).map(long[]::clone);
13059 }
13060
13061 public java.util.Optional<float[]> imputed_value_floats() {
13062 float[] imputed_value_floats = Attribute.imputed_value_floats.access(float[].class, onnxAttributes);
13063 return java.util.Optional.ofNullable(imputed_value_floats).map(float[]::clone);
13064 }
13065
13066 }
13067
13068 public static Imputer Imputer(CodeType resultType, Value X, java.util.Optional<Long> replaced_value_int64, java.util.Optional<Float> replaced_value_float, java.util.Optional<long[]> imputed_value_int64s, java.util.Optional<float[]> imputed_value_floats) {
13069 return new Imputer(resultType, X, replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats);
13070 }
13071
13072 @OpFactoryHelper.OpDeclaration(InstanceNormalization.NAME)
13073 public static final class InstanceNormalization extends OnnxOp {
13074 public static final String NAME = "InstanceNormalization";
13075
13076 public enum Attribute implements OnnxAttribute {
13077 epsilon(Float.class, true, 1.0E-5f),
13078 ;
13079
13080 final Class<?> t;
13081 final boolean optional;
13082 final Object defaultValue;
13083
13084 Attribute(Class<?> type, boolean optional, Object defaultValue) {
13085 this.t = type;
13086 this.optional = optional;
13087 this.defaultValue = defaultValue;
13088 assert optional || defaultValue == null;
13089 }
13090
13091 public Class<?> type() {
13092 return t;
13093 }
13094
13095 public boolean isOptional() {
13096 return optional;
13097 }
13098
13099 public Object defaultValue() {
13100 return defaultValue;
13101 }
13102 }
13103
13104 public enum TypeConstraint implements OnnxTypeConstraint {
13105 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
13106 ;
13107
13108 final OnnxType.TypeVariable typeVariable;
13109
13110 TypeConstraint(OnnxType.TypeVariable typeVariable) {
13111 assert typeVariable.name().equals(name());
13112 this.typeVariable = typeVariable;
13113 }
13114
13115 @Override
13116 public OnnxType.TypeVariable typeVariable() {
13117 return typeVariable;
13118 }
13119 }
13120
13121 public enum InputParameter implements OnnxParameter {
13122 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13123 scale(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13124 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13125 ;
13126
13127 final OnnxType type;
13128 final Quantifier quantifier;
13129
13130 InputParameter(OnnxType type, Quantifier quantifier) {
13131 this.type = type;
13132 this.quantifier = quantifier;
13133 }
13134
13135 @Override
13136 public OnnxType type() {
13137 return type;
13138 }
13139
13140 @Override
13141 public Quantifier quantifier() {
13142 return quantifier;
13143 }
13144 }
13145
13146 public enum OutputParameter implements OnnxParameter {
13147 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13148 ;
13149
13150 final OnnxType type;
13151 final Quantifier quantifier;
13152
13153 OutputParameter(OnnxType type, Quantifier quantifier) {
13154 this.type = type;
13155 this.quantifier = quantifier;
13156 }
13157
13158 @Override
13159 public OnnxType type() {
13160 return type;
13161 }
13162
13163 @Override
13164 public Quantifier quantifier() {
13165 return quantifier;
13166 }
13167 }
13168
13169 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13170 NAME,
13171 List.of(Attribute.values()),
13172 List.of(TypeConstraint.values()),
13173 List.of(InputParameter.values()),
13174 List.of(OutputParameter.values())
13175 );
13176
13177 public InstanceNormalization(ExternalizedOp def) {
13178 super(SCHEMA, def);
13179 }
13180
13181 InstanceNormalization(InstanceNormalization that, CodeContext cc) {
13182 super(that, cc);
13183 }
13184
13185 @Override
13186 public InstanceNormalization transform(CodeContext cc, CodeTransformer ot) {
13187 return new InstanceNormalization(this, cc);
13188 }
13189
13190 InstanceNormalization(CodeType resultType, Value input, Value scale, Value B, java.util.Optional<Float> epsilon) {
13191 super(SCHEMA, resultType, Set.of(), List.of(input, scale, B), List.of(epsilon));
13192 }
13193
13194 @Override
13195 public SequencedSet<OnnxParameter> onnxOutputs() {
13196 return onnxOutputs(SCHEMA);
13197 }
13198
13199 @Override
13200 public SequencedMap<OnnxParameter, Object> onnxInputs() {
13201 return onnxInputs(SCHEMA, List.of(input(), scale(), B()));
13202 }
13203
13204 public Value input() {
13205 return operands().get(0);
13206 }
13207
13208 public Value scale() {
13209 return operands().get(1);
13210 }
13211
13212 public Value B() {
13213 return operands().get(2);
13214 }
13215
13216 public java.util.Optional<Float> epsilon() {
13217 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
13218 return java.util.Optional.ofNullable(epsilon);
13219 }
13220
13221 }
13222
13223 public static InstanceNormalization InstanceNormalization(CodeType resultType, Value input, Value scale, Value B, java.util.Optional<Float> epsilon) {
13224 return new InstanceNormalization(resultType, input, scale, B, epsilon);
13225 }
13226
13227 @OpFactoryHelper.OpDeclaration(IsInf.NAME)
13228 public static final class IsInf extends OnnxOp {
13229 public static final String NAME = "IsInf";
13230
13231 public enum Attribute implements OnnxAttribute {
13232 detect_negative(Long.class, true, 1),
13233 detect_positive(Long.class, true, 1),
13234 ;
13235
13236 final Class<?> t;
13237 final boolean optional;
13238 final Object defaultValue;
13239
13240 Attribute(Class<?> type, boolean optional, Object defaultValue) {
13241 this.t = type;
13242 this.optional = optional;
13243 this.defaultValue = defaultValue;
13244 assert optional || defaultValue == null;
13245 }
13246
13247 public Class<?> type() {
13248 return t;
13249 }
13250
13251 public boolean isOptional() {
13252 return optional;
13253 }
13254
13255 public Object defaultValue() {
13256 return defaultValue;
13257 }
13258 }
13259
13260 public enum TypeConstraint implements OnnxTypeConstraint {
13261 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
13262 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))),
13263 ;
13264
13265 final OnnxType.TypeVariable typeVariable;
13266
13267 TypeConstraint(OnnxType.TypeVariable typeVariable) {
13268 assert typeVariable.name().equals(name());
13269 this.typeVariable = typeVariable;
13270 }
13271
13272 @Override
13273 public OnnxType.TypeVariable typeVariable() {
13274 return typeVariable;
13275 }
13276 }
13277
13278 public enum InputParameter implements OnnxParameter {
13279 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
13280 ;
13281
13282 final OnnxType type;
13283 final Quantifier quantifier;
13284
13285 InputParameter(OnnxType type, Quantifier quantifier) {
13286 this.type = type;
13287 this.quantifier = quantifier;
13288 }
13289
13290 @Override
13291 public OnnxType type() {
13292 return type;
13293 }
13294
13295 @Override
13296 public Quantifier quantifier() {
13297 return quantifier;
13298 }
13299 }
13300
13301 public enum OutputParameter implements OnnxParameter {
13302 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
13303 ;
13304
13305 final OnnxType type;
13306 final Quantifier quantifier;
13307
13308 OutputParameter(OnnxType type, Quantifier quantifier) {
13309 this.type = type;
13310 this.quantifier = quantifier;
13311 }
13312
13313 @Override
13314 public OnnxType type() {
13315 return type;
13316 }
13317
13318 @Override
13319 public Quantifier quantifier() {
13320 return quantifier;
13321 }
13322 }
13323
13324 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13325 NAME,
13326 List.of(Attribute.values()),
13327 List.of(TypeConstraint.values()),
13328 List.of(InputParameter.values()),
13329 List.of(OutputParameter.values())
13330 );
13331
13332 public IsInf(ExternalizedOp def) {
13333 super(SCHEMA, def);
13334 }
13335
13336 IsInf(IsInf that, CodeContext cc) {
13337 super(that, cc);
13338 }
13339
13340 @Override
13341 public IsInf transform(CodeContext cc, CodeTransformer ot) {
13342 return new IsInf(this, cc);
13343 }
13344
13345 IsInf(CodeType resultType, Value X, java.util.Optional<Long> detect_negative, java.util.Optional<Long> detect_positive) {
13346 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(detect_negative, detect_positive));
13347 }
13348
13349 @Override
13350 public SequencedSet<OnnxParameter> onnxOutputs() {
13351 return onnxOutputs(SCHEMA);
13352 }
13353
13354 @Override
13355 public SequencedMap<OnnxParameter, Object> onnxInputs() {
13356 return onnxInputs(SCHEMA, List.of(X()));
13357 }
13358
13359 public Value X() {
13360 return operands().get(0);
13361 }
13362
13363 public java.util.Optional<Long> detect_negative() {
13364 Long detect_negative = Attribute.detect_negative.access(Long.class, onnxAttributes);
13365 return java.util.Optional.ofNullable(detect_negative);
13366 }
13367
13368 public java.util.Optional<Long> detect_positive() {
13369 Long detect_positive = Attribute.detect_positive.access(Long.class, onnxAttributes);
13370 return java.util.Optional.ofNullable(detect_positive);
13371 }
13372
13373 }
13374
13375 public static IsInf IsInf(CodeType resultType, Value X, java.util.Optional<Long> detect_negative, java.util.Optional<Long> detect_positive) {
13376 return new IsInf(resultType, X, detect_negative, detect_positive);
13377 }
13378
13379 @OpFactoryHelper.OpDeclaration(IsNaN.NAME)
13380 public static final class IsNaN extends OnnxOp {
13381 public static final String NAME = "IsNaN";
13382
13383 public enum Attribute implements OnnxAttribute.None { }
13384
13385 public enum TypeConstraint implements OnnxTypeConstraint {
13386 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
13387 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))),
13388 ;
13389
13390 final OnnxType.TypeVariable typeVariable;
13391
13392 TypeConstraint(OnnxType.TypeVariable typeVariable) {
13393 assert typeVariable.name().equals(name());
13394 this.typeVariable = typeVariable;
13395 }
13396
13397 @Override
13398 public OnnxType.TypeVariable typeVariable() {
13399 return typeVariable;
13400 }
13401 }
13402
13403 public enum InputParameter implements OnnxParameter {
13404 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
13405 ;
13406
13407 final OnnxType type;
13408 final Quantifier quantifier;
13409
13410 InputParameter(OnnxType type, Quantifier quantifier) {
13411 this.type = type;
13412 this.quantifier = quantifier;
13413 }
13414
13415 @Override
13416 public OnnxType type() {
13417 return type;
13418 }
13419
13420 @Override
13421 public Quantifier quantifier() {
13422 return quantifier;
13423 }
13424 }
13425
13426 public enum OutputParameter implements OnnxParameter {
13427 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
13428 ;
13429
13430 final OnnxType type;
13431 final Quantifier quantifier;
13432
13433 OutputParameter(OnnxType type, Quantifier quantifier) {
13434 this.type = type;
13435 this.quantifier = quantifier;
13436 }
13437
13438 @Override
13439 public OnnxType type() {
13440 return type;
13441 }
13442
13443 @Override
13444 public Quantifier quantifier() {
13445 return quantifier;
13446 }
13447 }
13448
13449 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13450 NAME,
13451 List.of(Attribute.values()),
13452 List.of(TypeConstraint.values()),
13453 List.of(InputParameter.values()),
13454 List.of(OutputParameter.values())
13455 );
13456
13457 public IsNaN(ExternalizedOp def) {
13458 super(SCHEMA, def);
13459 }
13460
13461 IsNaN(IsNaN that, CodeContext cc) {
13462 super(that, cc);
13463 }
13464
13465 @Override
13466 public IsNaN transform(CodeContext cc, CodeTransformer ot) {
13467 return new IsNaN(this, cc);
13468 }
13469
13470 IsNaN(CodeType resultType, Value X) {
13471 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
13472 }
13473
13474 @Override
13475 public SequencedSet<OnnxParameter> onnxOutputs() {
13476 return onnxOutputs(SCHEMA);
13477 }
13478
13479 @Override
13480 public SequencedMap<OnnxParameter, Object> onnxInputs() {
13481 return onnxInputs(SCHEMA, List.of(X()));
13482 }
13483
13484 public Value X() {
13485 return operands().get(0);
13486 }
13487
13488 }
13489
13490 public static IsNaN IsNaN(CodeType resultType, Value X) {
13491 return new IsNaN(resultType, X);
13492 }
13493
13494 @OpFactoryHelper.OpDeclaration(LRN.NAME)
13495 public static final class LRN extends OnnxOp {
13496 public static final String NAME = "LRN";
13497
13498 public enum Attribute implements OnnxAttribute {
13499 size(Long.class, false, null),
13500 alpha(Float.class, true, 1.0E-4f),
13501 bias(Float.class, true, 1.0f),
13502 beta(Float.class, true, 0.75f),
13503 ;
13504
13505 final Class<?> t;
13506 final boolean optional;
13507 final Object defaultValue;
13508
13509 Attribute(Class<?> type, boolean optional, Object defaultValue) {
13510 this.t = type;
13511 this.optional = optional;
13512 this.defaultValue = defaultValue;
13513 assert optional || defaultValue == null;
13514 }
13515
13516 public Class<?> type() {
13517 return t;
13518 }
13519
13520 public boolean isOptional() {
13521 return optional;
13522 }
13523
13524 public Object defaultValue() {
13525 return defaultValue;
13526 }
13527 }
13528
13529 public enum TypeConstraint implements OnnxTypeConstraint {
13530 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
13531 ;
13532
13533 final OnnxType.TypeVariable typeVariable;
13534
13535 TypeConstraint(OnnxType.TypeVariable typeVariable) {
13536 assert typeVariable.name().equals(name());
13537 this.typeVariable = typeVariable;
13538 }
13539
13540 @Override
13541 public OnnxType.TypeVariable typeVariable() {
13542 return typeVariable;
13543 }
13544 }
13545
13546 public enum InputParameter implements OnnxParameter {
13547 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13548 ;
13549
13550 final OnnxType type;
13551 final Quantifier quantifier;
13552
13553 InputParameter(OnnxType type, Quantifier quantifier) {
13554 this.type = type;
13555 this.quantifier = quantifier;
13556 }
13557
13558 @Override
13559 public OnnxType type() {
13560 return type;
13561 }
13562
13563 @Override
13564 public Quantifier quantifier() {
13565 return quantifier;
13566 }
13567 }
13568
13569 public enum OutputParameter implements OnnxParameter {
13570 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13571 ;
13572
13573 final OnnxType type;
13574 final Quantifier quantifier;
13575
13576 OutputParameter(OnnxType type, Quantifier quantifier) {
13577 this.type = type;
13578 this.quantifier = quantifier;
13579 }
13580
13581 @Override
13582 public OnnxType type() {
13583 return type;
13584 }
13585
13586 @Override
13587 public Quantifier quantifier() {
13588 return quantifier;
13589 }
13590 }
13591
13592 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13593 NAME,
13594 List.of(Attribute.values()),
13595 List.of(TypeConstraint.values()),
13596 List.of(InputParameter.values()),
13597 List.of(OutputParameter.values())
13598 );
13599
13600 public LRN(ExternalizedOp def) {
13601 super(SCHEMA, def);
13602 }
13603
13604 LRN(LRN that, CodeContext cc) {
13605 super(that, cc);
13606 }
13607
13608 @Override
13609 public LRN transform(CodeContext cc, CodeTransformer ot) {
13610 return new LRN(this, cc);
13611 }
13612
13613 LRN(CodeType resultType, Value X, long size, java.util.Optional<Float> alpha, java.util.Optional<Float> bias, java.util.Optional<Float> beta) {
13614 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(size, alpha, bias, beta));
13615 }
13616
13617 @Override
13618 public SequencedSet<OnnxParameter> onnxOutputs() {
13619 return onnxOutputs(SCHEMA);
13620 }
13621
13622 @Override
13623 public SequencedMap<OnnxParameter, Object> onnxInputs() {
13624 return onnxInputs(SCHEMA, List.of(X()));
13625 }
13626
13627 public Value X() {
13628 return operands().get(0);
13629 }
13630
13631 public long size() {
13632 long size = Attribute.size.access(Long.class, onnxAttributes);
13633 return size;
13634 }
13635
13636 public java.util.Optional<Float> alpha() {
13637 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
13638 return java.util.Optional.ofNullable(alpha);
13639 }
13640
13641 public java.util.Optional<Float> bias() {
13642 Float bias = Attribute.bias.access(Float.class, onnxAttributes);
13643 return java.util.Optional.ofNullable(bias);
13644 }
13645
13646 public java.util.Optional<Float> beta() {
13647 Float beta = Attribute.beta.access(Float.class, onnxAttributes);
13648 return java.util.Optional.ofNullable(beta);
13649 }
13650
13651 }
13652
13653 public static LRN LRN(CodeType resultType, Value X, long size, java.util.Optional<Float> alpha, java.util.Optional<Float> bias, java.util.Optional<Float> beta) {
13654 return new LRN(resultType, X, size, alpha, bias, beta);
13655 }
13656
13657 @OpFactoryHelper.OpDeclaration(LSTM.NAME)
13658 public static final class LSTM extends OnnxOp {
13659 public static final String NAME = "LSTM";
13660
13661 public enum Attribute implements OnnxAttribute {
13662 layout(Long.class, true, 0),
13663 input_forget(Long.class, true, 0),
13664 activation_alpha(float[].class, true, null),
13665 hidden_size(Long.class, true, null),
13666 activation_beta(float[].class, true, null),
13667 activations(String[].class, true, null),
13668 clip(Float.class, true, null),
13669 direction(String.class, true, "forward"),
13670 ;
13671
13672 final Class<?> t;
13673 final boolean optional;
13674 final Object defaultValue;
13675
13676 Attribute(Class<?> type, boolean optional, Object defaultValue) {
13677 this.t = type;
13678 this.optional = optional;
13679 this.defaultValue = defaultValue;
13680 assert optional || defaultValue == null;
13681 }
13682
13683 public Class<?> type() {
13684 return t;
13685 }
13686
13687 public boolean isOptional() {
13688 return optional;
13689 }
13690
13691 public Object defaultValue() {
13692 return defaultValue;
13693 }
13694 }
13695
13696 public enum TypeConstraint implements OnnxTypeConstraint {
13697 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
13698 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32())))),
13699 ;
13700
13701 final OnnxType.TypeVariable typeVariable;
13702
13703 TypeConstraint(OnnxType.TypeVariable typeVariable) {
13704 assert typeVariable.name().equals(name());
13705 this.typeVariable = typeVariable;
13706 }
13707
13708 @Override
13709 public OnnxType.TypeVariable typeVariable() {
13710 return typeVariable;
13711 }
13712 }
13713
13714 public enum InputParameter implements OnnxParameter {
13715 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13716 W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13717 R(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
13718 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13719 sequence_lens(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
13720 initial_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13721 initial_c(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13722 P(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13723 ;
13724
13725 final OnnxType type;
13726 final Quantifier quantifier;
13727
13728 InputParameter(OnnxType type, Quantifier quantifier) {
13729 this.type = type;
13730 this.quantifier = quantifier;
13731 }
13732
13733 @Override
13734 public OnnxType type() {
13735 return type;
13736 }
13737
13738 @Override
13739 public Quantifier quantifier() {
13740 return quantifier;
13741 }
13742 }
13743
13744 public enum OutputParameter implements OnnxParameter {
13745 Y(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13746 Y_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13747 Y_c(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
13748 ;
13749
13750 final OnnxType type;
13751 final Quantifier quantifier;
13752
13753 OutputParameter(OnnxType type, Quantifier quantifier) {
13754 this.type = type;
13755 this.quantifier = quantifier;
13756 }
13757
13758 @Override
13759 public OnnxType type() {
13760 return type;
13761 }
13762
13763 @Override
13764 public Quantifier quantifier() {
13765 return quantifier;
13766 }
13767 }
13768
13769 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13770 NAME,
13771 List.of(Attribute.values()),
13772 List.of(TypeConstraint.values()),
13773 List.of(InputParameter.values()),
13774 List.of(OutputParameter.values())
13775 );
13776
13777 public LSTM(ExternalizedOp def) {
13778 super(SCHEMA, def);
13779 }
13780
13781 LSTM(LSTM that, CodeContext cc) {
13782 super(that, cc);
13783 }
13784
13785 @Override
13786 public LSTM transform(CodeContext cc, CodeTransformer ot) {
13787 return new LSTM(this, cc);
13788 }
13789
13790 LSTM(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, Value W, Value R, java.util.Optional<Value> B, java.util.Optional<Value> sequence_lens, java.util.Optional<Value> initial_h, java.util.Optional<Value> initial_c, java.util.Optional<Value> P, java.util.Optional<Long> layout, java.util.Optional<Long> input_forget, java.util.Optional<float[]> activation_alpha, java.util.Optional<Long> hidden_size, java.util.Optional<float[]> activation_beta, java.util.Optional<String[]> activations, java.util.Optional<Float> clip, java.util.Optional<String> direction) {
13791 super(SCHEMA, resultType, optionalOutputs, List.of(X, W, R, B, sequence_lens, initial_h, initial_c, P), List.of(layout, input_forget, activation_alpha, hidden_size, activation_beta, activations, clip, direction));
13792 }
13793
13794 @Override
13795 public SequencedSet<OnnxParameter> onnxOutputs() {
13796 return onnxOutputs(SCHEMA);
13797 }
13798
13799 @Override
13800 public SequencedMap<OnnxParameter, Object> onnxInputs() {
13801 return onnxInputs(SCHEMA, List.of(X(), W(), R(), B(), sequence_lens(), initial_h(), initial_c(), P()));
13802 }
13803
13804 public Value X() {
13805 return operands().get(0);
13806 }
13807
13808 public Value W() {
13809 return operands().get(1);
13810 }
13811
13812 public Value R() {
13813 return operands().get(2);
13814 }
13815
13816 public java.util.Optional<Value> B() {
13817 int i = optionalInputArguments.indexOf(InputParameter.B);
13818 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
13819 }
13820
13821 public java.util.Optional<Value> sequence_lens() {
13822 int i = optionalInputArguments.indexOf(InputParameter.sequence_lens);
13823 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
13824 }
13825
13826 public java.util.Optional<Value> initial_h() {
13827 int i = optionalInputArguments.indexOf(InputParameter.initial_h);
13828 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
13829 }
13830
13831 public java.util.Optional<Value> initial_c() {
13832 int i = optionalInputArguments.indexOf(InputParameter.initial_c);
13833 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
13834 }
13835
13836 public java.util.Optional<Value> P() {
13837 int i = optionalInputArguments.indexOf(InputParameter.P);
13838 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
13839 }
13840
13841 public java.util.Optional<Long> layout() {
13842 Long layout = Attribute.layout.access(Long.class, onnxAttributes);
13843 return java.util.Optional.ofNullable(layout);
13844 }
13845
13846 public java.util.Optional<Long> input_forget() {
13847 Long input_forget = Attribute.input_forget.access(Long.class, onnxAttributes);
13848 return java.util.Optional.ofNullable(input_forget);
13849 }
13850
13851 public java.util.Optional<float[]> activation_alpha() {
13852 float[] activation_alpha = Attribute.activation_alpha.access(float[].class, onnxAttributes);
13853 return java.util.Optional.ofNullable(activation_alpha).map(float[]::clone);
13854 }
13855
13856 public java.util.Optional<Long> hidden_size() {
13857 Long hidden_size = Attribute.hidden_size.access(Long.class, onnxAttributes);
13858 return java.util.Optional.ofNullable(hidden_size);
13859 }
13860
13861 public java.util.Optional<float[]> activation_beta() {
13862 float[] activation_beta = Attribute.activation_beta.access(float[].class, onnxAttributes);
13863 return java.util.Optional.ofNullable(activation_beta).map(float[]::clone);
13864 }
13865
13866 public java.util.Optional<String[]> activations() {
13867 String[] activations = Attribute.activations.access(String[].class, onnxAttributes);
13868 return java.util.Optional.ofNullable(activations).map(String[]::clone);
13869 }
13870
13871 public java.util.Optional<Float> clip() {
13872 Float clip = Attribute.clip.access(Float.class, onnxAttributes);
13873 return java.util.Optional.ofNullable(clip);
13874 }
13875
13876 public java.util.Optional<String> direction() {
13877 String direction = Attribute.direction.access(String.class, onnxAttributes);
13878 return java.util.Optional.ofNullable(direction);
13879 }
13880
13881 }
13882
13883 public static LSTM LSTM(CodeType resultType, Set<LSTM.OutputParameter> optionalOutputs, Value X, Value W, Value R, java.util.Optional<Value> B, java.util.Optional<Value> sequence_lens, java.util.Optional<Value> initial_h, java.util.Optional<Value> initial_c, java.util.Optional<Value> P, java.util.Optional<Long> layout, java.util.Optional<Long> input_forget, java.util.Optional<float[]> activation_alpha, java.util.Optional<Long> hidden_size, java.util.Optional<float[]> activation_beta, java.util.Optional<String[]> activations, java.util.Optional<Float> clip, java.util.Optional<String> direction) {
13884 return new LSTM(resultType, optionalOutputs, X, W, R, B, sequence_lens, initial_h, initial_c, P, layout, input_forget, activation_alpha, hidden_size, activation_beta, activations, clip, direction);
13885 }
13886
13887 @OpFactoryHelper.OpDeclaration(LabelEncoder.NAME)
13888 public static final class LabelEncoder extends OnnxOp {
13889 public static final String NAME = "LabelEncoder";
13890
13891 public enum Attribute implements OnnxAttribute {
13892 values_strings(String[].class, true, null),
13893 keys_int64s(long[].class, true, null),
13894 keys_tensor(Tensor.class, true, null),
13895 keys_strings(String[].class, true, null),
13896 default_float(Float.class, true, -0.0f),
13897 keys_floats(float[].class, true, null),
13898 default_tensor(Tensor.class, true, null),
13899 default_int64(Long.class, true, -1),
13900 values_tensor(Tensor.class, true, null),
13901 values_int64s(long[].class, true, null),
13902 default_string(String.class, true, "_Unused"),
13903 values_floats(float[].class, true, null),
13904 ;
13905
13906 final Class<?> t;
13907 final boolean optional;
13908 final Object defaultValue;
13909
13910 Attribute(Class<?> type, boolean optional, Object defaultValue) {
13911 this.t = type;
13912 this.optional = optional;
13913 this.defaultValue = defaultValue;
13914 assert optional || defaultValue == null;
13915 }
13916
13917 public Class<?> type() {
13918 return t;
13919 }
13920
13921 public boolean isOptional() {
13922 return optional;
13923 }
13924
13925 public Object defaultValue() {
13926 return defaultValue;
13927 }
13928 }
13929
13930 public enum TypeConstraint implements OnnxTypeConstraint {
13931 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.float64())))),
13932 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.float64())))),
13933 ;
13934
13935 final OnnxType.TypeVariable typeVariable;
13936
13937 TypeConstraint(OnnxType.TypeVariable typeVariable) {
13938 assert typeVariable.name().equals(name());
13939 this.typeVariable = typeVariable;
13940 }
13941
13942 @Override
13943 public OnnxType.TypeVariable typeVariable() {
13944 return typeVariable;
13945 }
13946 }
13947
13948 public enum InputParameter implements OnnxParameter {
13949 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
13950 ;
13951
13952 final OnnxType type;
13953 final Quantifier quantifier;
13954
13955 InputParameter(OnnxType type, Quantifier quantifier) {
13956 this.type = type;
13957 this.quantifier = quantifier;
13958 }
13959
13960 @Override
13961 public OnnxType type() {
13962 return type;
13963 }
13964
13965 @Override
13966 public Quantifier quantifier() {
13967 return quantifier;
13968 }
13969 }
13970
13971 public enum OutputParameter implements OnnxParameter {
13972 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
13973 ;
13974
13975 final OnnxType type;
13976 final Quantifier quantifier;
13977
13978 OutputParameter(OnnxType type, Quantifier quantifier) {
13979 this.type = type;
13980 this.quantifier = quantifier;
13981 }
13982
13983 @Override
13984 public OnnxType type() {
13985 return type;
13986 }
13987
13988 @Override
13989 public Quantifier quantifier() {
13990 return quantifier;
13991 }
13992 }
13993
13994 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
13995 NAME,
13996 List.of(Attribute.values()),
13997 List.of(TypeConstraint.values()),
13998 List.of(InputParameter.values()),
13999 List.of(OutputParameter.values())
14000 );
14001
14002 public LabelEncoder(ExternalizedOp def) {
14003 super(SCHEMA, def);
14004 }
14005
14006 LabelEncoder(LabelEncoder that, CodeContext cc) {
14007 super(that, cc);
14008 }
14009
14010 @Override
14011 public LabelEncoder transform(CodeContext cc, CodeTransformer ot) {
14012 return new LabelEncoder(this, cc);
14013 }
14014
14015 LabelEncoder(CodeType resultType, Value X, java.util.Optional<String[]> values_strings, java.util.Optional<long[]> keys_int64s, java.util.Optional<Tensor> keys_tensor, java.util.Optional<String[]> keys_strings, java.util.Optional<Float> default_float, java.util.Optional<float[]> keys_floats, java.util.Optional<Tensor> default_tensor, java.util.Optional<Long> default_int64, java.util.Optional<Tensor> values_tensor, java.util.Optional<long[]> values_int64s, java.util.Optional<String> default_string, java.util.Optional<float[]> values_floats) {
14016 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats));
14017 }
14018
14019 @Override
14020 public SequencedSet<OnnxParameter> onnxOutputs() {
14021 return onnxOutputs(SCHEMA);
14022 }
14023
14024 @Override
14025 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14026 return onnxInputs(SCHEMA, List.of(X()));
14027 }
14028
14029 public Value X() {
14030 return operands().get(0);
14031 }
14032
14033 public java.util.Optional<String[]> values_strings() {
14034 String[] values_strings = Attribute.values_strings.access(String[].class, onnxAttributes);
14035 return java.util.Optional.ofNullable(values_strings).map(String[]::clone);
14036 }
14037
14038 public java.util.Optional<long[]> keys_int64s() {
14039 long[] keys_int64s = Attribute.keys_int64s.access(long[].class, onnxAttributes);
14040 return java.util.Optional.ofNullable(keys_int64s).map(long[]::clone);
14041 }
14042
14043 public java.util.Optional<Tensor> keys_tensor() {
14044 Tensor keys_tensor = Attribute.keys_tensor.access(Tensor.class, onnxAttributes);
14045 return java.util.Optional.ofNullable(keys_tensor);
14046 }
14047
14048 public java.util.Optional<String[]> keys_strings() {
14049 String[] keys_strings = Attribute.keys_strings.access(String[].class, onnxAttributes);
14050 return java.util.Optional.ofNullable(keys_strings).map(String[]::clone);
14051 }
14052
14053 public java.util.Optional<Float> default_float() {
14054 Float default_float = Attribute.default_float.access(Float.class, onnxAttributes);
14055 return java.util.Optional.ofNullable(default_float);
14056 }
14057
14058 public java.util.Optional<float[]> keys_floats() {
14059 float[] keys_floats = Attribute.keys_floats.access(float[].class, onnxAttributes);
14060 return java.util.Optional.ofNullable(keys_floats).map(float[]::clone);
14061 }
14062
14063 public java.util.Optional<Tensor> default_tensor() {
14064 Tensor default_tensor = Attribute.default_tensor.access(Tensor.class, onnxAttributes);
14065 return java.util.Optional.ofNullable(default_tensor);
14066 }
14067
14068 public java.util.Optional<Long> default_int64() {
14069 Long default_int64 = Attribute.default_int64.access(Long.class, onnxAttributes);
14070 return java.util.Optional.ofNullable(default_int64);
14071 }
14072
14073 public java.util.Optional<Tensor> values_tensor() {
14074 Tensor values_tensor = Attribute.values_tensor.access(Tensor.class, onnxAttributes);
14075 return java.util.Optional.ofNullable(values_tensor);
14076 }
14077
14078 public java.util.Optional<long[]> values_int64s() {
14079 long[] values_int64s = Attribute.values_int64s.access(long[].class, onnxAttributes);
14080 return java.util.Optional.ofNullable(values_int64s).map(long[]::clone);
14081 }
14082
14083 public java.util.Optional<String> default_string() {
14084 String default_string = Attribute.default_string.access(String.class, onnxAttributes);
14085 return java.util.Optional.ofNullable(default_string);
14086 }
14087
14088 public java.util.Optional<float[]> values_floats() {
14089 float[] values_floats = Attribute.values_floats.access(float[].class, onnxAttributes);
14090 return java.util.Optional.ofNullable(values_floats).map(float[]::clone);
14091 }
14092
14093 }
14094
14095 public static LabelEncoder LabelEncoder(CodeType resultType, Value X, java.util.Optional<String[]> values_strings, java.util.Optional<long[]> keys_int64s, java.util.Optional<Tensor> keys_tensor, java.util.Optional<String[]> keys_strings, java.util.Optional<Float> default_float, java.util.Optional<float[]> keys_floats, java.util.Optional<Tensor> default_tensor, java.util.Optional<Long> default_int64, java.util.Optional<Tensor> values_tensor, java.util.Optional<long[]> values_int64s, java.util.Optional<String> default_string, java.util.Optional<float[]> values_floats) {
14096 return new LabelEncoder(resultType, X, values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats);
14097 }
14098
14099 @OpFactoryHelper.OpDeclaration(LayerNormalization.NAME)
14100 public static final class LayerNormalization extends OnnxOp {
14101 public static final String NAME = "LayerNormalization";
14102
14103 public enum Attribute implements OnnxAttribute {
14104 epsilon(Float.class, true, 1.0E-5f),
14105 stash_type(Long.class, true, 1),
14106 axis(Long.class, true, -1),
14107 ;
14108
14109 final Class<?> t;
14110 final boolean optional;
14111 final Object defaultValue;
14112
14113 Attribute(Class<?> type, boolean optional, Object defaultValue) {
14114 this.t = type;
14115 this.optional = optional;
14116 this.defaultValue = defaultValue;
14117 assert optional || defaultValue == null;
14118 }
14119
14120 public Class<?> type() {
14121 return t;
14122 }
14123
14124 public boolean isOptional() {
14125 return optional;
14126 }
14127
14128 public Object defaultValue() {
14129 return defaultValue;
14130 }
14131 }
14132
14133 public enum TypeConstraint implements OnnxTypeConstraint {
14134 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
14135 U(new OnnxType.TypeVariable("U", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.bfloat16())))),
14136 ;
14137
14138 final OnnxType.TypeVariable typeVariable;
14139
14140 TypeConstraint(OnnxType.TypeVariable typeVariable) {
14141 assert typeVariable.name().equals(name());
14142 this.typeVariable = typeVariable;
14143 }
14144
14145 @Override
14146 public OnnxType.TypeVariable typeVariable() {
14147 return typeVariable;
14148 }
14149 }
14150
14151 public enum InputParameter implements OnnxParameter {
14152 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14153 Scale(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14154 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
14155 ;
14156
14157 final OnnxType type;
14158 final Quantifier quantifier;
14159
14160 InputParameter(OnnxType type, Quantifier quantifier) {
14161 this.type = type;
14162 this.quantifier = quantifier;
14163 }
14164
14165 @Override
14166 public OnnxType type() {
14167 return type;
14168 }
14169
14170 @Override
14171 public Quantifier quantifier() {
14172 return quantifier;
14173 }
14174 }
14175
14176 public enum OutputParameter implements OnnxParameter {
14177 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14178 Mean(TypeConstraint.U.typeVariable(), Quantifier.OPTIONAL),
14179 InvStdDev(TypeConstraint.U.typeVariable(), Quantifier.OPTIONAL),
14180 ;
14181
14182 final OnnxType type;
14183 final Quantifier quantifier;
14184
14185 OutputParameter(OnnxType type, Quantifier quantifier) {
14186 this.type = type;
14187 this.quantifier = quantifier;
14188 }
14189
14190 @Override
14191 public OnnxType type() {
14192 return type;
14193 }
14194
14195 @Override
14196 public Quantifier quantifier() {
14197 return quantifier;
14198 }
14199 }
14200
14201 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
14202 NAME,
14203 List.of(Attribute.values()),
14204 List.of(TypeConstraint.values()),
14205 List.of(InputParameter.values()),
14206 List.of(OutputParameter.values())
14207 );
14208
14209 public LayerNormalization(ExternalizedOp def) {
14210 super(SCHEMA, def);
14211 }
14212
14213 LayerNormalization(LayerNormalization that, CodeContext cc) {
14214 super(that, cc);
14215 }
14216
14217 @Override
14218 public LayerNormalization transform(CodeContext cc, CodeTransformer ot) {
14219 return new LayerNormalization(this, cc);
14220 }
14221
14222 LayerNormalization(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, Value Scale, java.util.Optional<Value> B, java.util.Optional<Float> epsilon, java.util.Optional<Long> stash_type, java.util.Optional<Long> axis) {
14223 super(SCHEMA, resultType, optionalOutputs, List.of(X, Scale, B), List.of(epsilon, stash_type, axis));
14224 }
14225
14226 @Override
14227 public SequencedSet<OnnxParameter> onnxOutputs() {
14228 return onnxOutputs(SCHEMA);
14229 }
14230
14231 @Override
14232 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14233 return onnxInputs(SCHEMA, List.of(X(), Scale(), B()));
14234 }
14235
14236 public Value X() {
14237 return operands().get(0);
14238 }
14239
14240 public Value Scale() {
14241 return operands().get(1);
14242 }
14243
14244 public java.util.Optional<Value> B() {
14245 int i = optionalInputArguments.indexOf(InputParameter.B);
14246 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
14247 }
14248
14249 public java.util.Optional<Float> epsilon() {
14250 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
14251 return java.util.Optional.ofNullable(epsilon);
14252 }
14253
14254 public java.util.Optional<Long> stash_type() {
14255 Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes);
14256 return java.util.Optional.ofNullable(stash_type);
14257 }
14258
14259 public java.util.Optional<Long> axis() {
14260 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
14261 return java.util.Optional.ofNullable(axis);
14262 }
14263
14264 }
14265
14266 public static LayerNormalization LayerNormalization(CodeType resultType, Set<LayerNormalization.OutputParameter> optionalOutputs, Value X, Value Scale, java.util.Optional<Value> B, java.util.Optional<Float> epsilon, java.util.Optional<Long> stash_type, java.util.Optional<Long> axis) {
14267 return new LayerNormalization(resultType, optionalOutputs, X, Scale, B, epsilon, stash_type, axis);
14268 }
14269
14270 @OpFactoryHelper.OpDeclaration(LeakyRelu.NAME)
14271 public static final class LeakyRelu extends OnnxOp {
14272 public static final String NAME = "LeakyRelu";
14273
14274 public enum Attribute implements OnnxAttribute {
14275 alpha(Float.class, true, 0.01f),
14276 ;
14277
14278 final Class<?> t;
14279 final boolean optional;
14280 final Object defaultValue;
14281
14282 Attribute(Class<?> type, boolean optional, Object defaultValue) {
14283 this.t = type;
14284 this.optional = optional;
14285 this.defaultValue = defaultValue;
14286 assert optional || defaultValue == null;
14287 }
14288
14289 public Class<?> type() {
14290 return t;
14291 }
14292
14293 public boolean isOptional() {
14294 return optional;
14295 }
14296
14297 public Object defaultValue() {
14298 return defaultValue;
14299 }
14300 }
14301
14302 public enum TypeConstraint implements OnnxTypeConstraint {
14303 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
14304 ;
14305
14306 final OnnxType.TypeVariable typeVariable;
14307
14308 TypeConstraint(OnnxType.TypeVariable typeVariable) {
14309 assert typeVariable.name().equals(name());
14310 this.typeVariable = typeVariable;
14311 }
14312
14313 @Override
14314 public OnnxType.TypeVariable typeVariable() {
14315 return typeVariable;
14316 }
14317 }
14318
14319 public enum InputParameter implements OnnxParameter {
14320 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14321 ;
14322
14323 final OnnxType type;
14324 final Quantifier quantifier;
14325
14326 InputParameter(OnnxType type, Quantifier quantifier) {
14327 this.type = type;
14328 this.quantifier = quantifier;
14329 }
14330
14331 @Override
14332 public OnnxType type() {
14333 return type;
14334 }
14335
14336 @Override
14337 public Quantifier quantifier() {
14338 return quantifier;
14339 }
14340 }
14341
14342 public enum OutputParameter implements OnnxParameter {
14343 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14344 ;
14345
14346 final OnnxType type;
14347 final Quantifier quantifier;
14348
14349 OutputParameter(OnnxType type, Quantifier quantifier) {
14350 this.type = type;
14351 this.quantifier = quantifier;
14352 }
14353
14354 @Override
14355 public OnnxType type() {
14356 return type;
14357 }
14358
14359 @Override
14360 public Quantifier quantifier() {
14361 return quantifier;
14362 }
14363 }
14364
14365 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
14366 NAME,
14367 List.of(Attribute.values()),
14368 List.of(TypeConstraint.values()),
14369 List.of(InputParameter.values()),
14370 List.of(OutputParameter.values())
14371 );
14372
14373 public LeakyRelu(ExternalizedOp def) {
14374 super(SCHEMA, def);
14375 }
14376
14377 LeakyRelu(LeakyRelu that, CodeContext cc) {
14378 super(that, cc);
14379 }
14380
14381 @Override
14382 public LeakyRelu transform(CodeContext cc, CodeTransformer ot) {
14383 return new LeakyRelu(this, cc);
14384 }
14385
14386 LeakyRelu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
14387 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha));
14388 }
14389
14390 @Override
14391 public SequencedSet<OnnxParameter> onnxOutputs() {
14392 return onnxOutputs(SCHEMA);
14393 }
14394
14395 @Override
14396 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14397 return onnxInputs(SCHEMA, List.of(X()));
14398 }
14399
14400 public Value X() {
14401 return operands().get(0);
14402 }
14403
14404 public java.util.Optional<Float> alpha() {
14405 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
14406 return java.util.Optional.ofNullable(alpha);
14407 }
14408
14409 }
14410
14411 public static LeakyRelu LeakyRelu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
14412 return new LeakyRelu(resultType, X, alpha);
14413 }
14414
14415 @OpFactoryHelper.OpDeclaration(Less.NAME)
14416 public static final class Less extends OnnxOp {
14417 public static final String NAME = "Less";
14418
14419 public enum Attribute implements OnnxAttribute.None { }
14420
14421 public enum TypeConstraint implements OnnxTypeConstraint {
14422 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
14423 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
14424 ;
14425
14426 final OnnxType.TypeVariable typeVariable;
14427
14428 TypeConstraint(OnnxType.TypeVariable typeVariable) {
14429 assert typeVariable.name().equals(name());
14430 this.typeVariable = typeVariable;
14431 }
14432
14433 @Override
14434 public OnnxType.TypeVariable typeVariable() {
14435 return typeVariable;
14436 }
14437 }
14438
14439 public enum InputParameter implements OnnxParameter {
14440 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14441 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14442 ;
14443
14444 final OnnxType type;
14445 final Quantifier quantifier;
14446
14447 InputParameter(OnnxType type, Quantifier quantifier) {
14448 this.type = type;
14449 this.quantifier = quantifier;
14450 }
14451
14452 @Override
14453 public OnnxType type() {
14454 return type;
14455 }
14456
14457 @Override
14458 public Quantifier quantifier() {
14459 return quantifier;
14460 }
14461 }
14462
14463 public enum OutputParameter implements OnnxParameter {
14464 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
14465 ;
14466
14467 final OnnxType type;
14468 final Quantifier quantifier;
14469
14470 OutputParameter(OnnxType type, Quantifier quantifier) {
14471 this.type = type;
14472 this.quantifier = quantifier;
14473 }
14474
14475 @Override
14476 public OnnxType type() {
14477 return type;
14478 }
14479
14480 @Override
14481 public Quantifier quantifier() {
14482 return quantifier;
14483 }
14484 }
14485
14486 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
14487 NAME,
14488 List.of(Attribute.values()),
14489 List.of(TypeConstraint.values()),
14490 List.of(InputParameter.values()),
14491 List.of(OutputParameter.values())
14492 );
14493
14494 public Less(ExternalizedOp def) {
14495 super(SCHEMA, def);
14496 }
14497
14498 Less(Less that, CodeContext cc) {
14499 super(that, cc);
14500 }
14501
14502 @Override
14503 public Less transform(CodeContext cc, CodeTransformer ot) {
14504 return new Less(this, cc);
14505 }
14506
14507 Less(CodeType resultType, Value A, Value B) {
14508 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
14509 }
14510
14511 @Override
14512 public SequencedSet<OnnxParameter> onnxOutputs() {
14513 return onnxOutputs(SCHEMA);
14514 }
14515
14516 @Override
14517 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14518 return onnxInputs(SCHEMA, List.of(A(), B()));
14519 }
14520
14521 public Value A() {
14522 return operands().get(0);
14523 }
14524
14525 public Value B() {
14526 return operands().get(1);
14527 }
14528
14529 }
14530
14531 public static Less Less(CodeType resultType, Value A, Value B) {
14532 return new Less(resultType, A, B);
14533 }
14534
14535 @OpFactoryHelper.OpDeclaration(LessOrEqual.NAME)
14536 public static final class LessOrEqual extends OnnxOp {
14537 public static final String NAME = "LessOrEqual";
14538
14539 public enum Attribute implements OnnxAttribute.None { }
14540
14541 public enum TypeConstraint implements OnnxTypeConstraint {
14542 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
14543 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
14544 ;
14545
14546 final OnnxType.TypeVariable typeVariable;
14547
14548 TypeConstraint(OnnxType.TypeVariable typeVariable) {
14549 assert typeVariable.name().equals(name());
14550 this.typeVariable = typeVariable;
14551 }
14552
14553 @Override
14554 public OnnxType.TypeVariable typeVariable() {
14555 return typeVariable;
14556 }
14557 }
14558
14559 public enum InputParameter implements OnnxParameter {
14560 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14561 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14562 ;
14563
14564 final OnnxType type;
14565 final Quantifier quantifier;
14566
14567 InputParameter(OnnxType type, Quantifier quantifier) {
14568 this.type = type;
14569 this.quantifier = quantifier;
14570 }
14571
14572 @Override
14573 public OnnxType type() {
14574 return type;
14575 }
14576
14577 @Override
14578 public Quantifier quantifier() {
14579 return quantifier;
14580 }
14581 }
14582
14583 public enum OutputParameter implements OnnxParameter {
14584 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
14585 ;
14586
14587 final OnnxType type;
14588 final Quantifier quantifier;
14589
14590 OutputParameter(OnnxType type, Quantifier quantifier) {
14591 this.type = type;
14592 this.quantifier = quantifier;
14593 }
14594
14595 @Override
14596 public OnnxType type() {
14597 return type;
14598 }
14599
14600 @Override
14601 public Quantifier quantifier() {
14602 return quantifier;
14603 }
14604 }
14605
14606 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
14607 NAME,
14608 List.of(Attribute.values()),
14609 List.of(TypeConstraint.values()),
14610 List.of(InputParameter.values()),
14611 List.of(OutputParameter.values())
14612 );
14613
14614 public LessOrEqual(ExternalizedOp def) {
14615 super(SCHEMA, def);
14616 }
14617
14618 LessOrEqual(LessOrEqual that, CodeContext cc) {
14619 super(that, cc);
14620 }
14621
14622 @Override
14623 public LessOrEqual transform(CodeContext cc, CodeTransformer ot) {
14624 return new LessOrEqual(this, cc);
14625 }
14626
14627 LessOrEqual(CodeType resultType, Value A, Value B) {
14628 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
14629 }
14630
14631 @Override
14632 public SequencedSet<OnnxParameter> onnxOutputs() {
14633 return onnxOutputs(SCHEMA);
14634 }
14635
14636 @Override
14637 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14638 return onnxInputs(SCHEMA, List.of(A(), B()));
14639 }
14640
14641 public Value A() {
14642 return operands().get(0);
14643 }
14644
14645 public Value B() {
14646 return operands().get(1);
14647 }
14648
14649 }
14650
14651 public static LessOrEqual LessOrEqual(CodeType resultType, Value A, Value B) {
14652 return new LessOrEqual(resultType, A, B);
14653 }
14654
14655 @OpFactoryHelper.OpDeclaration(LinearAttention.NAME)
14656 public static final class LinearAttention extends OnnxOp {
14657 public static final String NAME = "LinearAttention";
14658
14659 public enum Attribute implements OnnxAttribute {
14660 chunk_size(Long.class, true, 64),
14661 update_rule(String.class, true, "gated_delta"),
14662 scale(Float.class, true, 0.0f),
14663 q_num_heads(Long.class, false, null),
14664 kv_num_heads(Long.class, false, null),
14665 ;
14666
14667 final Class<?> t;
14668 final boolean optional;
14669 final Object defaultValue;
14670
14671 Attribute(Class<?> type, boolean optional, Object defaultValue) {
14672 this.t = type;
14673 this.optional = optional;
14674 this.defaultValue = defaultValue;
14675 assert optional || defaultValue == null;
14676 }
14677
14678 public Class<?> type() {
14679 return t;
14680 }
14681
14682 public boolean isOptional() {
14683 return optional;
14684 }
14685
14686 public Object defaultValue() {
14687 return defaultValue;
14688 }
14689 }
14690
14691 public enum TypeConstraint implements OnnxTypeConstraint {
14692 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float32())))),
14693 S(new OnnxType.TypeVariable("S", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float32())))),
14694 ;
14695
14696 final OnnxType.TypeVariable typeVariable;
14697
14698 TypeConstraint(OnnxType.TypeVariable typeVariable) {
14699 assert typeVariable.name().equals(name());
14700 this.typeVariable = typeVariable;
14701 }
14702
14703 @Override
14704 public OnnxType.TypeVariable typeVariable() {
14705 return typeVariable;
14706 }
14707 }
14708
14709 public enum InputParameter implements OnnxParameter {
14710 query(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14711 key(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14712 value(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14713 past_state(TypeConstraint.S.typeVariable(), Quantifier.OPTIONAL),
14714 decay(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
14715 beta(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
14716 ;
14717
14718 final OnnxType type;
14719 final Quantifier quantifier;
14720
14721 InputParameter(OnnxType type, Quantifier quantifier) {
14722 this.type = type;
14723 this.quantifier = quantifier;
14724 }
14725
14726 @Override
14727 public OnnxType type() {
14728 return type;
14729 }
14730
14731 @Override
14732 public Quantifier quantifier() {
14733 return quantifier;
14734 }
14735 }
14736
14737 public enum OutputParameter implements OnnxParameter {
14738 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
14739 present_state(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
14740 ;
14741
14742 final OnnxType type;
14743 final Quantifier quantifier;
14744
14745 OutputParameter(OnnxType type, Quantifier quantifier) {
14746 this.type = type;
14747 this.quantifier = quantifier;
14748 }
14749
14750 @Override
14751 public OnnxType type() {
14752 return type;
14753 }
14754
14755 @Override
14756 public Quantifier quantifier() {
14757 return quantifier;
14758 }
14759 }
14760
14761 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
14762 NAME,
14763 List.of(Attribute.values()),
14764 List.of(TypeConstraint.values()),
14765 List.of(InputParameter.values()),
14766 List.of(OutputParameter.values())
14767 );
14768
14769 public LinearAttention(ExternalizedOp def) {
14770 super(SCHEMA, def);
14771 }
14772
14773 LinearAttention(LinearAttention that, CodeContext cc) {
14774 super(that, cc);
14775 }
14776
14777 @Override
14778 public LinearAttention transform(CodeContext cc, CodeTransformer ot) {
14779 return new LinearAttention(this, cc);
14780 }
14781
14782 LinearAttention(CodeType resultType, Value query, Value key, Value value, java.util.Optional<Value> past_state, java.util.Optional<Value> decay, java.util.Optional<Value> beta, java.util.Optional<Long> chunk_size, java.util.Optional<String> update_rule, java.util.Optional<Float> scale, long q_num_heads, long kv_num_heads) {
14783 super(SCHEMA, resultType, Set.of(), List.of(query, key, value, past_state, decay, beta), List.of(chunk_size, update_rule, scale, q_num_heads, kv_num_heads));
14784 }
14785
14786 @Override
14787 public SequencedSet<OnnxParameter> onnxOutputs() {
14788 return onnxOutputs(SCHEMA);
14789 }
14790
14791 @Override
14792 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14793 return onnxInputs(SCHEMA, List.of(query(), key(), value(), past_state(), decay(), beta()));
14794 }
14795
14796 public Value query() {
14797 return operands().get(0);
14798 }
14799
14800 public Value key() {
14801 return operands().get(1);
14802 }
14803
14804 public Value value() {
14805 return operands().get(2);
14806 }
14807
14808 public java.util.Optional<Value> past_state() {
14809 int i = optionalInputArguments.indexOf(InputParameter.past_state);
14810 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
14811 }
14812
14813 public java.util.Optional<Value> decay() {
14814 int i = optionalInputArguments.indexOf(InputParameter.decay);
14815 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
14816 }
14817
14818 public java.util.Optional<Value> beta() {
14819 int i = optionalInputArguments.indexOf(InputParameter.beta);
14820 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
14821 }
14822
14823 public java.util.Optional<Long> chunk_size() {
14824 Long chunk_size = Attribute.chunk_size.access(Long.class, onnxAttributes);
14825 return java.util.Optional.ofNullable(chunk_size);
14826 }
14827
14828 public java.util.Optional<String> update_rule() {
14829 String update_rule = Attribute.update_rule.access(String.class, onnxAttributes);
14830 return java.util.Optional.ofNullable(update_rule);
14831 }
14832
14833 public java.util.Optional<Float> scale() {
14834 Float scale = Attribute.scale.access(Float.class, onnxAttributes);
14835 return java.util.Optional.ofNullable(scale);
14836 }
14837
14838 public long q_num_heads() {
14839 long q_num_heads = Attribute.q_num_heads.access(Long.class, onnxAttributes);
14840 return q_num_heads;
14841 }
14842
14843 public long kv_num_heads() {
14844 long kv_num_heads = Attribute.kv_num_heads.access(Long.class, onnxAttributes);
14845 return kv_num_heads;
14846 }
14847
14848 }
14849
14850 public static LinearAttention LinearAttention(CodeType resultType, Value query, Value key, Value value, java.util.Optional<Value> past_state, java.util.Optional<Value> decay, java.util.Optional<Value> beta, java.util.Optional<Long> chunk_size, java.util.Optional<String> update_rule, java.util.Optional<Float> scale, long q_num_heads, long kv_num_heads) {
14851 return new LinearAttention(resultType, query, key, value, past_state, decay, beta, chunk_size, update_rule, scale, q_num_heads, kv_num_heads);
14852 }
14853
14854 @OpFactoryHelper.OpDeclaration(LinearClassifier.NAME)
14855 public static final class LinearClassifier extends OnnxOp {
14856 public static final String NAME = "LinearClassifier";
14857
14858 public enum Attribute implements OnnxAttribute {
14859 classlabels_ints(long[].class, true, null),
14860 post_transform(String.class, true, "NONE"),
14861 coefficients(float[].class, false, null),
14862 multi_class(Long.class, true, 0),
14863 intercepts(float[].class, true, null),
14864 classlabels_strings(String[].class, true, null),
14865 ;
14866
14867 final Class<?> t;
14868 final boolean optional;
14869 final Object defaultValue;
14870
14871 Attribute(Class<?> type, boolean optional, Object defaultValue) {
14872 this.t = type;
14873 this.optional = optional;
14874 this.defaultValue = defaultValue;
14875 assert optional || defaultValue == null;
14876 }
14877
14878 public Class<?> type() {
14879 return t;
14880 }
14881
14882 public boolean isOptional() {
14883 return optional;
14884 }
14885
14886 public Object defaultValue() {
14887 return defaultValue;
14888 }
14889 }
14890
14891 public enum TypeConstraint implements OnnxTypeConstraint {
14892 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
14893 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))),
14894 ;
14895
14896 final OnnxType.TypeVariable typeVariable;
14897
14898 TypeConstraint(OnnxType.TypeVariable typeVariable) {
14899 assert typeVariable.name().equals(name());
14900 this.typeVariable = typeVariable;
14901 }
14902
14903 @Override
14904 public OnnxType.TypeVariable typeVariable() {
14905 return typeVariable;
14906 }
14907 }
14908
14909 public enum InputParameter implements OnnxParameter {
14910 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
14911 ;
14912
14913 final OnnxType type;
14914 final Quantifier quantifier;
14915
14916 InputParameter(OnnxType type, Quantifier quantifier) {
14917 this.type = type;
14918 this.quantifier = quantifier;
14919 }
14920
14921 @Override
14922 public OnnxType type() {
14923 return type;
14924 }
14925
14926 @Override
14927 public Quantifier quantifier() {
14928 return quantifier;
14929 }
14930 }
14931
14932 public enum OutputParameter implements OnnxParameter {
14933 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
14934 Z(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
14935 ;
14936
14937 final OnnxType type;
14938 final Quantifier quantifier;
14939
14940 OutputParameter(OnnxType type, Quantifier quantifier) {
14941 this.type = type;
14942 this.quantifier = quantifier;
14943 }
14944
14945 @Override
14946 public OnnxType type() {
14947 return type;
14948 }
14949
14950 @Override
14951 public Quantifier quantifier() {
14952 return quantifier;
14953 }
14954 }
14955
14956 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
14957 NAME,
14958 List.of(Attribute.values()),
14959 List.of(TypeConstraint.values()),
14960 List.of(InputParameter.values()),
14961 List.of(OutputParameter.values())
14962 );
14963
14964 public LinearClassifier(ExternalizedOp def) {
14965 super(SCHEMA, def);
14966 }
14967
14968 LinearClassifier(LinearClassifier that, CodeContext cc) {
14969 super(that, cc);
14970 }
14971
14972 @Override
14973 public LinearClassifier transform(CodeContext cc, CodeTransformer ot) {
14974 return new LinearClassifier(this, cc);
14975 }
14976
14977 LinearClassifier(CodeType resultType, Value X, java.util.Optional<long[]> classlabels_ints, java.util.Optional<String> post_transform, float[] coefficients, java.util.Optional<Long> multi_class, java.util.Optional<float[]> intercepts, java.util.Optional<String[]> classlabels_strings) {
14978 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings));
14979 }
14980
14981 @Override
14982 public SequencedSet<OnnxParameter> onnxOutputs() {
14983 return onnxOutputs(SCHEMA);
14984 }
14985
14986 @Override
14987 public SequencedMap<OnnxParameter, Object> onnxInputs() {
14988 return onnxInputs(SCHEMA, List.of(X()));
14989 }
14990
14991 public Value X() {
14992 return operands().get(0);
14993 }
14994
14995 public java.util.Optional<long[]> classlabels_ints() {
14996 long[] classlabels_ints = Attribute.classlabels_ints.access(long[].class, onnxAttributes);
14997 return java.util.Optional.ofNullable(classlabels_ints).map(long[]::clone);
14998 }
14999
15000 public java.util.Optional<String> post_transform() {
15001 String post_transform = Attribute.post_transform.access(String.class, onnxAttributes);
15002 return java.util.Optional.ofNullable(post_transform);
15003 }
15004
15005 public float[] coefficients() {
15006 float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes);
15007 return coefficients.clone();
15008 }
15009
15010 public java.util.Optional<Long> multi_class() {
15011 Long multi_class = Attribute.multi_class.access(Long.class, onnxAttributes);
15012 return java.util.Optional.ofNullable(multi_class);
15013 }
15014
15015 public java.util.Optional<float[]> intercepts() {
15016 float[] intercepts = Attribute.intercepts.access(float[].class, onnxAttributes);
15017 return java.util.Optional.ofNullable(intercepts).map(float[]::clone);
15018 }
15019
15020 public java.util.Optional<String[]> classlabels_strings() {
15021 String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes);
15022 return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone);
15023 }
15024
15025 }
15026
15027 public static LinearClassifier LinearClassifier(CodeType resultType, Value X, java.util.Optional<long[]> classlabels_ints, java.util.Optional<String> post_transform, float[] coefficients, java.util.Optional<Long> multi_class, java.util.Optional<float[]> intercepts, java.util.Optional<String[]> classlabels_strings) {
15028 return new LinearClassifier(resultType, X, classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings);
15029 }
15030
15031 @OpFactoryHelper.OpDeclaration(LinearRegressor.NAME)
15032 public static final class LinearRegressor extends OnnxOp {
15033 public static final String NAME = "LinearRegressor";
15034
15035 public enum Attribute implements OnnxAttribute {
15036 post_transform(String.class, true, "NONE"),
15037 coefficients(float[].class, true, null),
15038 targets(Long.class, true, 1),
15039 intercepts(float[].class, true, null),
15040 ;
15041
15042 final Class<?> t;
15043 final boolean optional;
15044 final Object defaultValue;
15045
15046 Attribute(Class<?> type, boolean optional, Object defaultValue) {
15047 this.t = type;
15048 this.optional = optional;
15049 this.defaultValue = defaultValue;
15050 assert optional || defaultValue == null;
15051 }
15052
15053 public Class<?> type() {
15054 return t;
15055 }
15056
15057 public boolean isOptional() {
15058 return optional;
15059 }
15060
15061 public Object defaultValue() {
15062 return defaultValue;
15063 }
15064 }
15065
15066 public enum TypeConstraint implements OnnxTypeConstraint {
15067 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
15068 ;
15069
15070 final OnnxType.TypeVariable typeVariable;
15071
15072 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15073 assert typeVariable.name().equals(name());
15074 this.typeVariable = typeVariable;
15075 }
15076
15077 @Override
15078 public OnnxType.TypeVariable typeVariable() {
15079 return typeVariable;
15080 }
15081 }
15082
15083 public enum InputParameter implements OnnxParameter {
15084 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15085 ;
15086
15087 final OnnxType type;
15088 final Quantifier quantifier;
15089
15090 InputParameter(OnnxType type, Quantifier quantifier) {
15091 this.type = type;
15092 this.quantifier = quantifier;
15093 }
15094
15095 @Override
15096 public OnnxType type() {
15097 return type;
15098 }
15099
15100 @Override
15101 public Quantifier quantifier() {
15102 return quantifier;
15103 }
15104 }
15105
15106 public enum OutputParameter implements OnnxParameter {
15107 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
15108 ;
15109
15110 final OnnxType type;
15111 final Quantifier quantifier;
15112
15113 OutputParameter(OnnxType type, Quantifier quantifier) {
15114 this.type = type;
15115 this.quantifier = quantifier;
15116 }
15117
15118 @Override
15119 public OnnxType type() {
15120 return type;
15121 }
15122
15123 @Override
15124 public Quantifier quantifier() {
15125 return quantifier;
15126 }
15127 }
15128
15129 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15130 NAME,
15131 List.of(Attribute.values()),
15132 List.of(TypeConstraint.values()),
15133 List.of(InputParameter.values()),
15134 List.of(OutputParameter.values())
15135 );
15136
15137 public LinearRegressor(ExternalizedOp def) {
15138 super(SCHEMA, def);
15139 }
15140
15141 LinearRegressor(LinearRegressor that, CodeContext cc) {
15142 super(that, cc);
15143 }
15144
15145 @Override
15146 public LinearRegressor transform(CodeContext cc, CodeTransformer ot) {
15147 return new LinearRegressor(this, cc);
15148 }
15149
15150 LinearRegressor(CodeType resultType, Value X, java.util.Optional<String> post_transform, java.util.Optional<float[]> coefficients, java.util.Optional<Long> targets, java.util.Optional<float[]> intercepts) {
15151 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(post_transform, coefficients, targets, intercepts));
15152 }
15153
15154 @Override
15155 public SequencedSet<OnnxParameter> onnxOutputs() {
15156 return onnxOutputs(SCHEMA);
15157 }
15158
15159 @Override
15160 public SequencedMap<OnnxParameter, Object> onnxInputs() {
15161 return onnxInputs(SCHEMA, List.of(X()));
15162 }
15163
15164 public Value X() {
15165 return operands().get(0);
15166 }
15167
15168 public java.util.Optional<String> post_transform() {
15169 String post_transform = Attribute.post_transform.access(String.class, onnxAttributes);
15170 return java.util.Optional.ofNullable(post_transform);
15171 }
15172
15173 public java.util.Optional<float[]> coefficients() {
15174 float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes);
15175 return java.util.Optional.ofNullable(coefficients).map(float[]::clone);
15176 }
15177
15178 public java.util.Optional<Long> targets() {
15179 Long targets = Attribute.targets.access(Long.class, onnxAttributes);
15180 return java.util.Optional.ofNullable(targets);
15181 }
15182
15183 public java.util.Optional<float[]> intercepts() {
15184 float[] intercepts = Attribute.intercepts.access(float[].class, onnxAttributes);
15185 return java.util.Optional.ofNullable(intercepts).map(float[]::clone);
15186 }
15187
15188 }
15189
15190 public static LinearRegressor LinearRegressor(CodeType resultType, Value X, java.util.Optional<String> post_transform, java.util.Optional<float[]> coefficients, java.util.Optional<Long> targets, java.util.Optional<float[]> intercepts) {
15191 return new LinearRegressor(resultType, X, post_transform, coefficients, targets, intercepts);
15192 }
15193
15194 @OpFactoryHelper.OpDeclaration(Log.NAME)
15195 public static final class Log extends OnnxOp {
15196 public static final String NAME = "Log";
15197
15198 public enum Attribute implements OnnxAttribute.None { }
15199
15200 public enum TypeConstraint implements OnnxTypeConstraint {
15201 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
15202 ;
15203
15204 final OnnxType.TypeVariable typeVariable;
15205
15206 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15207 assert typeVariable.name().equals(name());
15208 this.typeVariable = typeVariable;
15209 }
15210
15211 @Override
15212 public OnnxType.TypeVariable typeVariable() {
15213 return typeVariable;
15214 }
15215 }
15216
15217 public enum InputParameter implements OnnxParameter {
15218 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15219 ;
15220
15221 final OnnxType type;
15222 final Quantifier quantifier;
15223
15224 InputParameter(OnnxType type, Quantifier quantifier) {
15225 this.type = type;
15226 this.quantifier = quantifier;
15227 }
15228
15229 @Override
15230 public OnnxType type() {
15231 return type;
15232 }
15233
15234 @Override
15235 public Quantifier quantifier() {
15236 return quantifier;
15237 }
15238 }
15239
15240 public enum OutputParameter implements OnnxParameter {
15241 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15242 ;
15243
15244 final OnnxType type;
15245 final Quantifier quantifier;
15246
15247 OutputParameter(OnnxType type, Quantifier quantifier) {
15248 this.type = type;
15249 this.quantifier = quantifier;
15250 }
15251
15252 @Override
15253 public OnnxType type() {
15254 return type;
15255 }
15256
15257 @Override
15258 public Quantifier quantifier() {
15259 return quantifier;
15260 }
15261 }
15262
15263 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15264 NAME,
15265 List.of(Attribute.values()),
15266 List.of(TypeConstraint.values()),
15267 List.of(InputParameter.values()),
15268 List.of(OutputParameter.values())
15269 );
15270
15271 public Log(ExternalizedOp def) {
15272 super(SCHEMA, def);
15273 }
15274
15275 Log(Log that, CodeContext cc) {
15276 super(that, cc);
15277 }
15278
15279 @Override
15280 public Log transform(CodeContext cc, CodeTransformer ot) {
15281 return new Log(this, cc);
15282 }
15283
15284 Log(CodeType resultType, Value input) {
15285 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
15286 }
15287
15288 @Override
15289 public SequencedSet<OnnxParameter> onnxOutputs() {
15290 return onnxOutputs(SCHEMA);
15291 }
15292
15293 @Override
15294 public SequencedMap<OnnxParameter, Object> onnxInputs() {
15295 return onnxInputs(SCHEMA, List.of(input()));
15296 }
15297
15298 public Value input() {
15299 return operands().get(0);
15300 }
15301
15302 }
15303
15304 public static Log Log(CodeType resultType, Value input) {
15305 return new Log(resultType, input);
15306 }
15307
15308 @OpFactoryHelper.OpDeclaration(LogSoftmax.NAME)
15309 public static final class LogSoftmax extends OnnxOp {
15310 public static final String NAME = "LogSoftmax";
15311
15312 public enum Attribute implements OnnxAttribute {
15313 axis(Long.class, true, -1),
15314 ;
15315
15316 final Class<?> t;
15317 final boolean optional;
15318 final Object defaultValue;
15319
15320 Attribute(Class<?> type, boolean optional, Object defaultValue) {
15321 this.t = type;
15322 this.optional = optional;
15323 this.defaultValue = defaultValue;
15324 assert optional || defaultValue == null;
15325 }
15326
15327 public Class<?> type() {
15328 return t;
15329 }
15330
15331 public boolean isOptional() {
15332 return optional;
15333 }
15334
15335 public Object defaultValue() {
15336 return defaultValue;
15337 }
15338 }
15339
15340 public enum TypeConstraint implements OnnxTypeConstraint {
15341 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
15342 ;
15343
15344 final OnnxType.TypeVariable typeVariable;
15345
15346 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15347 assert typeVariable.name().equals(name());
15348 this.typeVariable = typeVariable;
15349 }
15350
15351 @Override
15352 public OnnxType.TypeVariable typeVariable() {
15353 return typeVariable;
15354 }
15355 }
15356
15357 public enum InputParameter implements OnnxParameter {
15358 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15359 ;
15360
15361 final OnnxType type;
15362 final Quantifier quantifier;
15363
15364 InputParameter(OnnxType type, Quantifier quantifier) {
15365 this.type = type;
15366 this.quantifier = quantifier;
15367 }
15368
15369 @Override
15370 public OnnxType type() {
15371 return type;
15372 }
15373
15374 @Override
15375 public Quantifier quantifier() {
15376 return quantifier;
15377 }
15378 }
15379
15380 public enum OutputParameter implements OnnxParameter {
15381 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15382 ;
15383
15384 final OnnxType type;
15385 final Quantifier quantifier;
15386
15387 OutputParameter(OnnxType type, Quantifier quantifier) {
15388 this.type = type;
15389 this.quantifier = quantifier;
15390 }
15391
15392 @Override
15393 public OnnxType type() {
15394 return type;
15395 }
15396
15397 @Override
15398 public Quantifier quantifier() {
15399 return quantifier;
15400 }
15401 }
15402
15403 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15404 NAME,
15405 List.of(Attribute.values()),
15406 List.of(TypeConstraint.values()),
15407 List.of(InputParameter.values()),
15408 List.of(OutputParameter.values())
15409 );
15410
15411 public LogSoftmax(ExternalizedOp def) {
15412 super(SCHEMA, def);
15413 }
15414
15415 LogSoftmax(LogSoftmax that, CodeContext cc) {
15416 super(that, cc);
15417 }
15418
15419 @Override
15420 public LogSoftmax transform(CodeContext cc, CodeTransformer ot) {
15421 return new LogSoftmax(this, cc);
15422 }
15423
15424 LogSoftmax(CodeType resultType, Value input, java.util.Optional<Long> axis) {
15425 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis));
15426 }
15427
15428 @Override
15429 public SequencedSet<OnnxParameter> onnxOutputs() {
15430 return onnxOutputs(SCHEMA);
15431 }
15432
15433 @Override
15434 public SequencedMap<OnnxParameter, Object> onnxInputs() {
15435 return onnxInputs(SCHEMA, List.of(input()));
15436 }
15437
15438 public Value input() {
15439 return operands().get(0);
15440 }
15441
15442 public java.util.Optional<Long> axis() {
15443 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
15444 return java.util.Optional.ofNullable(axis);
15445 }
15446
15447 }
15448
15449 public static LogSoftmax LogSoftmax(CodeType resultType, Value input, java.util.Optional<Long> axis) {
15450 return new LogSoftmax(resultType, input, axis);
15451 }
15452
15453 @OpFactoryHelper.OpDeclaration(LpNormalization.NAME)
15454 public static final class LpNormalization extends OnnxOp {
15455 public static final String NAME = "LpNormalization";
15456
15457 public enum Attribute implements OnnxAttribute {
15458 p(Long.class, true, 2),
15459 axis(Long.class, true, -1),
15460 ;
15461
15462 final Class<?> t;
15463 final boolean optional;
15464 final Object defaultValue;
15465
15466 Attribute(Class<?> type, boolean optional, Object defaultValue) {
15467 this.t = type;
15468 this.optional = optional;
15469 this.defaultValue = defaultValue;
15470 assert optional || defaultValue == null;
15471 }
15472
15473 public Class<?> type() {
15474 return t;
15475 }
15476
15477 public boolean isOptional() {
15478 return optional;
15479 }
15480
15481 public Object defaultValue() {
15482 return defaultValue;
15483 }
15484 }
15485
15486 public enum TypeConstraint implements OnnxTypeConstraint {
15487 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
15488 ;
15489
15490 final OnnxType.TypeVariable typeVariable;
15491
15492 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15493 assert typeVariable.name().equals(name());
15494 this.typeVariable = typeVariable;
15495 }
15496
15497 @Override
15498 public OnnxType.TypeVariable typeVariable() {
15499 return typeVariable;
15500 }
15501 }
15502
15503 public enum InputParameter implements OnnxParameter {
15504 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15505 ;
15506
15507 final OnnxType type;
15508 final Quantifier quantifier;
15509
15510 InputParameter(OnnxType type, Quantifier quantifier) {
15511 this.type = type;
15512 this.quantifier = quantifier;
15513 }
15514
15515 @Override
15516 public OnnxType type() {
15517 return type;
15518 }
15519
15520 @Override
15521 public Quantifier quantifier() {
15522 return quantifier;
15523 }
15524 }
15525
15526 public enum OutputParameter implements OnnxParameter {
15527 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15528 ;
15529
15530 final OnnxType type;
15531 final Quantifier quantifier;
15532
15533 OutputParameter(OnnxType type, Quantifier quantifier) {
15534 this.type = type;
15535 this.quantifier = quantifier;
15536 }
15537
15538 @Override
15539 public OnnxType type() {
15540 return type;
15541 }
15542
15543 @Override
15544 public Quantifier quantifier() {
15545 return quantifier;
15546 }
15547 }
15548
15549 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15550 NAME,
15551 List.of(Attribute.values()),
15552 List.of(TypeConstraint.values()),
15553 List.of(InputParameter.values()),
15554 List.of(OutputParameter.values())
15555 );
15556
15557 public LpNormalization(ExternalizedOp def) {
15558 super(SCHEMA, def);
15559 }
15560
15561 LpNormalization(LpNormalization that, CodeContext cc) {
15562 super(that, cc);
15563 }
15564
15565 @Override
15566 public LpNormalization transform(CodeContext cc, CodeTransformer ot) {
15567 return new LpNormalization(this, cc);
15568 }
15569
15570 LpNormalization(CodeType resultType, Value input, java.util.Optional<Long> p, java.util.Optional<Long> axis) {
15571 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(p, axis));
15572 }
15573
15574 @Override
15575 public SequencedSet<OnnxParameter> onnxOutputs() {
15576 return onnxOutputs(SCHEMA);
15577 }
15578
15579 @Override
15580 public SequencedMap<OnnxParameter, Object> onnxInputs() {
15581 return onnxInputs(SCHEMA, List.of(input()));
15582 }
15583
15584 public Value input() {
15585 return operands().get(0);
15586 }
15587
15588 public java.util.Optional<Long> p() {
15589 Long p = Attribute.p.access(Long.class, onnxAttributes);
15590 return java.util.Optional.ofNullable(p);
15591 }
15592
15593 public java.util.Optional<Long> axis() {
15594 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
15595 return java.util.Optional.ofNullable(axis);
15596 }
15597
15598 }
15599
15600 public static LpNormalization LpNormalization(CodeType resultType, Value input, java.util.Optional<Long> p, java.util.Optional<Long> axis) {
15601 return new LpNormalization(resultType, input, p, axis);
15602 }
15603
15604 @OpFactoryHelper.OpDeclaration(LpPool.NAME)
15605 public static final class LpPool extends OnnxOp {
15606 public static final String NAME = "LpPool";
15607
15608 public enum Attribute implements OnnxAttribute {
15609 p(Long.class, true, 2),
15610 pads(long[].class, true, null),
15611 dilations(long[].class, true, null),
15612 auto_pad(String.class, true, "NOTSET"),
15613 ceil_mode(Long.class, true, 0),
15614 strides(long[].class, true, null),
15615 kernel_shape(long[].class, false, null),
15616 ;
15617
15618 final Class<?> t;
15619 final boolean optional;
15620 final Object defaultValue;
15621
15622 Attribute(Class<?> type, boolean optional, Object defaultValue) {
15623 this.t = type;
15624 this.optional = optional;
15625 this.defaultValue = defaultValue;
15626 assert optional || defaultValue == null;
15627 }
15628
15629 public Class<?> type() {
15630 return t;
15631 }
15632
15633 public boolean isOptional() {
15634 return optional;
15635 }
15636
15637 public Object defaultValue() {
15638 return defaultValue;
15639 }
15640 }
15641
15642 public enum TypeConstraint implements OnnxTypeConstraint {
15643 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
15644 ;
15645
15646 final OnnxType.TypeVariable typeVariable;
15647
15648 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15649 assert typeVariable.name().equals(name());
15650 this.typeVariable = typeVariable;
15651 }
15652
15653 @Override
15654 public OnnxType.TypeVariable typeVariable() {
15655 return typeVariable;
15656 }
15657 }
15658
15659 public enum InputParameter implements OnnxParameter {
15660 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15661 ;
15662
15663 final OnnxType type;
15664 final Quantifier quantifier;
15665
15666 InputParameter(OnnxType type, Quantifier quantifier) {
15667 this.type = type;
15668 this.quantifier = quantifier;
15669 }
15670
15671 @Override
15672 public OnnxType type() {
15673 return type;
15674 }
15675
15676 @Override
15677 public Quantifier quantifier() {
15678 return quantifier;
15679 }
15680 }
15681
15682 public enum OutputParameter implements OnnxParameter {
15683 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15684 ;
15685
15686 final OnnxType type;
15687 final Quantifier quantifier;
15688
15689 OutputParameter(OnnxType type, Quantifier quantifier) {
15690 this.type = type;
15691 this.quantifier = quantifier;
15692 }
15693
15694 @Override
15695 public OnnxType type() {
15696 return type;
15697 }
15698
15699 @Override
15700 public Quantifier quantifier() {
15701 return quantifier;
15702 }
15703 }
15704
15705 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15706 NAME,
15707 List.of(Attribute.values()),
15708 List.of(TypeConstraint.values()),
15709 List.of(InputParameter.values()),
15710 List.of(OutputParameter.values())
15711 );
15712
15713 public LpPool(ExternalizedOp def) {
15714 super(SCHEMA, def);
15715 }
15716
15717 LpPool(LpPool that, CodeContext cc) {
15718 super(that, cc);
15719 }
15720
15721 @Override
15722 public LpPool transform(CodeContext cc, CodeTransformer ot) {
15723 return new LpPool(this, cc);
15724 }
15725
15726 LpPool(CodeType resultType, Value X, java.util.Optional<Long> p, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<Long> ceil_mode, java.util.Optional<long[]> strides, long[] kernel_shape) {
15727 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(p, pads, dilations, auto_pad, ceil_mode, strides, kernel_shape));
15728 }
15729
15730 @Override
15731 public SequencedSet<OnnxParameter> onnxOutputs() {
15732 return onnxOutputs(SCHEMA);
15733 }
15734
15735 @Override
15736 public SequencedMap<OnnxParameter, Object> onnxInputs() {
15737 return onnxInputs(SCHEMA, List.of(X()));
15738 }
15739
15740 public Value X() {
15741 return operands().get(0);
15742 }
15743
15744 public java.util.Optional<Long> p() {
15745 Long p = Attribute.p.access(Long.class, onnxAttributes);
15746 return java.util.Optional.ofNullable(p);
15747 }
15748
15749 public java.util.Optional<long[]> pads() {
15750 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
15751 return java.util.Optional.ofNullable(pads).map(long[]::clone);
15752 }
15753
15754 public java.util.Optional<long[]> dilations() {
15755 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
15756 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
15757 }
15758
15759 public java.util.Optional<String> auto_pad() {
15760 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
15761 return java.util.Optional.ofNullable(auto_pad);
15762 }
15763
15764 public java.util.Optional<Long> ceil_mode() {
15765 Long ceil_mode = Attribute.ceil_mode.access(Long.class, onnxAttributes);
15766 return java.util.Optional.ofNullable(ceil_mode);
15767 }
15768
15769 public java.util.Optional<long[]> strides() {
15770 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
15771 return java.util.Optional.ofNullable(strides).map(long[]::clone);
15772 }
15773
15774 public long[] kernel_shape() {
15775 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
15776 return kernel_shape.clone();
15777 }
15778
15779 }
15780
15781 public static LpPool LpPool(CodeType resultType, Value X, java.util.Optional<Long> p, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<Long> ceil_mode, java.util.Optional<long[]> strides, long[] kernel_shape) {
15782 return new LpPool(resultType, X, p, pads, dilations, auto_pad, ceil_mode, strides, kernel_shape);
15783 }
15784
15785 @OpFactoryHelper.OpDeclaration(MatMul.NAME)
15786 public static final class MatMul extends OnnxOp {
15787 public static final String NAME = "MatMul";
15788
15789 public enum Attribute implements OnnxAttribute.None { }
15790
15791 public enum TypeConstraint implements OnnxTypeConstraint {
15792 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16())))),
15793 ;
15794
15795 final OnnxType.TypeVariable typeVariable;
15796
15797 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15798 assert typeVariable.name().equals(name());
15799 this.typeVariable = typeVariable;
15800 }
15801
15802 @Override
15803 public OnnxType.TypeVariable typeVariable() {
15804 return typeVariable;
15805 }
15806 }
15807
15808 public enum InputParameter implements OnnxParameter {
15809 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15810 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15811 ;
15812
15813 final OnnxType type;
15814 final Quantifier quantifier;
15815
15816 InputParameter(OnnxType type, Quantifier quantifier) {
15817 this.type = type;
15818 this.quantifier = quantifier;
15819 }
15820
15821 @Override
15822 public OnnxType type() {
15823 return type;
15824 }
15825
15826 @Override
15827 public Quantifier quantifier() {
15828 return quantifier;
15829 }
15830 }
15831
15832 public enum OutputParameter implements OnnxParameter {
15833 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
15834 ;
15835
15836 final OnnxType type;
15837 final Quantifier quantifier;
15838
15839 OutputParameter(OnnxType type, Quantifier quantifier) {
15840 this.type = type;
15841 this.quantifier = quantifier;
15842 }
15843
15844 @Override
15845 public OnnxType type() {
15846 return type;
15847 }
15848
15849 @Override
15850 public Quantifier quantifier() {
15851 return quantifier;
15852 }
15853 }
15854
15855 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15856 NAME,
15857 List.of(Attribute.values()),
15858 List.of(TypeConstraint.values()),
15859 List.of(InputParameter.values()),
15860 List.of(OutputParameter.values())
15861 );
15862
15863 public MatMul(ExternalizedOp def) {
15864 super(SCHEMA, def);
15865 }
15866
15867 MatMul(MatMul that, CodeContext cc) {
15868 super(that, cc);
15869 }
15870
15871 @Override
15872 public MatMul transform(CodeContext cc, CodeTransformer ot) {
15873 return new MatMul(this, cc);
15874 }
15875
15876 MatMul(CodeType resultType, Value A, Value B) {
15877 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
15878 }
15879
15880 @Override
15881 public SequencedSet<OnnxParameter> onnxOutputs() {
15882 return onnxOutputs(SCHEMA);
15883 }
15884
15885 @Override
15886 public SequencedMap<OnnxParameter, Object> onnxInputs() {
15887 return onnxInputs(SCHEMA, List.of(A(), B()));
15888 }
15889
15890 public Value A() {
15891 return operands().get(0);
15892 }
15893
15894 public Value B() {
15895 return operands().get(1);
15896 }
15897
15898 }
15899
15900 public static MatMul MatMul(CodeType resultType, Value A, Value B) {
15901 return new MatMul(resultType, A, B);
15902 }
15903
15904 @OpFactoryHelper.OpDeclaration(MatMulInteger.NAME)
15905 public static final class MatMulInteger extends OnnxOp {
15906 public static final String NAME = "MatMulInteger";
15907
15908 public enum Attribute implements OnnxAttribute.None { }
15909
15910 public enum TypeConstraint implements OnnxTypeConstraint {
15911 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
15912 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
15913 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int32())))),
15914 ;
15915
15916 final OnnxType.TypeVariable typeVariable;
15917
15918 TypeConstraint(OnnxType.TypeVariable typeVariable) {
15919 assert typeVariable.name().equals(name());
15920 this.typeVariable = typeVariable;
15921 }
15922
15923 @Override
15924 public OnnxType.TypeVariable typeVariable() {
15925 return typeVariable;
15926 }
15927 }
15928
15929 public enum InputParameter implements OnnxParameter {
15930 A(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
15931 B(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
15932 a_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
15933 b_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
15934 ;
15935
15936 final OnnxType type;
15937 final Quantifier quantifier;
15938
15939 InputParameter(OnnxType type, Quantifier quantifier) {
15940 this.type = type;
15941 this.quantifier = quantifier;
15942 }
15943
15944 @Override
15945 public OnnxType type() {
15946 return type;
15947 }
15948
15949 @Override
15950 public Quantifier quantifier() {
15951 return quantifier;
15952 }
15953 }
15954
15955 public enum OutputParameter implements OnnxParameter {
15956 Y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
15957 ;
15958
15959 final OnnxType type;
15960 final Quantifier quantifier;
15961
15962 OutputParameter(OnnxType type, Quantifier quantifier) {
15963 this.type = type;
15964 this.quantifier = quantifier;
15965 }
15966
15967 @Override
15968 public OnnxType type() {
15969 return type;
15970 }
15971
15972 @Override
15973 public Quantifier quantifier() {
15974 return quantifier;
15975 }
15976 }
15977
15978 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
15979 NAME,
15980 List.of(Attribute.values()),
15981 List.of(TypeConstraint.values()),
15982 List.of(InputParameter.values()),
15983 List.of(OutputParameter.values())
15984 );
15985
15986 public MatMulInteger(ExternalizedOp def) {
15987 super(SCHEMA, def);
15988 }
15989
15990 MatMulInteger(MatMulInteger that, CodeContext cc) {
15991 super(that, cc);
15992 }
15993
15994 @Override
15995 public MatMulInteger transform(CodeContext cc, CodeTransformer ot) {
15996 return new MatMulInteger(this, cc);
15997 }
15998
15999 MatMulInteger(CodeType resultType, Value A, Value B, java.util.Optional<Value> a_zero_point, java.util.Optional<Value> b_zero_point) {
16000 super(SCHEMA, resultType, Set.of(), List.of(A, B, a_zero_point, b_zero_point), List.of());
16001 }
16002
16003 @Override
16004 public SequencedSet<OnnxParameter> onnxOutputs() {
16005 return onnxOutputs(SCHEMA);
16006 }
16007
16008 @Override
16009 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16010 return onnxInputs(SCHEMA, List.of(A(), B(), a_zero_point(), b_zero_point()));
16011 }
16012
16013 public Value A() {
16014 return operands().get(0);
16015 }
16016
16017 public Value B() {
16018 return operands().get(1);
16019 }
16020
16021 public java.util.Optional<Value> a_zero_point() {
16022 int i = optionalInputArguments.indexOf(InputParameter.a_zero_point);
16023 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
16024 }
16025
16026 public java.util.Optional<Value> b_zero_point() {
16027 int i = optionalInputArguments.indexOf(InputParameter.b_zero_point);
16028 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
16029 }
16030
16031 }
16032
16033 public static MatMulInteger MatMulInteger(CodeType resultType, Value A, Value B, java.util.Optional<Value> a_zero_point, java.util.Optional<Value> b_zero_point) {
16034 return new MatMulInteger(resultType, A, B, a_zero_point, b_zero_point);
16035 }
16036
16037 @OpFactoryHelper.OpDeclaration(Max.NAME)
16038 public static final class Max extends OnnxOp {
16039 public static final String NAME = "Max";
16040
16041 public enum Attribute implements OnnxAttribute.None { }
16042
16043 public enum TypeConstraint implements OnnxTypeConstraint {
16044 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
16045 ;
16046
16047 final OnnxType.TypeVariable typeVariable;
16048
16049 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16050 assert typeVariable.name().equals(name());
16051 this.typeVariable = typeVariable;
16052 }
16053
16054 @Override
16055 public OnnxType.TypeVariable typeVariable() {
16056 return typeVariable;
16057 }
16058 }
16059
16060 public enum InputParameter implements OnnxParameter {
16061 data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
16062 ;
16063
16064 final OnnxType type;
16065 final Quantifier quantifier;
16066
16067 InputParameter(OnnxType type, Quantifier quantifier) {
16068 this.type = type;
16069 this.quantifier = quantifier;
16070 }
16071
16072 @Override
16073 public OnnxType type() {
16074 return type;
16075 }
16076
16077 @Override
16078 public Quantifier quantifier() {
16079 return quantifier;
16080 }
16081 }
16082
16083 public enum OutputParameter implements OnnxParameter {
16084 max(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16085 ;
16086
16087 final OnnxType type;
16088 final Quantifier quantifier;
16089
16090 OutputParameter(OnnxType type, Quantifier quantifier) {
16091 this.type = type;
16092 this.quantifier = quantifier;
16093 }
16094
16095 @Override
16096 public OnnxType type() {
16097 return type;
16098 }
16099
16100 @Override
16101 public Quantifier quantifier() {
16102 return quantifier;
16103 }
16104 }
16105
16106 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
16107 NAME,
16108 List.of(Attribute.values()),
16109 List.of(TypeConstraint.values()),
16110 List.of(InputParameter.values()),
16111 List.of(OutputParameter.values())
16112 );
16113
16114 public Max(ExternalizedOp def) {
16115 super(SCHEMA, def);
16116 }
16117
16118 Max(Max that, CodeContext cc) {
16119 super(that, cc);
16120 }
16121
16122 @Override
16123 public Max transform(CodeContext cc, CodeTransformer ot) {
16124 return new Max(this, cc);
16125 }
16126
16127 Max(CodeType resultType, List<Value> data_0) {
16128 super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of());
16129 }
16130
16131 @Override
16132 public SequencedSet<OnnxParameter> onnxOutputs() {
16133 return onnxOutputs(SCHEMA);
16134 }
16135
16136 @Override
16137 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16138 return onnxInputs(SCHEMA, List.of(data_0()));
16139 }
16140
16141 public List<Value> data_0() {
16142 return operands();
16143 }
16144
16145 }
16146
16147 public static Max Max(CodeType resultType, List<Value> data_0) {
16148 return new Max(resultType, data_0);
16149 }
16150
16151 @OpFactoryHelper.OpDeclaration(MaxPool.NAME)
16152 public static final class MaxPool extends OnnxOp {
16153 public static final String NAME = "MaxPool";
16154
16155 public enum Attribute implements OnnxAttribute {
16156 pads(long[].class, true, null),
16157 dilations(long[].class, true, null),
16158 auto_pad(String.class, true, "NOTSET"),
16159 ceil_mode(Long.class, true, 0),
16160 storage_order(Long.class, true, 0),
16161 strides(long[].class, true, null),
16162 kernel_shape(long[].class, false, null),
16163 ;
16164
16165 final Class<?> t;
16166 final boolean optional;
16167 final Object defaultValue;
16168
16169 Attribute(Class<?> type, boolean optional, Object defaultValue) {
16170 this.t = type;
16171 this.optional = optional;
16172 this.defaultValue = defaultValue;
16173 assert optional || defaultValue == null;
16174 }
16175
16176 public Class<?> type() {
16177 return t;
16178 }
16179
16180 public boolean isOptional() {
16181 return optional;
16182 }
16183
16184 public Object defaultValue() {
16185 return defaultValue;
16186 }
16187 }
16188
16189 public enum TypeConstraint implements OnnxTypeConstraint {
16190 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
16191 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int64())))),
16192 ;
16193
16194 final OnnxType.TypeVariable typeVariable;
16195
16196 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16197 assert typeVariable.name().equals(name());
16198 this.typeVariable = typeVariable;
16199 }
16200
16201 @Override
16202 public OnnxType.TypeVariable typeVariable() {
16203 return typeVariable;
16204 }
16205 }
16206
16207 public enum InputParameter implements OnnxParameter {
16208 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16209 ;
16210
16211 final OnnxType type;
16212 final Quantifier quantifier;
16213
16214 InputParameter(OnnxType type, Quantifier quantifier) {
16215 this.type = type;
16216 this.quantifier = quantifier;
16217 }
16218
16219 @Override
16220 public OnnxType type() {
16221 return type;
16222 }
16223
16224 @Override
16225 public Quantifier quantifier() {
16226 return quantifier;
16227 }
16228 }
16229
16230 public enum OutputParameter implements OnnxParameter {
16231 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16232 Indices(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL),
16233 ;
16234
16235 final OnnxType type;
16236 final Quantifier quantifier;
16237
16238 OutputParameter(OnnxType type, Quantifier quantifier) {
16239 this.type = type;
16240 this.quantifier = quantifier;
16241 }
16242
16243 @Override
16244 public OnnxType type() {
16245 return type;
16246 }
16247
16248 @Override
16249 public Quantifier quantifier() {
16250 return quantifier;
16251 }
16252 }
16253
16254 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
16255 NAME,
16256 List.of(Attribute.values()),
16257 List.of(TypeConstraint.values()),
16258 List.of(InputParameter.values()),
16259 List.of(OutputParameter.values())
16260 );
16261
16262 public MaxPool(ExternalizedOp def) {
16263 super(SCHEMA, def);
16264 }
16265
16266 MaxPool(MaxPool that, CodeContext cc) {
16267 super(that, cc);
16268 }
16269
16270 @Override
16271 public MaxPool transform(CodeContext cc, CodeTransformer ot) {
16272 return new MaxPool(this, cc);
16273 }
16274
16275 MaxPool(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<Long> ceil_mode, java.util.Optional<Long> storage_order, java.util.Optional<long[]> strides, long[] kernel_shape) {
16276 super(SCHEMA, resultType, optionalOutputs, List.of(X), List.of(pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape));
16277 }
16278
16279 @Override
16280 public SequencedSet<OnnxParameter> onnxOutputs() {
16281 return onnxOutputs(SCHEMA);
16282 }
16283
16284 @Override
16285 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16286 return onnxInputs(SCHEMA, List.of(X()));
16287 }
16288
16289 public Value X() {
16290 return operands().get(0);
16291 }
16292
16293 public java.util.Optional<long[]> pads() {
16294 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
16295 return java.util.Optional.ofNullable(pads).map(long[]::clone);
16296 }
16297
16298 public java.util.Optional<long[]> dilations() {
16299 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
16300 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
16301 }
16302
16303 public java.util.Optional<String> auto_pad() {
16304 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
16305 return java.util.Optional.ofNullable(auto_pad);
16306 }
16307
16308 public java.util.Optional<Long> ceil_mode() {
16309 Long ceil_mode = Attribute.ceil_mode.access(Long.class, onnxAttributes);
16310 return java.util.Optional.ofNullable(ceil_mode);
16311 }
16312
16313 public java.util.Optional<Long> storage_order() {
16314 Long storage_order = Attribute.storage_order.access(Long.class, onnxAttributes);
16315 return java.util.Optional.ofNullable(storage_order);
16316 }
16317
16318 public java.util.Optional<long[]> strides() {
16319 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
16320 return java.util.Optional.ofNullable(strides).map(long[]::clone);
16321 }
16322
16323 public long[] kernel_shape() {
16324 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
16325 return kernel_shape.clone();
16326 }
16327
16328 }
16329
16330 public static MaxPool MaxPool(CodeType resultType, Set<MaxPool.OutputParameter> optionalOutputs, Value X, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<Long> ceil_mode, java.util.Optional<Long> storage_order, java.util.Optional<long[]> strides, long[] kernel_shape) {
16331 return new MaxPool(resultType, optionalOutputs, X, pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape);
16332 }
16333
16334 @OpFactoryHelper.OpDeclaration(MaxRoiPool.NAME)
16335 public static final class MaxRoiPool extends OnnxOp {
16336 public static final String NAME = "MaxRoiPool";
16337
16338 public enum Attribute implements OnnxAttribute {
16339 spatial_scale(Float.class, true, 1.0f),
16340 pooled_shape(long[].class, false, null),
16341 ;
16342
16343 final Class<?> t;
16344 final boolean optional;
16345 final Object defaultValue;
16346
16347 Attribute(Class<?> type, boolean optional, Object defaultValue) {
16348 this.t = type;
16349 this.optional = optional;
16350 this.defaultValue = defaultValue;
16351 assert optional || defaultValue == null;
16352 }
16353
16354 public Class<?> type() {
16355 return t;
16356 }
16357
16358 public boolean isOptional() {
16359 return optional;
16360 }
16361
16362 public Object defaultValue() {
16363 return defaultValue;
16364 }
16365 }
16366
16367 public enum TypeConstraint implements OnnxTypeConstraint {
16368 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
16369 ;
16370
16371 final OnnxType.TypeVariable typeVariable;
16372
16373 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16374 assert typeVariable.name().equals(name());
16375 this.typeVariable = typeVariable;
16376 }
16377
16378 @Override
16379 public OnnxType.TypeVariable typeVariable() {
16380 return typeVariable;
16381 }
16382 }
16383
16384 public enum InputParameter implements OnnxParameter {
16385 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16386 rois(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16387 ;
16388
16389 final OnnxType type;
16390 final Quantifier quantifier;
16391
16392 InputParameter(OnnxType type, Quantifier quantifier) {
16393 this.type = type;
16394 this.quantifier = quantifier;
16395 }
16396
16397 @Override
16398 public OnnxType type() {
16399 return type;
16400 }
16401
16402 @Override
16403 public Quantifier quantifier() {
16404 return quantifier;
16405 }
16406 }
16407
16408 public enum OutputParameter implements OnnxParameter {
16409 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16410 ;
16411
16412 final OnnxType type;
16413 final Quantifier quantifier;
16414
16415 OutputParameter(OnnxType type, Quantifier quantifier) {
16416 this.type = type;
16417 this.quantifier = quantifier;
16418 }
16419
16420 @Override
16421 public OnnxType type() {
16422 return type;
16423 }
16424
16425 @Override
16426 public Quantifier quantifier() {
16427 return quantifier;
16428 }
16429 }
16430
16431 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
16432 NAME,
16433 List.of(Attribute.values()),
16434 List.of(TypeConstraint.values()),
16435 List.of(InputParameter.values()),
16436 List.of(OutputParameter.values())
16437 );
16438
16439 public MaxRoiPool(ExternalizedOp def) {
16440 super(SCHEMA, def);
16441 }
16442
16443 MaxRoiPool(MaxRoiPool that, CodeContext cc) {
16444 super(that, cc);
16445 }
16446
16447 @Override
16448 public MaxRoiPool transform(CodeContext cc, CodeTransformer ot) {
16449 return new MaxRoiPool(this, cc);
16450 }
16451
16452 MaxRoiPool(CodeType resultType, Value X, Value rois, java.util.Optional<Float> spatial_scale, long[] pooled_shape) {
16453 super(SCHEMA, resultType, Set.of(), List.of(X, rois), List.of(spatial_scale, pooled_shape));
16454 }
16455
16456 @Override
16457 public SequencedSet<OnnxParameter> onnxOutputs() {
16458 return onnxOutputs(SCHEMA);
16459 }
16460
16461 @Override
16462 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16463 return onnxInputs(SCHEMA, List.of(X(), rois()));
16464 }
16465
16466 public Value X() {
16467 return operands().get(0);
16468 }
16469
16470 public Value rois() {
16471 return operands().get(1);
16472 }
16473
16474 public java.util.Optional<Float> spatial_scale() {
16475 Float spatial_scale = Attribute.spatial_scale.access(Float.class, onnxAttributes);
16476 return java.util.Optional.ofNullable(spatial_scale);
16477 }
16478
16479 public long[] pooled_shape() {
16480 long[] pooled_shape = Attribute.pooled_shape.access(long[].class, onnxAttributes);
16481 return pooled_shape.clone();
16482 }
16483
16484 }
16485
16486 public static MaxRoiPool MaxRoiPool(CodeType resultType, Value X, Value rois, java.util.Optional<Float> spatial_scale, long[] pooled_shape) {
16487 return new MaxRoiPool(resultType, X, rois, spatial_scale, pooled_shape);
16488 }
16489
16490 @OpFactoryHelper.OpDeclaration(MaxUnpool.NAME)
16491 public static final class MaxUnpool extends OnnxOp {
16492 public static final String NAME = "MaxUnpool";
16493
16494 public enum Attribute implements OnnxAttribute {
16495 pads(long[].class, true, null),
16496 strides(long[].class, true, null),
16497 kernel_shape(long[].class, false, null),
16498 ;
16499
16500 final Class<?> t;
16501 final boolean optional;
16502 final Object defaultValue;
16503
16504 Attribute(Class<?> type, boolean optional, Object defaultValue) {
16505 this.t = type;
16506 this.optional = optional;
16507 this.defaultValue = defaultValue;
16508 assert optional || defaultValue == null;
16509 }
16510
16511 public Class<?> type() {
16512 return t;
16513 }
16514
16515 public boolean isOptional() {
16516 return optional;
16517 }
16518
16519 public Object defaultValue() {
16520 return defaultValue;
16521 }
16522 }
16523
16524 public enum TypeConstraint implements OnnxTypeConstraint {
16525 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
16526 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))),
16527 ;
16528
16529 final OnnxType.TypeVariable typeVariable;
16530
16531 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16532 assert typeVariable.name().equals(name());
16533 this.typeVariable = typeVariable;
16534 }
16535
16536 @Override
16537 public OnnxType.TypeVariable typeVariable() {
16538 return typeVariable;
16539 }
16540 }
16541
16542 public enum InputParameter implements OnnxParameter {
16543 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
16544 I(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
16545 output_shape(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
16546 ;
16547
16548 final OnnxType type;
16549 final Quantifier quantifier;
16550
16551 InputParameter(OnnxType type, Quantifier quantifier) {
16552 this.type = type;
16553 this.quantifier = quantifier;
16554 }
16555
16556 @Override
16557 public OnnxType type() {
16558 return type;
16559 }
16560
16561 @Override
16562 public Quantifier quantifier() {
16563 return quantifier;
16564 }
16565 }
16566
16567 public enum OutputParameter implements OnnxParameter {
16568 output(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
16569 ;
16570
16571 final OnnxType type;
16572 final Quantifier quantifier;
16573
16574 OutputParameter(OnnxType type, Quantifier quantifier) {
16575 this.type = type;
16576 this.quantifier = quantifier;
16577 }
16578
16579 @Override
16580 public OnnxType type() {
16581 return type;
16582 }
16583
16584 @Override
16585 public Quantifier quantifier() {
16586 return quantifier;
16587 }
16588 }
16589
16590 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
16591 NAME,
16592 List.of(Attribute.values()),
16593 List.of(TypeConstraint.values()),
16594 List.of(InputParameter.values()),
16595 List.of(OutputParameter.values())
16596 );
16597
16598 public MaxUnpool(ExternalizedOp def) {
16599 super(SCHEMA, def);
16600 }
16601
16602 MaxUnpool(MaxUnpool that, CodeContext cc) {
16603 super(that, cc);
16604 }
16605
16606 @Override
16607 public MaxUnpool transform(CodeContext cc, CodeTransformer ot) {
16608 return new MaxUnpool(this, cc);
16609 }
16610
16611 MaxUnpool(CodeType resultType, Value X, Value I, java.util.Optional<Value> output_shape, java.util.Optional<long[]> pads, java.util.Optional<long[]> strides, long[] kernel_shape) {
16612 super(SCHEMA, resultType, Set.of(), List.of(X, I, output_shape), List.of(pads, strides, kernel_shape));
16613 }
16614
16615 @Override
16616 public SequencedSet<OnnxParameter> onnxOutputs() {
16617 return onnxOutputs(SCHEMA);
16618 }
16619
16620 @Override
16621 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16622 return onnxInputs(SCHEMA, List.of(X(), I(), output_shape()));
16623 }
16624
16625 public Value X() {
16626 return operands().get(0);
16627 }
16628
16629 public Value I() {
16630 return operands().get(1);
16631 }
16632
16633 public java.util.Optional<Value> output_shape() {
16634 int i = optionalInputArguments.indexOf(InputParameter.output_shape);
16635 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
16636 }
16637
16638 public java.util.Optional<long[]> pads() {
16639 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
16640 return java.util.Optional.ofNullable(pads).map(long[]::clone);
16641 }
16642
16643 public java.util.Optional<long[]> strides() {
16644 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
16645 return java.util.Optional.ofNullable(strides).map(long[]::clone);
16646 }
16647
16648 public long[] kernel_shape() {
16649 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
16650 return kernel_shape.clone();
16651 }
16652
16653 }
16654
16655 public static MaxUnpool MaxUnpool(CodeType resultType, Value X, Value I, java.util.Optional<Value> output_shape, java.util.Optional<long[]> pads, java.util.Optional<long[]> strides, long[] kernel_shape) {
16656 return new MaxUnpool(resultType, X, I, output_shape, pads, strides, kernel_shape);
16657 }
16658
16659 @OpFactoryHelper.OpDeclaration(Mean.NAME)
16660 public static final class Mean extends OnnxOp {
16661 public static final String NAME = "Mean";
16662
16663 public enum Attribute implements OnnxAttribute.None { }
16664
16665 public enum TypeConstraint implements OnnxTypeConstraint {
16666 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
16667 ;
16668
16669 final OnnxType.TypeVariable typeVariable;
16670
16671 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16672 assert typeVariable.name().equals(name());
16673 this.typeVariable = typeVariable;
16674 }
16675
16676 @Override
16677 public OnnxType.TypeVariable typeVariable() {
16678 return typeVariable;
16679 }
16680 }
16681
16682 public enum InputParameter implements OnnxParameter {
16683 data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
16684 ;
16685
16686 final OnnxType type;
16687 final Quantifier quantifier;
16688
16689 InputParameter(OnnxType type, Quantifier quantifier) {
16690 this.type = type;
16691 this.quantifier = quantifier;
16692 }
16693
16694 @Override
16695 public OnnxType type() {
16696 return type;
16697 }
16698
16699 @Override
16700 public Quantifier quantifier() {
16701 return quantifier;
16702 }
16703 }
16704
16705 public enum OutputParameter implements OnnxParameter {
16706 mean(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16707 ;
16708
16709 final OnnxType type;
16710 final Quantifier quantifier;
16711
16712 OutputParameter(OnnxType type, Quantifier quantifier) {
16713 this.type = type;
16714 this.quantifier = quantifier;
16715 }
16716
16717 @Override
16718 public OnnxType type() {
16719 return type;
16720 }
16721
16722 @Override
16723 public Quantifier quantifier() {
16724 return quantifier;
16725 }
16726 }
16727
16728 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
16729 NAME,
16730 List.of(Attribute.values()),
16731 List.of(TypeConstraint.values()),
16732 List.of(InputParameter.values()),
16733 List.of(OutputParameter.values())
16734 );
16735
16736 public Mean(ExternalizedOp def) {
16737 super(SCHEMA, def);
16738 }
16739
16740 Mean(Mean that, CodeContext cc) {
16741 super(that, cc);
16742 }
16743
16744 @Override
16745 public Mean transform(CodeContext cc, CodeTransformer ot) {
16746 return new Mean(this, cc);
16747 }
16748
16749 Mean(CodeType resultType, List<Value> data_0) {
16750 super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of());
16751 }
16752
16753 @Override
16754 public SequencedSet<OnnxParameter> onnxOutputs() {
16755 return onnxOutputs(SCHEMA);
16756 }
16757
16758 @Override
16759 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16760 return onnxInputs(SCHEMA, List.of(data_0()));
16761 }
16762
16763 public List<Value> data_0() {
16764 return operands();
16765 }
16766
16767 }
16768
16769 public static Mean Mean(CodeType resultType, List<Value> data_0) {
16770 return new Mean(resultType, data_0);
16771 }
16772
16773 @OpFactoryHelper.OpDeclaration(MeanVarianceNormalization.NAME)
16774 public static final class MeanVarianceNormalization extends OnnxOp {
16775 public static final String NAME = "MeanVarianceNormalization";
16776
16777 public enum Attribute implements OnnxAttribute {
16778 axes(long[].class, true, null),
16779 ;
16780
16781 final Class<?> t;
16782 final boolean optional;
16783 final Object defaultValue;
16784
16785 Attribute(Class<?> type, boolean optional, Object defaultValue) {
16786 this.t = type;
16787 this.optional = optional;
16788 this.defaultValue = defaultValue;
16789 assert optional || defaultValue == null;
16790 }
16791
16792 public Class<?> type() {
16793 return t;
16794 }
16795
16796 public boolean isOptional() {
16797 return optional;
16798 }
16799
16800 public Object defaultValue() {
16801 return defaultValue;
16802 }
16803 }
16804
16805 public enum TypeConstraint implements OnnxTypeConstraint {
16806 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
16807 ;
16808
16809 final OnnxType.TypeVariable typeVariable;
16810
16811 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16812 assert typeVariable.name().equals(name());
16813 this.typeVariable = typeVariable;
16814 }
16815
16816 @Override
16817 public OnnxType.TypeVariable typeVariable() {
16818 return typeVariable;
16819 }
16820 }
16821
16822 public enum InputParameter implements OnnxParameter {
16823 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16824 ;
16825
16826 final OnnxType type;
16827 final Quantifier quantifier;
16828
16829 InputParameter(OnnxType type, Quantifier quantifier) {
16830 this.type = type;
16831 this.quantifier = quantifier;
16832 }
16833
16834 @Override
16835 public OnnxType type() {
16836 return type;
16837 }
16838
16839 @Override
16840 public Quantifier quantifier() {
16841 return quantifier;
16842 }
16843 }
16844
16845 public enum OutputParameter implements OnnxParameter {
16846 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
16847 ;
16848
16849 final OnnxType type;
16850 final Quantifier quantifier;
16851
16852 OutputParameter(OnnxType type, Quantifier quantifier) {
16853 this.type = type;
16854 this.quantifier = quantifier;
16855 }
16856
16857 @Override
16858 public OnnxType type() {
16859 return type;
16860 }
16861
16862 @Override
16863 public Quantifier quantifier() {
16864 return quantifier;
16865 }
16866 }
16867
16868 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
16869 NAME,
16870 List.of(Attribute.values()),
16871 List.of(TypeConstraint.values()),
16872 List.of(InputParameter.values()),
16873 List.of(OutputParameter.values())
16874 );
16875
16876 public MeanVarianceNormalization(ExternalizedOp def) {
16877 super(SCHEMA, def);
16878 }
16879
16880 MeanVarianceNormalization(MeanVarianceNormalization that, CodeContext cc) {
16881 super(that, cc);
16882 }
16883
16884 @Override
16885 public MeanVarianceNormalization transform(CodeContext cc, CodeTransformer ot) {
16886 return new MeanVarianceNormalization(this, cc);
16887 }
16888
16889 MeanVarianceNormalization(CodeType resultType, Value X, java.util.Optional<long[]> axes) {
16890 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(axes));
16891 }
16892
16893 @Override
16894 public SequencedSet<OnnxParameter> onnxOutputs() {
16895 return onnxOutputs(SCHEMA);
16896 }
16897
16898 @Override
16899 public SequencedMap<OnnxParameter, Object> onnxInputs() {
16900 return onnxInputs(SCHEMA, List.of(X()));
16901 }
16902
16903 public Value X() {
16904 return operands().get(0);
16905 }
16906
16907 public java.util.Optional<long[]> axes() {
16908 long[] axes = Attribute.axes.access(long[].class, onnxAttributes);
16909 return java.util.Optional.ofNullable(axes).map(long[]::clone);
16910 }
16911
16912 }
16913
16914 public static MeanVarianceNormalization MeanVarianceNormalization(CodeType resultType, Value X, java.util.Optional<long[]> axes) {
16915 return new MeanVarianceNormalization(resultType, X, axes);
16916 }
16917
16918 @OpFactoryHelper.OpDeclaration(MelWeightMatrix.NAME)
16919 public static final class MelWeightMatrix extends OnnxOp {
16920 public static final String NAME = "MelWeightMatrix";
16921
16922 public enum Attribute implements OnnxAttribute {
16923 output_datatype(Long.class, true, 1),
16924 ;
16925
16926 final Class<?> t;
16927 final boolean optional;
16928 final Object defaultValue;
16929
16930 Attribute(Class<?> type, boolean optional, Object defaultValue) {
16931 this.t = type;
16932 this.optional = optional;
16933 this.defaultValue = defaultValue;
16934 assert optional || defaultValue == null;
16935 }
16936
16937 public Class<?> type() {
16938 return t;
16939 }
16940
16941 public boolean isOptional() {
16942 return optional;
16943 }
16944
16945 public Object defaultValue() {
16946 return defaultValue;
16947 }
16948 }
16949
16950 public enum TypeConstraint implements OnnxTypeConstraint {
16951 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
16952 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
16953 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
16954 ;
16955
16956 final OnnxType.TypeVariable typeVariable;
16957
16958 TypeConstraint(OnnxType.TypeVariable typeVariable) {
16959 assert typeVariable.name().equals(name());
16960 this.typeVariable = typeVariable;
16961 }
16962
16963 @Override
16964 public OnnxType.TypeVariable typeVariable() {
16965 return typeVariable;
16966 }
16967 }
16968
16969 public enum InputParameter implements OnnxParameter {
16970 num_mel_bins(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
16971 dft_length(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
16972 sample_rate(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
16973 lower_edge_hertz(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
16974 upper_edge_hertz(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
16975 ;
16976
16977 final OnnxType type;
16978 final Quantifier quantifier;
16979
16980 InputParameter(OnnxType type, Quantifier quantifier) {
16981 this.type = type;
16982 this.quantifier = quantifier;
16983 }
16984
16985 @Override
16986 public OnnxType type() {
16987 return type;
16988 }
16989
16990 @Override
16991 public Quantifier quantifier() {
16992 return quantifier;
16993 }
16994 }
16995
16996 public enum OutputParameter implements OnnxParameter {
16997 output(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
16998 ;
16999
17000 final OnnxType type;
17001 final Quantifier quantifier;
17002
17003 OutputParameter(OnnxType type, Quantifier quantifier) {
17004 this.type = type;
17005 this.quantifier = quantifier;
17006 }
17007
17008 @Override
17009 public OnnxType type() {
17010 return type;
17011 }
17012
17013 @Override
17014 public Quantifier quantifier() {
17015 return quantifier;
17016 }
17017 }
17018
17019 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17020 NAME,
17021 List.of(Attribute.values()),
17022 List.of(TypeConstraint.values()),
17023 List.of(InputParameter.values()),
17024 List.of(OutputParameter.values())
17025 );
17026
17027 public MelWeightMatrix(ExternalizedOp def) {
17028 super(SCHEMA, def);
17029 }
17030
17031 MelWeightMatrix(MelWeightMatrix that, CodeContext cc) {
17032 super(that, cc);
17033 }
17034
17035 @Override
17036 public MelWeightMatrix transform(CodeContext cc, CodeTransformer ot) {
17037 return new MelWeightMatrix(this, cc);
17038 }
17039
17040 MelWeightMatrix(CodeType resultType, Value num_mel_bins, Value dft_length, Value sample_rate, Value lower_edge_hertz, Value upper_edge_hertz, java.util.Optional<Long> output_datatype) {
17041 super(SCHEMA, resultType, Set.of(), List.of(num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz), List.of(output_datatype));
17042 }
17043
17044 @Override
17045 public SequencedSet<OnnxParameter> onnxOutputs() {
17046 return onnxOutputs(SCHEMA);
17047 }
17048
17049 @Override
17050 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17051 return onnxInputs(SCHEMA, List.of(num_mel_bins(), dft_length(), sample_rate(), lower_edge_hertz(), upper_edge_hertz()));
17052 }
17053
17054 public Value num_mel_bins() {
17055 return operands().get(0);
17056 }
17057
17058 public Value dft_length() {
17059 return operands().get(1);
17060 }
17061
17062 public Value sample_rate() {
17063 return operands().get(2);
17064 }
17065
17066 public Value lower_edge_hertz() {
17067 return operands().get(3);
17068 }
17069
17070 public Value upper_edge_hertz() {
17071 return operands().get(4);
17072 }
17073
17074 public java.util.Optional<Long> output_datatype() {
17075 Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes);
17076 return java.util.Optional.ofNullable(output_datatype);
17077 }
17078
17079 }
17080
17081 public static MelWeightMatrix MelWeightMatrix(CodeType resultType, Value num_mel_bins, Value dft_length, Value sample_rate, Value lower_edge_hertz, Value upper_edge_hertz, java.util.Optional<Long> output_datatype) {
17082 return new MelWeightMatrix(resultType, num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz, output_datatype);
17083 }
17084
17085 @OpFactoryHelper.OpDeclaration(Min.NAME)
17086 public static final class Min extends OnnxOp {
17087 public static final String NAME = "Min";
17088
17089 public enum Attribute implements OnnxAttribute.None { }
17090
17091 public enum TypeConstraint implements OnnxTypeConstraint {
17092 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
17093 ;
17094
17095 final OnnxType.TypeVariable typeVariable;
17096
17097 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17098 assert typeVariable.name().equals(name());
17099 this.typeVariable = typeVariable;
17100 }
17101
17102 @Override
17103 public OnnxType.TypeVariable typeVariable() {
17104 return typeVariable;
17105 }
17106 }
17107
17108 public enum InputParameter implements OnnxParameter {
17109 data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
17110 ;
17111
17112 final OnnxType type;
17113 final Quantifier quantifier;
17114
17115 InputParameter(OnnxType type, Quantifier quantifier) {
17116 this.type = type;
17117 this.quantifier = quantifier;
17118 }
17119
17120 @Override
17121 public OnnxType type() {
17122 return type;
17123 }
17124
17125 @Override
17126 public Quantifier quantifier() {
17127 return quantifier;
17128 }
17129 }
17130
17131 public enum OutputParameter implements OnnxParameter {
17132 min(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17133 ;
17134
17135 final OnnxType type;
17136 final Quantifier quantifier;
17137
17138 OutputParameter(OnnxType type, Quantifier quantifier) {
17139 this.type = type;
17140 this.quantifier = quantifier;
17141 }
17142
17143 @Override
17144 public OnnxType type() {
17145 return type;
17146 }
17147
17148 @Override
17149 public Quantifier quantifier() {
17150 return quantifier;
17151 }
17152 }
17153
17154 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17155 NAME,
17156 List.of(Attribute.values()),
17157 List.of(TypeConstraint.values()),
17158 List.of(InputParameter.values()),
17159 List.of(OutputParameter.values())
17160 );
17161
17162 public Min(ExternalizedOp def) {
17163 super(SCHEMA, def);
17164 }
17165
17166 Min(Min that, CodeContext cc) {
17167 super(that, cc);
17168 }
17169
17170 @Override
17171 public Min transform(CodeContext cc, CodeTransformer ot) {
17172 return new Min(this, cc);
17173 }
17174
17175 Min(CodeType resultType, List<Value> data_0) {
17176 super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of());
17177 }
17178
17179 @Override
17180 public SequencedSet<OnnxParameter> onnxOutputs() {
17181 return onnxOutputs(SCHEMA);
17182 }
17183
17184 @Override
17185 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17186 return onnxInputs(SCHEMA, List.of(data_0()));
17187 }
17188
17189 public List<Value> data_0() {
17190 return operands();
17191 }
17192
17193 }
17194
17195 public static Min Min(CodeType resultType, List<Value> data_0) {
17196 return new Min(resultType, data_0);
17197 }
17198
17199 @OpFactoryHelper.OpDeclaration(Mish.NAME)
17200 public static final class Mish extends OnnxOp {
17201 public static final String NAME = "Mish";
17202
17203 public enum Attribute implements OnnxAttribute.None { }
17204
17205 public enum TypeConstraint implements OnnxTypeConstraint {
17206 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
17207 ;
17208
17209 final OnnxType.TypeVariable typeVariable;
17210
17211 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17212 assert typeVariable.name().equals(name());
17213 this.typeVariable = typeVariable;
17214 }
17215
17216 @Override
17217 public OnnxType.TypeVariable typeVariable() {
17218 return typeVariable;
17219 }
17220 }
17221
17222 public enum InputParameter implements OnnxParameter {
17223 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17224 ;
17225
17226 final OnnxType type;
17227 final Quantifier quantifier;
17228
17229 InputParameter(OnnxType type, Quantifier quantifier) {
17230 this.type = type;
17231 this.quantifier = quantifier;
17232 }
17233
17234 @Override
17235 public OnnxType type() {
17236 return type;
17237 }
17238
17239 @Override
17240 public Quantifier quantifier() {
17241 return quantifier;
17242 }
17243 }
17244
17245 public enum OutputParameter implements OnnxParameter {
17246 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17247 ;
17248
17249 final OnnxType type;
17250 final Quantifier quantifier;
17251
17252 OutputParameter(OnnxType type, Quantifier quantifier) {
17253 this.type = type;
17254 this.quantifier = quantifier;
17255 }
17256
17257 @Override
17258 public OnnxType type() {
17259 return type;
17260 }
17261
17262 @Override
17263 public Quantifier quantifier() {
17264 return quantifier;
17265 }
17266 }
17267
17268 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17269 NAME,
17270 List.of(Attribute.values()),
17271 List.of(TypeConstraint.values()),
17272 List.of(InputParameter.values()),
17273 List.of(OutputParameter.values())
17274 );
17275
17276 public Mish(ExternalizedOp def) {
17277 super(SCHEMA, def);
17278 }
17279
17280 Mish(Mish that, CodeContext cc) {
17281 super(that, cc);
17282 }
17283
17284 @Override
17285 public Mish transform(CodeContext cc, CodeTransformer ot) {
17286 return new Mish(this, cc);
17287 }
17288
17289 Mish(CodeType resultType, Value X) {
17290 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
17291 }
17292
17293 @Override
17294 public SequencedSet<OnnxParameter> onnxOutputs() {
17295 return onnxOutputs(SCHEMA);
17296 }
17297
17298 @Override
17299 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17300 return onnxInputs(SCHEMA, List.of(X()));
17301 }
17302
17303 public Value X() {
17304 return operands().get(0);
17305 }
17306
17307 }
17308
17309 public static Mish Mish(CodeType resultType, Value X) {
17310 return new Mish(resultType, X);
17311 }
17312
17313 @OpFactoryHelper.OpDeclaration(Mod.NAME)
17314 public static final class Mod extends OnnxOp {
17315 public static final String NAME = "Mod";
17316
17317 public enum Attribute implements OnnxAttribute {
17318 fmod(Long.class, true, 0),
17319 ;
17320
17321 final Class<?> t;
17322 final boolean optional;
17323 final Object defaultValue;
17324
17325 Attribute(Class<?> type, boolean optional, Object defaultValue) {
17326 this.t = type;
17327 this.optional = optional;
17328 this.defaultValue = defaultValue;
17329 assert optional || defaultValue == null;
17330 }
17331
17332 public Class<?> type() {
17333 return t;
17334 }
17335
17336 public boolean isOptional() {
17337 return optional;
17338 }
17339
17340 public Object defaultValue() {
17341 return defaultValue;
17342 }
17343 }
17344
17345 public enum TypeConstraint implements OnnxTypeConstraint {
17346 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
17347 ;
17348
17349 final OnnxType.TypeVariable typeVariable;
17350
17351 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17352 assert typeVariable.name().equals(name());
17353 this.typeVariable = typeVariable;
17354 }
17355
17356 @Override
17357 public OnnxType.TypeVariable typeVariable() {
17358 return typeVariable;
17359 }
17360 }
17361
17362 public enum InputParameter implements OnnxParameter {
17363 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17364 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17365 ;
17366
17367 final OnnxType type;
17368 final Quantifier quantifier;
17369
17370 InputParameter(OnnxType type, Quantifier quantifier) {
17371 this.type = type;
17372 this.quantifier = quantifier;
17373 }
17374
17375 @Override
17376 public OnnxType type() {
17377 return type;
17378 }
17379
17380 @Override
17381 public Quantifier quantifier() {
17382 return quantifier;
17383 }
17384 }
17385
17386 public enum OutputParameter implements OnnxParameter {
17387 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17388 ;
17389
17390 final OnnxType type;
17391 final Quantifier quantifier;
17392
17393 OutputParameter(OnnxType type, Quantifier quantifier) {
17394 this.type = type;
17395 this.quantifier = quantifier;
17396 }
17397
17398 @Override
17399 public OnnxType type() {
17400 return type;
17401 }
17402
17403 @Override
17404 public Quantifier quantifier() {
17405 return quantifier;
17406 }
17407 }
17408
17409 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17410 NAME,
17411 List.of(Attribute.values()),
17412 List.of(TypeConstraint.values()),
17413 List.of(InputParameter.values()),
17414 List.of(OutputParameter.values())
17415 );
17416
17417 public Mod(ExternalizedOp def) {
17418 super(SCHEMA, def);
17419 }
17420
17421 Mod(Mod that, CodeContext cc) {
17422 super(that, cc);
17423 }
17424
17425 @Override
17426 public Mod transform(CodeContext cc, CodeTransformer ot) {
17427 return new Mod(this, cc);
17428 }
17429
17430 Mod(CodeType resultType, Value A, Value B, java.util.Optional<Long> fmod) {
17431 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of(fmod));
17432 }
17433
17434 @Override
17435 public SequencedSet<OnnxParameter> onnxOutputs() {
17436 return onnxOutputs(SCHEMA);
17437 }
17438
17439 @Override
17440 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17441 return onnxInputs(SCHEMA, List.of(A(), B()));
17442 }
17443
17444 public Value A() {
17445 return operands().get(0);
17446 }
17447
17448 public Value B() {
17449 return operands().get(1);
17450 }
17451
17452 public java.util.Optional<Long> fmod() {
17453 Long fmod = Attribute.fmod.access(Long.class, onnxAttributes);
17454 return java.util.Optional.ofNullable(fmod);
17455 }
17456
17457 }
17458
17459 public static Mod Mod(CodeType resultType, Value A, Value B, java.util.Optional<Long> fmod) {
17460 return new Mod(resultType, A, B, fmod);
17461 }
17462
17463 @OpFactoryHelper.OpDeclaration(Momentum.NAME)
17464 public static final class Momentum extends OnnxOp {
17465 public static final String NAME = "Momentum";
17466
17467 public enum Attribute implements OnnxAttribute {
17468 mode(String.class, false, null),
17469 norm_coefficient(Float.class, false, null),
17470 alpha(Float.class, false, null),
17471 beta(Float.class, false, null),
17472 ;
17473
17474 final Class<?> t;
17475 final boolean optional;
17476 final Object defaultValue;
17477
17478 Attribute(Class<?> type, boolean optional, Object defaultValue) {
17479 this.t = type;
17480 this.optional = optional;
17481 this.defaultValue = defaultValue;
17482 assert optional || defaultValue == null;
17483 }
17484
17485 public Class<?> type() {
17486 return t;
17487 }
17488
17489 public boolean isOptional() {
17490 return optional;
17491 }
17492
17493 public Object defaultValue() {
17494 return defaultValue;
17495 }
17496 }
17497
17498 public enum TypeConstraint implements OnnxTypeConstraint {
17499 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
17500 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))),
17501 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
17502 ;
17503
17504 final OnnxType.TypeVariable typeVariable;
17505
17506 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17507 assert typeVariable.name().equals(name());
17508 this.typeVariable = typeVariable;
17509 }
17510
17511 @Override
17512 public OnnxType.TypeVariable typeVariable() {
17513 return typeVariable;
17514 }
17515 }
17516
17517 public enum InputParameter implements OnnxParameter {
17518 R(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
17519 T(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
17520 inputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC),
17521 ;
17522
17523 final OnnxType type;
17524 final Quantifier quantifier;
17525
17526 InputParameter(OnnxType type, Quantifier quantifier) {
17527 this.type = type;
17528 this.quantifier = quantifier;
17529 }
17530
17531 @Override
17532 public OnnxType type() {
17533 return type;
17534 }
17535
17536 @Override
17537 public Quantifier quantifier() {
17538 return quantifier;
17539 }
17540 }
17541
17542 public enum OutputParameter implements OnnxParameter {
17543 outputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC),
17544 ;
17545
17546 final OnnxType type;
17547 final Quantifier quantifier;
17548
17549 OutputParameter(OnnxType type, Quantifier quantifier) {
17550 this.type = type;
17551 this.quantifier = quantifier;
17552 }
17553
17554 @Override
17555 public OnnxType type() {
17556 return type;
17557 }
17558
17559 @Override
17560 public Quantifier quantifier() {
17561 return quantifier;
17562 }
17563 }
17564
17565 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17566 NAME,
17567 List.of(Attribute.values()),
17568 List.of(TypeConstraint.values()),
17569 List.of(InputParameter.values()),
17570 List.of(OutputParameter.values())
17571 );
17572
17573 public Momentum(ExternalizedOp def) {
17574 super(SCHEMA, def);
17575 }
17576
17577 Momentum(Momentum that, CodeContext cc) {
17578 super(that, cc);
17579 }
17580
17581 @Override
17582 public Momentum transform(CodeContext cc, CodeTransformer ot) {
17583 return new Momentum(this, cc);
17584 }
17585
17586 Momentum(CodeType resultType, Value R, Value T, List<Value> inputs, String mode, float norm_coefficient, float alpha, float beta) {
17587 super(SCHEMA, resultType, Set.of(), List.of(R, T, inputs), List.of(mode, norm_coefficient, alpha, beta));
17588 }
17589
17590 @Override
17591 public SequencedSet<OnnxParameter> onnxOutputs() {
17592 return onnxOutputs(SCHEMA);
17593 }
17594
17595 @Override
17596 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17597 return onnxInputs(SCHEMA, List.of(R(), T(), inputs()));
17598 }
17599
17600 public Value R() {
17601 return operands().get(0);
17602 }
17603
17604 public Value T() {
17605 return operands().get(1);
17606 }
17607
17608 public List<Value> inputs() {
17609 return operands().subList(2, operands().size());
17610 }
17611
17612 public String mode() {
17613 String mode = Attribute.mode.access(String.class, onnxAttributes);
17614 return mode;
17615 }
17616
17617 public float norm_coefficient() {
17618 float norm_coefficient = Attribute.norm_coefficient.access(Float.class, onnxAttributes);
17619 return norm_coefficient;
17620 }
17621
17622 public float alpha() {
17623 float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
17624 return alpha;
17625 }
17626
17627 public float beta() {
17628 float beta = Attribute.beta.access(Float.class, onnxAttributes);
17629 return beta;
17630 }
17631
17632 }
17633
17634 public static Momentum Momentum(CodeType resultType, Value R, Value T, List<Value> inputs, String mode, float norm_coefficient, float alpha, float beta) {
17635 return new Momentum(resultType, R, T, inputs, mode, norm_coefficient, alpha, beta);
17636 }
17637
17638 @OpFactoryHelper.OpDeclaration(Mul.NAME)
17639 public static final class Mul extends OnnxOp {
17640 public static final String NAME = "Mul";
17641
17642 public enum Attribute implements OnnxAttribute.None { }
17643
17644 public enum TypeConstraint implements OnnxTypeConstraint {
17645 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
17646 ;
17647
17648 final OnnxType.TypeVariable typeVariable;
17649
17650 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17651 assert typeVariable.name().equals(name());
17652 this.typeVariable = typeVariable;
17653 }
17654
17655 @Override
17656 public OnnxType.TypeVariable typeVariable() {
17657 return typeVariable;
17658 }
17659 }
17660
17661 public enum InputParameter implements OnnxParameter {
17662 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17663 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17664 ;
17665
17666 final OnnxType type;
17667 final Quantifier quantifier;
17668
17669 InputParameter(OnnxType type, Quantifier quantifier) {
17670 this.type = type;
17671 this.quantifier = quantifier;
17672 }
17673
17674 @Override
17675 public OnnxType type() {
17676 return type;
17677 }
17678
17679 @Override
17680 public Quantifier quantifier() {
17681 return quantifier;
17682 }
17683 }
17684
17685 public enum OutputParameter implements OnnxParameter {
17686 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17687 ;
17688
17689 final OnnxType type;
17690 final Quantifier quantifier;
17691
17692 OutputParameter(OnnxType type, Quantifier quantifier) {
17693 this.type = type;
17694 this.quantifier = quantifier;
17695 }
17696
17697 @Override
17698 public OnnxType type() {
17699 return type;
17700 }
17701
17702 @Override
17703 public Quantifier quantifier() {
17704 return quantifier;
17705 }
17706 }
17707
17708 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17709 NAME,
17710 List.of(Attribute.values()),
17711 List.of(TypeConstraint.values()),
17712 List.of(InputParameter.values()),
17713 List.of(OutputParameter.values())
17714 );
17715
17716 public Mul(ExternalizedOp def) {
17717 super(SCHEMA, def);
17718 }
17719
17720 Mul(Mul that, CodeContext cc) {
17721 super(that, cc);
17722 }
17723
17724 @Override
17725 public Mul transform(CodeContext cc, CodeTransformer ot) {
17726 return new Mul(this, cc);
17727 }
17728
17729 Mul(CodeType resultType, Value A, Value B) {
17730 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
17731 }
17732
17733 @Override
17734 public SequencedSet<OnnxParameter> onnxOutputs() {
17735 return onnxOutputs(SCHEMA);
17736 }
17737
17738 @Override
17739 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17740 return onnxInputs(SCHEMA, List.of(A(), B()));
17741 }
17742
17743 public Value A() {
17744 return operands().get(0);
17745 }
17746
17747 public Value B() {
17748 return operands().get(1);
17749 }
17750
17751 }
17752
17753 public static Mul Mul(CodeType resultType, Value A, Value B) {
17754 return new Mul(resultType, A, B);
17755 }
17756
17757 @OpFactoryHelper.OpDeclaration(Multinomial.NAME)
17758 public static final class Multinomial extends OnnxOp {
17759 public static final String NAME = "Multinomial";
17760
17761 public enum Attribute implements OnnxAttribute {
17762 seed(Float.class, true, null),
17763 sample_size(Long.class, true, 1),
17764 dtype(Long.class, true, 6),
17765 ;
17766
17767 final Class<?> t;
17768 final boolean optional;
17769 final Object defaultValue;
17770
17771 Attribute(Class<?> type, boolean optional, Object defaultValue) {
17772 this.t = type;
17773 this.optional = optional;
17774 this.defaultValue = defaultValue;
17775 assert optional || defaultValue == null;
17776 }
17777
17778 public Class<?> type() {
17779 return t;
17780 }
17781
17782 public boolean isOptional() {
17783 return optional;
17784 }
17785
17786 public Object defaultValue() {
17787 return defaultValue;
17788 }
17789 }
17790
17791 public enum TypeConstraint implements OnnxTypeConstraint {
17792 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
17793 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
17794 ;
17795
17796 final OnnxType.TypeVariable typeVariable;
17797
17798 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17799 assert typeVariable.name().equals(name());
17800 this.typeVariable = typeVariable;
17801 }
17802
17803 @Override
17804 public OnnxType.TypeVariable typeVariable() {
17805 return typeVariable;
17806 }
17807 }
17808
17809 public enum InputParameter implements OnnxParameter {
17810 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
17811 ;
17812
17813 final OnnxType type;
17814 final Quantifier quantifier;
17815
17816 InputParameter(OnnxType type, Quantifier quantifier) {
17817 this.type = type;
17818 this.quantifier = quantifier;
17819 }
17820
17821 @Override
17822 public OnnxType type() {
17823 return type;
17824 }
17825
17826 @Override
17827 public Quantifier quantifier() {
17828 return quantifier;
17829 }
17830 }
17831
17832 public enum OutputParameter implements OnnxParameter {
17833 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
17834 ;
17835
17836 final OnnxType type;
17837 final Quantifier quantifier;
17838
17839 OutputParameter(OnnxType type, Quantifier quantifier) {
17840 this.type = type;
17841 this.quantifier = quantifier;
17842 }
17843
17844 @Override
17845 public OnnxType type() {
17846 return type;
17847 }
17848
17849 @Override
17850 public Quantifier quantifier() {
17851 return quantifier;
17852 }
17853 }
17854
17855 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17856 NAME,
17857 List.of(Attribute.values()),
17858 List.of(TypeConstraint.values()),
17859 List.of(InputParameter.values()),
17860 List.of(OutputParameter.values())
17861 );
17862
17863 public Multinomial(ExternalizedOp def) {
17864 super(SCHEMA, def);
17865 }
17866
17867 Multinomial(Multinomial that, CodeContext cc) {
17868 super(that, cc);
17869 }
17870
17871 @Override
17872 public Multinomial transform(CodeContext cc, CodeTransformer ot) {
17873 return new Multinomial(this, cc);
17874 }
17875
17876 Multinomial(CodeType resultType, Value input, java.util.Optional<Float> seed, java.util.Optional<Long> sample_size, java.util.Optional<Long> dtype) {
17877 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(seed, sample_size, dtype));
17878 }
17879
17880 @Override
17881 public SequencedSet<OnnxParameter> onnxOutputs() {
17882 return onnxOutputs(SCHEMA);
17883 }
17884
17885 @Override
17886 public SequencedMap<OnnxParameter, Object> onnxInputs() {
17887 return onnxInputs(SCHEMA, List.of(input()));
17888 }
17889
17890 public Value input() {
17891 return operands().get(0);
17892 }
17893
17894 public java.util.Optional<Float> seed() {
17895 Float seed = Attribute.seed.access(Float.class, onnxAttributes);
17896 return java.util.Optional.ofNullable(seed);
17897 }
17898
17899 public java.util.Optional<Long> sample_size() {
17900 Long sample_size = Attribute.sample_size.access(Long.class, onnxAttributes);
17901 return java.util.Optional.ofNullable(sample_size);
17902 }
17903
17904 public java.util.Optional<Long> dtype() {
17905 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
17906 return java.util.Optional.ofNullable(dtype);
17907 }
17908
17909 }
17910
17911 public static Multinomial Multinomial(CodeType resultType, Value input, java.util.Optional<Float> seed, java.util.Optional<Long> sample_size, java.util.Optional<Long> dtype) {
17912 return new Multinomial(resultType, input, seed, sample_size, dtype);
17913 }
17914
17915 @OpFactoryHelper.OpDeclaration(Neg.NAME)
17916 public static final class Neg extends OnnxOp {
17917 public static final String NAME = "Neg";
17918
17919 public enum Attribute implements OnnxAttribute.None { }
17920
17921 public enum TypeConstraint implements OnnxTypeConstraint {
17922 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
17923 ;
17924
17925 final OnnxType.TypeVariable typeVariable;
17926
17927 TypeConstraint(OnnxType.TypeVariable typeVariable) {
17928 assert typeVariable.name().equals(name());
17929 this.typeVariable = typeVariable;
17930 }
17931
17932 @Override
17933 public OnnxType.TypeVariable typeVariable() {
17934 return typeVariable;
17935 }
17936 }
17937
17938 public enum InputParameter implements OnnxParameter {
17939 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17940 ;
17941
17942 final OnnxType type;
17943 final Quantifier quantifier;
17944
17945 InputParameter(OnnxType type, Quantifier quantifier) {
17946 this.type = type;
17947 this.quantifier = quantifier;
17948 }
17949
17950 @Override
17951 public OnnxType type() {
17952 return type;
17953 }
17954
17955 @Override
17956 public Quantifier quantifier() {
17957 return quantifier;
17958 }
17959 }
17960
17961 public enum OutputParameter implements OnnxParameter {
17962 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
17963 ;
17964
17965 final OnnxType type;
17966 final Quantifier quantifier;
17967
17968 OutputParameter(OnnxType type, Quantifier quantifier) {
17969 this.type = type;
17970 this.quantifier = quantifier;
17971 }
17972
17973 @Override
17974 public OnnxType type() {
17975 return type;
17976 }
17977
17978 @Override
17979 public Quantifier quantifier() {
17980 return quantifier;
17981 }
17982 }
17983
17984 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
17985 NAME,
17986 List.of(Attribute.values()),
17987 List.of(TypeConstraint.values()),
17988 List.of(InputParameter.values()),
17989 List.of(OutputParameter.values())
17990 );
17991
17992 public Neg(ExternalizedOp def) {
17993 super(SCHEMA, def);
17994 }
17995
17996 Neg(Neg that, CodeContext cc) {
17997 super(that, cc);
17998 }
17999
18000 @Override
18001 public Neg transform(CodeContext cc, CodeTransformer ot) {
18002 return new Neg(this, cc);
18003 }
18004
18005 Neg(CodeType resultType, Value X) {
18006 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
18007 }
18008
18009 @Override
18010 public SequencedSet<OnnxParameter> onnxOutputs() {
18011 return onnxOutputs(SCHEMA);
18012 }
18013
18014 @Override
18015 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18016 return onnxInputs(SCHEMA, List.of(X()));
18017 }
18018
18019 public Value X() {
18020 return operands().get(0);
18021 }
18022
18023 }
18024
18025 public static Neg Neg(CodeType resultType, Value X) {
18026 return new Neg(resultType, X);
18027 }
18028
18029 @OpFactoryHelper.OpDeclaration(NegativeLogLikelihoodLoss.NAME)
18030 public static final class NegativeLogLikelihoodLoss extends OnnxOp {
18031 public static final String NAME = "NegativeLogLikelihoodLoss";
18032
18033 public enum Attribute implements OnnxAttribute {
18034 ignore_index(Long.class, true, null),
18035 reduction(String.class, true, "mean"),
18036 ;
18037
18038 final Class<?> t;
18039 final boolean optional;
18040 final Object defaultValue;
18041
18042 Attribute(Class<?> type, boolean optional, Object defaultValue) {
18043 this.t = type;
18044 this.optional = optional;
18045 this.defaultValue = defaultValue;
18046 assert optional || defaultValue == null;
18047 }
18048
18049 public Class<?> type() {
18050 return t;
18051 }
18052
18053 public boolean isOptional() {
18054 return optional;
18055 }
18056
18057 public Object defaultValue() {
18058 return defaultValue;
18059 }
18060 }
18061
18062 public enum TypeConstraint implements OnnxTypeConstraint {
18063 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
18064 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
18065 ;
18066
18067 final OnnxType.TypeVariable typeVariable;
18068
18069 TypeConstraint(OnnxType.TypeVariable typeVariable) {
18070 assert typeVariable.name().equals(name());
18071 this.typeVariable = typeVariable;
18072 }
18073
18074 @Override
18075 public OnnxType.TypeVariable typeVariable() {
18076 return typeVariable;
18077 }
18078 }
18079
18080 public enum InputParameter implements OnnxParameter {
18081 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18082 target(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
18083 weight(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
18084 ;
18085
18086 final OnnxType type;
18087 final Quantifier quantifier;
18088
18089 InputParameter(OnnxType type, Quantifier quantifier) {
18090 this.type = type;
18091 this.quantifier = quantifier;
18092 }
18093
18094 @Override
18095 public OnnxType type() {
18096 return type;
18097 }
18098
18099 @Override
18100 public Quantifier quantifier() {
18101 return quantifier;
18102 }
18103 }
18104
18105 public enum OutputParameter implements OnnxParameter {
18106 loss(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18107 ;
18108
18109 final OnnxType type;
18110 final Quantifier quantifier;
18111
18112 OutputParameter(OnnxType type, Quantifier quantifier) {
18113 this.type = type;
18114 this.quantifier = quantifier;
18115 }
18116
18117 @Override
18118 public OnnxType type() {
18119 return type;
18120 }
18121
18122 @Override
18123 public Quantifier quantifier() {
18124 return quantifier;
18125 }
18126 }
18127
18128 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18129 NAME,
18130 List.of(Attribute.values()),
18131 List.of(TypeConstraint.values()),
18132 List.of(InputParameter.values()),
18133 List.of(OutputParameter.values())
18134 );
18135
18136 public NegativeLogLikelihoodLoss(ExternalizedOp def) {
18137 super(SCHEMA, def);
18138 }
18139
18140 NegativeLogLikelihoodLoss(NegativeLogLikelihoodLoss that, CodeContext cc) {
18141 super(that, cc);
18142 }
18143
18144 @Override
18145 public NegativeLogLikelihoodLoss transform(CodeContext cc, CodeTransformer ot) {
18146 return new NegativeLogLikelihoodLoss(this, cc);
18147 }
18148
18149 NegativeLogLikelihoodLoss(CodeType resultType, Value input, Value target, java.util.Optional<Value> weight, java.util.Optional<Long> ignore_index, java.util.Optional<String> reduction) {
18150 super(SCHEMA, resultType, Set.of(), List.of(input, target, weight), List.of(ignore_index, reduction));
18151 }
18152
18153 @Override
18154 public SequencedSet<OnnxParameter> onnxOutputs() {
18155 return onnxOutputs(SCHEMA);
18156 }
18157
18158 @Override
18159 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18160 return onnxInputs(SCHEMA, List.of(input(), target(), weight()));
18161 }
18162
18163 public Value input() {
18164 return operands().get(0);
18165 }
18166
18167 public Value target() {
18168 return operands().get(1);
18169 }
18170
18171 public java.util.Optional<Value> weight() {
18172 int i = optionalInputArguments.indexOf(InputParameter.weight);
18173 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
18174 }
18175
18176 public java.util.Optional<Long> ignore_index() {
18177 Long ignore_index = Attribute.ignore_index.access(Long.class, onnxAttributes);
18178 return java.util.Optional.ofNullable(ignore_index);
18179 }
18180
18181 public java.util.Optional<String> reduction() {
18182 String reduction = Attribute.reduction.access(String.class, onnxAttributes);
18183 return java.util.Optional.ofNullable(reduction);
18184 }
18185
18186 }
18187
18188 public static NegativeLogLikelihoodLoss NegativeLogLikelihoodLoss(CodeType resultType, Value input, Value target, java.util.Optional<Value> weight, java.util.Optional<Long> ignore_index, java.util.Optional<String> reduction) {
18189 return new NegativeLogLikelihoodLoss(resultType, input, target, weight, ignore_index, reduction);
18190 }
18191
18192 @OpFactoryHelper.OpDeclaration(NonMaxSuppression.NAME)
18193 public static final class NonMaxSuppression extends OnnxOp {
18194 public static final String NAME = "NonMaxSuppression";
18195
18196 public enum Attribute implements OnnxAttribute {
18197 center_point_box(Long.class, true, 0),
18198 ;
18199
18200 final Class<?> t;
18201 final boolean optional;
18202 final Object defaultValue;
18203
18204 Attribute(Class<?> type, boolean optional, Object defaultValue) {
18205 this.t = type;
18206 this.optional = optional;
18207 this.defaultValue = defaultValue;
18208 assert optional || defaultValue == null;
18209 }
18210
18211 public Class<?> type() {
18212 return t;
18213 }
18214
18215 public boolean isOptional() {
18216 return optional;
18217 }
18218
18219 public Object defaultValue() {
18220 return defaultValue;
18221 }
18222 }
18223
18224 public enum TypeConstraint implements OnnxTypeConstraint.None { }
18225
18226 public enum InputParameter implements OnnxParameter {
18227 boxes(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
18228 scores(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
18229 max_output_boxes_per_class(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
18230 iou_threshold(OnnxType.tensor(OnnxType.float32()), Quantifier.OPTIONAL),
18231 score_threshold(OnnxType.tensor(OnnxType.float32()), Quantifier.OPTIONAL),
18232 ;
18233
18234 final OnnxType type;
18235 final Quantifier quantifier;
18236
18237 InputParameter(OnnxType type, Quantifier quantifier) {
18238 this.type = type;
18239 this.quantifier = quantifier;
18240 }
18241
18242 @Override
18243 public OnnxType type() {
18244 return type;
18245 }
18246
18247 @Override
18248 public Quantifier quantifier() {
18249 return quantifier;
18250 }
18251 }
18252
18253 public enum OutputParameter implements OnnxParameter {
18254 selected_indices(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
18255 ;
18256
18257 final OnnxType type;
18258 final Quantifier quantifier;
18259
18260 OutputParameter(OnnxType type, Quantifier quantifier) {
18261 this.type = type;
18262 this.quantifier = quantifier;
18263 }
18264
18265 @Override
18266 public OnnxType type() {
18267 return type;
18268 }
18269
18270 @Override
18271 public Quantifier quantifier() {
18272 return quantifier;
18273 }
18274 }
18275
18276 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18277 NAME,
18278 List.of(Attribute.values()),
18279 List.of(TypeConstraint.values()),
18280 List.of(InputParameter.values()),
18281 List.of(OutputParameter.values())
18282 );
18283
18284 public NonMaxSuppression(ExternalizedOp def) {
18285 super(SCHEMA, def);
18286 }
18287
18288 NonMaxSuppression(NonMaxSuppression that, CodeContext cc) {
18289 super(that, cc);
18290 }
18291
18292 @Override
18293 public NonMaxSuppression transform(CodeContext cc, CodeTransformer ot) {
18294 return new NonMaxSuppression(this, cc);
18295 }
18296
18297 NonMaxSuppression(CodeType resultType, Value boxes, Value scores, java.util.Optional<Value> max_output_boxes_per_class, java.util.Optional<Value> iou_threshold, java.util.Optional<Value> score_threshold, java.util.Optional<Long> center_point_box) {
18298 super(SCHEMA, resultType, Set.of(), List.of(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold), List.of(center_point_box));
18299 }
18300
18301 @Override
18302 public SequencedSet<OnnxParameter> onnxOutputs() {
18303 return onnxOutputs(SCHEMA);
18304 }
18305
18306 @Override
18307 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18308 return onnxInputs(SCHEMA, List.of(boxes(), scores(), max_output_boxes_per_class(), iou_threshold(), score_threshold()));
18309 }
18310
18311 public Value boxes() {
18312 return operands().get(0);
18313 }
18314
18315 public Value scores() {
18316 return operands().get(1);
18317 }
18318
18319 public java.util.Optional<Value> max_output_boxes_per_class() {
18320 int i = optionalInputArguments.indexOf(InputParameter.max_output_boxes_per_class);
18321 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
18322 }
18323
18324 public java.util.Optional<Value> iou_threshold() {
18325 int i = optionalInputArguments.indexOf(InputParameter.iou_threshold);
18326 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
18327 }
18328
18329 public java.util.Optional<Value> score_threshold() {
18330 int i = optionalInputArguments.indexOf(InputParameter.score_threshold);
18331 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
18332 }
18333
18334 public java.util.Optional<Long> center_point_box() {
18335 Long center_point_box = Attribute.center_point_box.access(Long.class, onnxAttributes);
18336 return java.util.Optional.ofNullable(center_point_box);
18337 }
18338
18339 }
18340
18341 public static NonMaxSuppression NonMaxSuppression(CodeType resultType, Value boxes, Value scores, java.util.Optional<Value> max_output_boxes_per_class, java.util.Optional<Value> iou_threshold, java.util.Optional<Value> score_threshold, java.util.Optional<Long> center_point_box) {
18342 return new NonMaxSuppression(resultType, boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold, center_point_box);
18343 }
18344
18345 @OpFactoryHelper.OpDeclaration(NonZero.NAME)
18346 public static final class NonZero extends OnnxOp {
18347 public static final String NAME = "NonZero";
18348
18349 public enum Attribute implements OnnxAttribute.None { }
18350
18351 public enum TypeConstraint implements OnnxTypeConstraint {
18352 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
18353 ;
18354
18355 final OnnxType.TypeVariable typeVariable;
18356
18357 TypeConstraint(OnnxType.TypeVariable typeVariable) {
18358 assert typeVariable.name().equals(name());
18359 this.typeVariable = typeVariable;
18360 }
18361
18362 @Override
18363 public OnnxType.TypeVariable typeVariable() {
18364 return typeVariable;
18365 }
18366 }
18367
18368 public enum InputParameter implements OnnxParameter {
18369 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18370 ;
18371
18372 final OnnxType type;
18373 final Quantifier quantifier;
18374
18375 InputParameter(OnnxType type, Quantifier quantifier) {
18376 this.type = type;
18377 this.quantifier = quantifier;
18378 }
18379
18380 @Override
18381 public OnnxType type() {
18382 return type;
18383 }
18384
18385 @Override
18386 public Quantifier quantifier() {
18387 return quantifier;
18388 }
18389 }
18390
18391 public enum OutputParameter implements OnnxParameter {
18392 Y(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
18393 ;
18394
18395 final OnnxType type;
18396 final Quantifier quantifier;
18397
18398 OutputParameter(OnnxType type, Quantifier quantifier) {
18399 this.type = type;
18400 this.quantifier = quantifier;
18401 }
18402
18403 @Override
18404 public OnnxType type() {
18405 return type;
18406 }
18407
18408 @Override
18409 public Quantifier quantifier() {
18410 return quantifier;
18411 }
18412 }
18413
18414 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18415 NAME,
18416 List.of(Attribute.values()),
18417 List.of(TypeConstraint.values()),
18418 List.of(InputParameter.values()),
18419 List.of(OutputParameter.values())
18420 );
18421
18422 public NonZero(ExternalizedOp def) {
18423 super(SCHEMA, def);
18424 }
18425
18426 NonZero(NonZero that, CodeContext cc) {
18427 super(that, cc);
18428 }
18429
18430 @Override
18431 public NonZero transform(CodeContext cc, CodeTransformer ot) {
18432 return new NonZero(this, cc);
18433 }
18434
18435 NonZero(CodeType resultType, Value X) {
18436 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
18437 }
18438
18439 @Override
18440 public SequencedSet<OnnxParameter> onnxOutputs() {
18441 return onnxOutputs(SCHEMA);
18442 }
18443
18444 @Override
18445 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18446 return onnxInputs(SCHEMA, List.of(X()));
18447 }
18448
18449 public Value X() {
18450 return operands().get(0);
18451 }
18452
18453 }
18454
18455 public static NonZero NonZero(CodeType resultType, Value X) {
18456 return new NonZero(resultType, X);
18457 }
18458
18459 @OpFactoryHelper.OpDeclaration(Normalizer.NAME)
18460 public static final class Normalizer extends OnnxOp {
18461 public static final String NAME = "Normalizer";
18462
18463 public enum Attribute implements OnnxAttribute {
18464 norm(String.class, true, "MAX"),
18465 ;
18466
18467 final Class<?> t;
18468 final boolean optional;
18469 final Object defaultValue;
18470
18471 Attribute(Class<?> type, boolean optional, Object defaultValue) {
18472 this.t = type;
18473 this.optional = optional;
18474 this.defaultValue = defaultValue;
18475 assert optional || defaultValue == null;
18476 }
18477
18478 public Class<?> type() {
18479 return t;
18480 }
18481
18482 public boolean isOptional() {
18483 return optional;
18484 }
18485
18486 public Object defaultValue() {
18487 return defaultValue;
18488 }
18489 }
18490
18491 public enum TypeConstraint implements OnnxTypeConstraint {
18492 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
18493 ;
18494
18495 final OnnxType.TypeVariable typeVariable;
18496
18497 TypeConstraint(OnnxType.TypeVariable typeVariable) {
18498 assert typeVariable.name().equals(name());
18499 this.typeVariable = typeVariable;
18500 }
18501
18502 @Override
18503 public OnnxType.TypeVariable typeVariable() {
18504 return typeVariable;
18505 }
18506 }
18507
18508 public enum InputParameter implements OnnxParameter {
18509 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18510 ;
18511
18512 final OnnxType type;
18513 final Quantifier quantifier;
18514
18515 InputParameter(OnnxType type, Quantifier quantifier) {
18516 this.type = type;
18517 this.quantifier = quantifier;
18518 }
18519
18520 @Override
18521 public OnnxType type() {
18522 return type;
18523 }
18524
18525 @Override
18526 public Quantifier quantifier() {
18527 return quantifier;
18528 }
18529 }
18530
18531 public enum OutputParameter implements OnnxParameter {
18532 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
18533 ;
18534
18535 final OnnxType type;
18536 final Quantifier quantifier;
18537
18538 OutputParameter(OnnxType type, Quantifier quantifier) {
18539 this.type = type;
18540 this.quantifier = quantifier;
18541 }
18542
18543 @Override
18544 public OnnxType type() {
18545 return type;
18546 }
18547
18548 @Override
18549 public Quantifier quantifier() {
18550 return quantifier;
18551 }
18552 }
18553
18554 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18555 NAME,
18556 List.of(Attribute.values()),
18557 List.of(TypeConstraint.values()),
18558 List.of(InputParameter.values()),
18559 List.of(OutputParameter.values())
18560 );
18561
18562 public Normalizer(ExternalizedOp def) {
18563 super(SCHEMA, def);
18564 }
18565
18566 Normalizer(Normalizer that, CodeContext cc) {
18567 super(that, cc);
18568 }
18569
18570 @Override
18571 public Normalizer transform(CodeContext cc, CodeTransformer ot) {
18572 return new Normalizer(this, cc);
18573 }
18574
18575 Normalizer(CodeType resultType, Value X, java.util.Optional<String> norm) {
18576 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(norm));
18577 }
18578
18579 @Override
18580 public SequencedSet<OnnxParameter> onnxOutputs() {
18581 return onnxOutputs(SCHEMA);
18582 }
18583
18584 @Override
18585 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18586 return onnxInputs(SCHEMA, List.of(X()));
18587 }
18588
18589 public Value X() {
18590 return operands().get(0);
18591 }
18592
18593 public java.util.Optional<String> norm() {
18594 String norm = Attribute.norm.access(String.class, onnxAttributes);
18595 return java.util.Optional.ofNullable(norm);
18596 }
18597
18598 }
18599
18600 public static Normalizer Normalizer(CodeType resultType, Value X, java.util.Optional<String> norm) {
18601 return new Normalizer(resultType, X, norm);
18602 }
18603
18604 @OpFactoryHelper.OpDeclaration(Not.NAME)
18605 public static final class Not extends OnnxOp {
18606 public static final String NAME = "Not";
18607
18608 public enum Attribute implements OnnxAttribute.None { }
18609
18610 public enum TypeConstraint implements OnnxTypeConstraint {
18611 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))),
18612 ;
18613
18614 final OnnxType.TypeVariable typeVariable;
18615
18616 TypeConstraint(OnnxType.TypeVariable typeVariable) {
18617 assert typeVariable.name().equals(name());
18618 this.typeVariable = typeVariable;
18619 }
18620
18621 @Override
18622 public OnnxType.TypeVariable typeVariable() {
18623 return typeVariable;
18624 }
18625 }
18626
18627 public enum InputParameter implements OnnxParameter {
18628 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18629 ;
18630
18631 final OnnxType type;
18632 final Quantifier quantifier;
18633
18634 InputParameter(OnnxType type, Quantifier quantifier) {
18635 this.type = type;
18636 this.quantifier = quantifier;
18637 }
18638
18639 @Override
18640 public OnnxType type() {
18641 return type;
18642 }
18643
18644 @Override
18645 public Quantifier quantifier() {
18646 return quantifier;
18647 }
18648 }
18649
18650 public enum OutputParameter implements OnnxParameter {
18651 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18652 ;
18653
18654 final OnnxType type;
18655 final Quantifier quantifier;
18656
18657 OutputParameter(OnnxType type, Quantifier quantifier) {
18658 this.type = type;
18659 this.quantifier = quantifier;
18660 }
18661
18662 @Override
18663 public OnnxType type() {
18664 return type;
18665 }
18666
18667 @Override
18668 public Quantifier quantifier() {
18669 return quantifier;
18670 }
18671 }
18672
18673 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18674 NAME,
18675 List.of(Attribute.values()),
18676 List.of(TypeConstraint.values()),
18677 List.of(InputParameter.values()),
18678 List.of(OutputParameter.values())
18679 );
18680
18681 public Not(ExternalizedOp def) {
18682 super(SCHEMA, def);
18683 }
18684
18685 Not(Not that, CodeContext cc) {
18686 super(that, cc);
18687 }
18688
18689 @Override
18690 public Not transform(CodeContext cc, CodeTransformer ot) {
18691 return new Not(this, cc);
18692 }
18693
18694 Not(CodeType resultType, Value X) {
18695 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
18696 }
18697
18698 @Override
18699 public SequencedSet<OnnxParameter> onnxOutputs() {
18700 return onnxOutputs(SCHEMA);
18701 }
18702
18703 @Override
18704 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18705 return onnxInputs(SCHEMA, List.of(X()));
18706 }
18707
18708 public Value X() {
18709 return operands().get(0);
18710 }
18711
18712 }
18713
18714 public static Not Not(CodeType resultType, Value X) {
18715 return new Not(resultType, X);
18716 }
18717
18718 @OpFactoryHelper.OpDeclaration(OneHot.NAME)
18719 public static final class OneHot extends OnnxOp {
18720 public static final String NAME = "OneHot";
18721
18722 public enum Attribute implements OnnxAttribute {
18723 axis(Long.class, true, -1),
18724 ;
18725
18726 final Class<?> t;
18727 final boolean optional;
18728 final Object defaultValue;
18729
18730 Attribute(Class<?> type, boolean optional, Object defaultValue) {
18731 this.t = type;
18732 this.optional = optional;
18733 this.defaultValue = defaultValue;
18734 assert optional || defaultValue == null;
18735 }
18736
18737 public Class<?> type() {
18738 return t;
18739 }
18740
18741 public boolean isOptional() {
18742 return optional;
18743 }
18744
18745 public Object defaultValue() {
18746 return defaultValue;
18747 }
18748 }
18749
18750 public enum TypeConstraint implements OnnxTypeConstraint {
18751 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
18752 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
18753 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
18754 ;
18755
18756 final OnnxType.TypeVariable typeVariable;
18757
18758 TypeConstraint(OnnxType.TypeVariable typeVariable) {
18759 assert typeVariable.name().equals(name());
18760 this.typeVariable = typeVariable;
18761 }
18762
18763 @Override
18764 public OnnxType.TypeVariable typeVariable() {
18765 return typeVariable;
18766 }
18767 }
18768
18769 public enum InputParameter implements OnnxParameter {
18770 indices(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
18771 depth(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
18772 values(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
18773 ;
18774
18775 final OnnxType type;
18776 final Quantifier quantifier;
18777
18778 InputParameter(OnnxType type, Quantifier quantifier) {
18779 this.type = type;
18780 this.quantifier = quantifier;
18781 }
18782
18783 @Override
18784 public OnnxType type() {
18785 return type;
18786 }
18787
18788 @Override
18789 public Quantifier quantifier() {
18790 return quantifier;
18791 }
18792 }
18793
18794 public enum OutputParameter implements OnnxParameter {
18795 output(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
18796 ;
18797
18798 final OnnxType type;
18799 final Quantifier quantifier;
18800
18801 OutputParameter(OnnxType type, Quantifier quantifier) {
18802 this.type = type;
18803 this.quantifier = quantifier;
18804 }
18805
18806 @Override
18807 public OnnxType type() {
18808 return type;
18809 }
18810
18811 @Override
18812 public Quantifier quantifier() {
18813 return quantifier;
18814 }
18815 }
18816
18817 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18818 NAME,
18819 List.of(Attribute.values()),
18820 List.of(TypeConstraint.values()),
18821 List.of(InputParameter.values()),
18822 List.of(OutputParameter.values())
18823 );
18824
18825 public OneHot(ExternalizedOp def) {
18826 super(SCHEMA, def);
18827 }
18828
18829 OneHot(OneHot that, CodeContext cc) {
18830 super(that, cc);
18831 }
18832
18833 @Override
18834 public OneHot transform(CodeContext cc, CodeTransformer ot) {
18835 return new OneHot(this, cc);
18836 }
18837
18838 OneHot(CodeType resultType, Value indices, Value depth, Value values, java.util.Optional<Long> axis) {
18839 super(SCHEMA, resultType, Set.of(), List.of(indices, depth, values), List.of(axis));
18840 }
18841
18842 @Override
18843 public SequencedSet<OnnxParameter> onnxOutputs() {
18844 return onnxOutputs(SCHEMA);
18845 }
18846
18847 @Override
18848 public SequencedMap<OnnxParameter, Object> onnxInputs() {
18849 return onnxInputs(SCHEMA, List.of(indices(), depth(), values()));
18850 }
18851
18852 public Value indices() {
18853 return operands().get(0);
18854 }
18855
18856 public Value depth() {
18857 return operands().get(1);
18858 }
18859
18860 public Value values() {
18861 return operands().get(2);
18862 }
18863
18864 public java.util.Optional<Long> axis() {
18865 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
18866 return java.util.Optional.ofNullable(axis);
18867 }
18868
18869 }
18870
18871 public static OneHot OneHot(CodeType resultType, Value indices, Value depth, Value values, java.util.Optional<Long> axis) {
18872 return new OneHot(resultType, indices, depth, values, axis);
18873 }
18874
18875 @OpFactoryHelper.OpDeclaration(OneHotEncoder.NAME)
18876 public static final class OneHotEncoder extends OnnxOp {
18877 public static final String NAME = "OneHotEncoder";
18878
18879 public enum Attribute implements OnnxAttribute {
18880 cats_strings(String[].class, true, null),
18881 cats_int64s(long[].class, true, null),
18882 zeros(Long.class, true, 1),
18883 ;
18884
18885 final Class<?> t;
18886 final boolean optional;
18887 final Object defaultValue;
18888
18889 Attribute(Class<?> type, boolean optional, Object defaultValue) {
18890 this.t = type;
18891 this.optional = optional;
18892 this.defaultValue = defaultValue;
18893 assert optional || defaultValue == null;
18894 }
18895
18896 public Class<?> type() {
18897 return t;
18898 }
18899
18900 public boolean isOptional() {
18901 return optional;
18902 }
18903
18904 public Object defaultValue() {
18905 return defaultValue;
18906 }
18907 }
18908
18909 public enum TypeConstraint implements OnnxTypeConstraint {
18910 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
18911 ;
18912
18913 final OnnxType.TypeVariable typeVariable;
18914
18915 TypeConstraint(OnnxType.TypeVariable typeVariable) {
18916 assert typeVariable.name().equals(name());
18917 this.typeVariable = typeVariable;
18918 }
18919
18920 @Override
18921 public OnnxType.TypeVariable typeVariable() {
18922 return typeVariable;
18923 }
18924 }
18925
18926 public enum InputParameter implements OnnxParameter {
18927 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
18928 ;
18929
18930 final OnnxType type;
18931 final Quantifier quantifier;
18932
18933 InputParameter(OnnxType type, Quantifier quantifier) {
18934 this.type = type;
18935 this.quantifier = quantifier;
18936 }
18937
18938 @Override
18939 public OnnxType type() {
18940 return type;
18941 }
18942
18943 @Override
18944 public Quantifier quantifier() {
18945 return quantifier;
18946 }
18947 }
18948
18949 public enum OutputParameter implements OnnxParameter {
18950 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
18951 ;
18952
18953 final OnnxType type;
18954 final Quantifier quantifier;
18955
18956 OutputParameter(OnnxType type, Quantifier quantifier) {
18957 this.type = type;
18958 this.quantifier = quantifier;
18959 }
18960
18961 @Override
18962 public OnnxType type() {
18963 return type;
18964 }
18965
18966 @Override
18967 public Quantifier quantifier() {
18968 return quantifier;
18969 }
18970 }
18971
18972 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
18973 NAME,
18974 List.of(Attribute.values()),
18975 List.of(TypeConstraint.values()),
18976 List.of(InputParameter.values()),
18977 List.of(OutputParameter.values())
18978 );
18979
18980 public OneHotEncoder(ExternalizedOp def) {
18981 super(SCHEMA, def);
18982 }
18983
18984 OneHotEncoder(OneHotEncoder that, CodeContext cc) {
18985 super(that, cc);
18986 }
18987
18988 @Override
18989 public OneHotEncoder transform(CodeContext cc, CodeTransformer ot) {
18990 return new OneHotEncoder(this, cc);
18991 }
18992
18993 OneHotEncoder(CodeType resultType, Value X, java.util.Optional<String[]> cats_strings, java.util.Optional<long[]> cats_int64s, java.util.Optional<Long> zeros) {
18994 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(cats_strings, cats_int64s, zeros));
18995 }
18996
18997 @Override
18998 public SequencedSet<OnnxParameter> onnxOutputs() {
18999 return onnxOutputs(SCHEMA);
19000 }
19001
19002 @Override
19003 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19004 return onnxInputs(SCHEMA, List.of(X()));
19005 }
19006
19007 public Value X() {
19008 return operands().get(0);
19009 }
19010
19011 public java.util.Optional<String[]> cats_strings() {
19012 String[] cats_strings = Attribute.cats_strings.access(String[].class, onnxAttributes);
19013 return java.util.Optional.ofNullable(cats_strings).map(String[]::clone);
19014 }
19015
19016 public java.util.Optional<long[]> cats_int64s() {
19017 long[] cats_int64s = Attribute.cats_int64s.access(long[].class, onnxAttributes);
19018 return java.util.Optional.ofNullable(cats_int64s).map(long[]::clone);
19019 }
19020
19021 public java.util.Optional<Long> zeros() {
19022 Long zeros = Attribute.zeros.access(Long.class, onnxAttributes);
19023 return java.util.Optional.ofNullable(zeros);
19024 }
19025
19026 }
19027
19028 public static OneHotEncoder OneHotEncoder(CodeType resultType, Value X, java.util.Optional<String[]> cats_strings, java.util.Optional<long[]> cats_int64s, java.util.Optional<Long> zeros) {
19029 return new OneHotEncoder(resultType, X, cats_strings, cats_int64s, zeros);
19030 }
19031
19032 @OpFactoryHelper.OpDeclaration(Optional.NAME)
19033 public static final class Optional extends OnnxOp {
19034 public static final String NAME = "Optional";
19035
19036 public enum Attribute implements OnnxAttribute {
19037 type(Object.class, true, null),
19038 ;
19039
19040 final Class<?> t;
19041 final boolean optional;
19042 final Object defaultValue;
19043
19044 Attribute(Class<?> type, boolean optional, Object defaultValue) {
19045 this.t = type;
19046 this.optional = optional;
19047 this.defaultValue = defaultValue;
19048 assert optional || defaultValue == null;
19049 }
19050
19051 public Class<?> type() {
19052 return t;
19053 }
19054
19055 public boolean isOptional() {
19056 return optional;
19057 }
19058
19059 public Object defaultValue() {
19060 return defaultValue;
19061 }
19062 }
19063
19064 public enum TypeConstraint implements OnnxTypeConstraint {
19065 V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
19066 O(new OnnxType.TypeVariable("O", List.of(OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128()))))),
19067 ;
19068
19069 final OnnxType.TypeVariable typeVariable;
19070
19071 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19072 assert typeVariable.name().equals(name());
19073 this.typeVariable = typeVariable;
19074 }
19075
19076 @Override
19077 public OnnxType.TypeVariable typeVariable() {
19078 return typeVariable;
19079 }
19080 }
19081
19082 public enum InputParameter implements OnnxParameter {
19083 input(TypeConstraint.V.typeVariable(), Quantifier.OPTIONAL),
19084 ;
19085
19086 final OnnxType type;
19087 final Quantifier quantifier;
19088
19089 InputParameter(OnnxType type, Quantifier quantifier) {
19090 this.type = type;
19091 this.quantifier = quantifier;
19092 }
19093
19094 @Override
19095 public OnnxType type() {
19096 return type;
19097 }
19098
19099 @Override
19100 public Quantifier quantifier() {
19101 return quantifier;
19102 }
19103 }
19104
19105 public enum OutputParameter implements OnnxParameter {
19106 output(TypeConstraint.O.typeVariable(), Quantifier.REQUIRED),
19107 ;
19108
19109 final OnnxType type;
19110 final Quantifier quantifier;
19111
19112 OutputParameter(OnnxType type, Quantifier quantifier) {
19113 this.type = type;
19114 this.quantifier = quantifier;
19115 }
19116
19117 @Override
19118 public OnnxType type() {
19119 return type;
19120 }
19121
19122 @Override
19123 public Quantifier quantifier() {
19124 return quantifier;
19125 }
19126 }
19127
19128 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19129 NAME,
19130 List.of(Attribute.values()),
19131 List.of(TypeConstraint.values()),
19132 List.of(InputParameter.values()),
19133 List.of(OutputParameter.values())
19134 );
19135
19136 public Optional(ExternalizedOp def) {
19137 super(SCHEMA, def);
19138 }
19139
19140 Optional(Optional that, CodeContext cc) {
19141 super(that, cc);
19142 }
19143
19144 @Override
19145 public Optional transform(CodeContext cc, CodeTransformer ot) {
19146 return new Optional(this, cc);
19147 }
19148
19149 Optional(CodeType resultType, java.util.Optional<Value> input, java.util.Optional<Object> type) {
19150 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(type));
19151 }
19152
19153 @Override
19154 public SequencedSet<OnnxParameter> onnxOutputs() {
19155 return onnxOutputs(SCHEMA);
19156 }
19157
19158 @Override
19159 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19160 return onnxInputs(SCHEMA, List.of(input()));
19161 }
19162
19163 public java.util.Optional<Value> input() {
19164 int i = optionalInputArguments.indexOf(InputParameter.input);
19165 return i != -1 ? java.util.Optional.of(operands().get(0 + i)) : java.util.Optional.empty();
19166 }
19167
19168 public java.util.Optional<Object> type() {
19169 Object type = Attribute.type.access(Object.class, onnxAttributes);
19170 return java.util.Optional.ofNullable(type);
19171 }
19172
19173 }
19174
19175 public static Optional Optional(CodeType resultType, java.util.Optional<Value> input, java.util.Optional<Object> type) {
19176 return new Optional(resultType, input, type);
19177 }
19178
19179 @OpFactoryHelper.OpDeclaration(OptionalGetElement.NAME)
19180 public static final class OptionalGetElement extends OnnxOp {
19181 public static final String NAME = "OptionalGetElement";
19182
19183 public enum Attribute implements OnnxAttribute.None { }
19184
19185 public enum TypeConstraint implements OnnxTypeConstraint {
19186 O(new OnnxType.TypeVariable("O", List.of(OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128())), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
19187 V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
19188 ;
19189
19190 final OnnxType.TypeVariable typeVariable;
19191
19192 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19193 assert typeVariable.name().equals(name());
19194 this.typeVariable = typeVariable;
19195 }
19196
19197 @Override
19198 public OnnxType.TypeVariable typeVariable() {
19199 return typeVariable;
19200 }
19201 }
19202
19203 public enum InputParameter implements OnnxParameter {
19204 input(TypeConstraint.O.typeVariable(), Quantifier.REQUIRED),
19205 ;
19206
19207 final OnnxType type;
19208 final Quantifier quantifier;
19209
19210 InputParameter(OnnxType type, Quantifier quantifier) {
19211 this.type = type;
19212 this.quantifier = quantifier;
19213 }
19214
19215 @Override
19216 public OnnxType type() {
19217 return type;
19218 }
19219
19220 @Override
19221 public Quantifier quantifier() {
19222 return quantifier;
19223 }
19224 }
19225
19226 public enum OutputParameter implements OnnxParameter {
19227 output(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED),
19228 ;
19229
19230 final OnnxType type;
19231 final Quantifier quantifier;
19232
19233 OutputParameter(OnnxType type, Quantifier quantifier) {
19234 this.type = type;
19235 this.quantifier = quantifier;
19236 }
19237
19238 @Override
19239 public OnnxType type() {
19240 return type;
19241 }
19242
19243 @Override
19244 public Quantifier quantifier() {
19245 return quantifier;
19246 }
19247 }
19248
19249 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19250 NAME,
19251 List.of(Attribute.values()),
19252 List.of(TypeConstraint.values()),
19253 List.of(InputParameter.values()),
19254 List.of(OutputParameter.values())
19255 );
19256
19257 public OptionalGetElement(ExternalizedOp def) {
19258 super(SCHEMA, def);
19259 }
19260
19261 OptionalGetElement(OptionalGetElement that, CodeContext cc) {
19262 super(that, cc);
19263 }
19264
19265 @Override
19266 public OptionalGetElement transform(CodeContext cc, CodeTransformer ot) {
19267 return new OptionalGetElement(this, cc);
19268 }
19269
19270 OptionalGetElement(CodeType resultType, Value input) {
19271 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
19272 }
19273
19274 @Override
19275 public SequencedSet<OnnxParameter> onnxOutputs() {
19276 return onnxOutputs(SCHEMA);
19277 }
19278
19279 @Override
19280 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19281 return onnxInputs(SCHEMA, List.of(input()));
19282 }
19283
19284 public Value input() {
19285 return operands().get(0);
19286 }
19287
19288 }
19289
19290 public static OptionalGetElement OptionalGetElement(CodeType resultType, Value input) {
19291 return new OptionalGetElement(resultType, input);
19292 }
19293
19294 @OpFactoryHelper.OpDeclaration(OptionalHasElement.NAME)
19295 public static final class OptionalHasElement extends OnnxOp {
19296 public static final String NAME = "OptionalHasElement";
19297
19298 public enum Attribute implements OnnxAttribute.None { }
19299
19300 public enum TypeConstraint implements OnnxTypeConstraint {
19301 O(new OnnxType.TypeVariable("O", List.of(OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128())), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
19302 B(new OnnxType.TypeVariable("B", List.of(OnnxType.tensor(OnnxType.bool())))),
19303 ;
19304
19305 final OnnxType.TypeVariable typeVariable;
19306
19307 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19308 assert typeVariable.name().equals(name());
19309 this.typeVariable = typeVariable;
19310 }
19311
19312 @Override
19313 public OnnxType.TypeVariable typeVariable() {
19314 return typeVariable;
19315 }
19316 }
19317
19318 public enum InputParameter implements OnnxParameter {
19319 input(TypeConstraint.O.typeVariable(), Quantifier.OPTIONAL),
19320 ;
19321
19322 final OnnxType type;
19323 final Quantifier quantifier;
19324
19325 InputParameter(OnnxType type, Quantifier quantifier) {
19326 this.type = type;
19327 this.quantifier = quantifier;
19328 }
19329
19330 @Override
19331 public OnnxType type() {
19332 return type;
19333 }
19334
19335 @Override
19336 public Quantifier quantifier() {
19337 return quantifier;
19338 }
19339 }
19340
19341 public enum OutputParameter implements OnnxParameter {
19342 output(TypeConstraint.B.typeVariable(), Quantifier.REQUIRED),
19343 ;
19344
19345 final OnnxType type;
19346 final Quantifier quantifier;
19347
19348 OutputParameter(OnnxType type, Quantifier quantifier) {
19349 this.type = type;
19350 this.quantifier = quantifier;
19351 }
19352
19353 @Override
19354 public OnnxType type() {
19355 return type;
19356 }
19357
19358 @Override
19359 public Quantifier quantifier() {
19360 return quantifier;
19361 }
19362 }
19363
19364 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19365 NAME,
19366 List.of(Attribute.values()),
19367 List.of(TypeConstraint.values()),
19368 List.of(InputParameter.values()),
19369 List.of(OutputParameter.values())
19370 );
19371
19372 public OptionalHasElement(ExternalizedOp def) {
19373 super(SCHEMA, def);
19374 }
19375
19376 OptionalHasElement(OptionalHasElement that, CodeContext cc) {
19377 super(that, cc);
19378 }
19379
19380 @Override
19381 public OptionalHasElement transform(CodeContext cc, CodeTransformer ot) {
19382 return new OptionalHasElement(this, cc);
19383 }
19384
19385 OptionalHasElement(CodeType resultType, java.util.Optional<Value> input) {
19386 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
19387 }
19388
19389 @Override
19390 public SequencedSet<OnnxParameter> onnxOutputs() {
19391 return onnxOutputs(SCHEMA);
19392 }
19393
19394 @Override
19395 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19396 return onnxInputs(SCHEMA, List.of(input()));
19397 }
19398
19399 public java.util.Optional<Value> input() {
19400 int i = optionalInputArguments.indexOf(InputParameter.input);
19401 return i != -1 ? java.util.Optional.of(operands().get(0 + i)) : java.util.Optional.empty();
19402 }
19403
19404 }
19405
19406 public static OptionalHasElement OptionalHasElement(CodeType resultType, java.util.Optional<Value> input) {
19407 return new OptionalHasElement(resultType, input);
19408 }
19409
19410 @OpFactoryHelper.OpDeclaration(Or.NAME)
19411 public static final class Or extends OnnxOp {
19412 public static final String NAME = "Or";
19413
19414 public enum Attribute implements OnnxAttribute.None { }
19415
19416 public enum TypeConstraint implements OnnxTypeConstraint {
19417 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))),
19418 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
19419 ;
19420
19421 final OnnxType.TypeVariable typeVariable;
19422
19423 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19424 assert typeVariable.name().equals(name());
19425 this.typeVariable = typeVariable;
19426 }
19427
19428 @Override
19429 public OnnxType.TypeVariable typeVariable() {
19430 return typeVariable;
19431 }
19432 }
19433
19434 public enum InputParameter implements OnnxParameter {
19435 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19436 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19437 ;
19438
19439 final OnnxType type;
19440 final Quantifier quantifier;
19441
19442 InputParameter(OnnxType type, Quantifier quantifier) {
19443 this.type = type;
19444 this.quantifier = quantifier;
19445 }
19446
19447 @Override
19448 public OnnxType type() {
19449 return type;
19450 }
19451
19452 @Override
19453 public Quantifier quantifier() {
19454 return quantifier;
19455 }
19456 }
19457
19458 public enum OutputParameter implements OnnxParameter {
19459 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
19460 ;
19461
19462 final OnnxType type;
19463 final Quantifier quantifier;
19464
19465 OutputParameter(OnnxType type, Quantifier quantifier) {
19466 this.type = type;
19467 this.quantifier = quantifier;
19468 }
19469
19470 @Override
19471 public OnnxType type() {
19472 return type;
19473 }
19474
19475 @Override
19476 public Quantifier quantifier() {
19477 return quantifier;
19478 }
19479 }
19480
19481 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19482 NAME,
19483 List.of(Attribute.values()),
19484 List.of(TypeConstraint.values()),
19485 List.of(InputParameter.values()),
19486 List.of(OutputParameter.values())
19487 );
19488
19489 public Or(ExternalizedOp def) {
19490 super(SCHEMA, def);
19491 }
19492
19493 Or(Or that, CodeContext cc) {
19494 super(that, cc);
19495 }
19496
19497 @Override
19498 public Or transform(CodeContext cc, CodeTransformer ot) {
19499 return new Or(this, cc);
19500 }
19501
19502 Or(CodeType resultType, Value A, Value B) {
19503 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
19504 }
19505
19506 @Override
19507 public SequencedSet<OnnxParameter> onnxOutputs() {
19508 return onnxOutputs(SCHEMA);
19509 }
19510
19511 @Override
19512 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19513 return onnxInputs(SCHEMA, List.of(A(), B()));
19514 }
19515
19516 public Value A() {
19517 return operands().get(0);
19518 }
19519
19520 public Value B() {
19521 return operands().get(1);
19522 }
19523
19524 }
19525
19526 public static Or Or(CodeType resultType, Value A, Value B) {
19527 return new Or(resultType, A, B);
19528 }
19529
19530 @OpFactoryHelper.OpDeclaration(PRelu.NAME)
19531 public static final class PRelu extends OnnxOp {
19532 public static final String NAME = "PRelu";
19533
19534 public enum Attribute implements OnnxAttribute.None { }
19535
19536 public enum TypeConstraint implements OnnxTypeConstraint {
19537 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
19538 ;
19539
19540 final OnnxType.TypeVariable typeVariable;
19541
19542 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19543 assert typeVariable.name().equals(name());
19544 this.typeVariable = typeVariable;
19545 }
19546
19547 @Override
19548 public OnnxType.TypeVariable typeVariable() {
19549 return typeVariable;
19550 }
19551 }
19552
19553 public enum InputParameter implements OnnxParameter {
19554 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19555 slope(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19556 ;
19557
19558 final OnnxType type;
19559 final Quantifier quantifier;
19560
19561 InputParameter(OnnxType type, Quantifier quantifier) {
19562 this.type = type;
19563 this.quantifier = quantifier;
19564 }
19565
19566 @Override
19567 public OnnxType type() {
19568 return type;
19569 }
19570
19571 @Override
19572 public Quantifier quantifier() {
19573 return quantifier;
19574 }
19575 }
19576
19577 public enum OutputParameter implements OnnxParameter {
19578 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19579 ;
19580
19581 final OnnxType type;
19582 final Quantifier quantifier;
19583
19584 OutputParameter(OnnxType type, Quantifier quantifier) {
19585 this.type = type;
19586 this.quantifier = quantifier;
19587 }
19588
19589 @Override
19590 public OnnxType type() {
19591 return type;
19592 }
19593
19594 @Override
19595 public Quantifier quantifier() {
19596 return quantifier;
19597 }
19598 }
19599
19600 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19601 NAME,
19602 List.of(Attribute.values()),
19603 List.of(TypeConstraint.values()),
19604 List.of(InputParameter.values()),
19605 List.of(OutputParameter.values())
19606 );
19607
19608 public PRelu(ExternalizedOp def) {
19609 super(SCHEMA, def);
19610 }
19611
19612 PRelu(PRelu that, CodeContext cc) {
19613 super(that, cc);
19614 }
19615
19616 @Override
19617 public PRelu transform(CodeContext cc, CodeTransformer ot) {
19618 return new PRelu(this, cc);
19619 }
19620
19621 PRelu(CodeType resultType, Value X, Value slope) {
19622 super(SCHEMA, resultType, Set.of(), List.of(X, slope), List.of());
19623 }
19624
19625 @Override
19626 public SequencedSet<OnnxParameter> onnxOutputs() {
19627 return onnxOutputs(SCHEMA);
19628 }
19629
19630 @Override
19631 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19632 return onnxInputs(SCHEMA, List.of(X(), slope()));
19633 }
19634
19635 public Value X() {
19636 return operands().get(0);
19637 }
19638
19639 public Value slope() {
19640 return operands().get(1);
19641 }
19642
19643 }
19644
19645 public static PRelu PRelu(CodeType resultType, Value X, Value slope) {
19646 return new PRelu(resultType, X, slope);
19647 }
19648
19649 @OpFactoryHelper.OpDeclaration(Pad.NAME)
19650 public static final class Pad extends OnnxOp {
19651 public static final String NAME = "Pad";
19652
19653 public enum Attribute implements OnnxAttribute {
19654 mode(String.class, true, "constant"),
19655 ;
19656
19657 final Class<?> t;
19658 final boolean optional;
19659 final Object defaultValue;
19660
19661 Attribute(Class<?> type, boolean optional, Object defaultValue) {
19662 this.t = type;
19663 this.optional = optional;
19664 this.defaultValue = defaultValue;
19665 assert optional || defaultValue == null;
19666 }
19667
19668 public Class<?> type() {
19669 return t;
19670 }
19671
19672 public boolean isOptional() {
19673 return optional;
19674 }
19675
19676 public Object defaultValue() {
19677 return defaultValue;
19678 }
19679 }
19680
19681 public enum TypeConstraint implements OnnxTypeConstraint {
19682 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
19683 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
19684 ;
19685
19686 final OnnxType.TypeVariable typeVariable;
19687
19688 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19689 assert typeVariable.name().equals(name());
19690 this.typeVariable = typeVariable;
19691 }
19692
19693 @Override
19694 public OnnxType.TypeVariable typeVariable() {
19695 return typeVariable;
19696 }
19697 }
19698
19699 public enum InputParameter implements OnnxParameter {
19700 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19701 pads(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
19702 constant_value(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
19703 axes(TypeConstraint.Tind.typeVariable(), Quantifier.OPTIONAL),
19704 ;
19705
19706 final OnnxType type;
19707 final Quantifier quantifier;
19708
19709 InputParameter(OnnxType type, Quantifier quantifier) {
19710 this.type = type;
19711 this.quantifier = quantifier;
19712 }
19713
19714 @Override
19715 public OnnxType type() {
19716 return type;
19717 }
19718
19719 @Override
19720 public Quantifier quantifier() {
19721 return quantifier;
19722 }
19723 }
19724
19725 public enum OutputParameter implements OnnxParameter {
19726 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19727 ;
19728
19729 final OnnxType type;
19730 final Quantifier quantifier;
19731
19732 OutputParameter(OnnxType type, Quantifier quantifier) {
19733 this.type = type;
19734 this.quantifier = quantifier;
19735 }
19736
19737 @Override
19738 public OnnxType type() {
19739 return type;
19740 }
19741
19742 @Override
19743 public Quantifier quantifier() {
19744 return quantifier;
19745 }
19746 }
19747
19748 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19749 NAME,
19750 List.of(Attribute.values()),
19751 List.of(TypeConstraint.values()),
19752 List.of(InputParameter.values()),
19753 List.of(OutputParameter.values())
19754 );
19755
19756 public Pad(ExternalizedOp def) {
19757 super(SCHEMA, def);
19758 }
19759
19760 Pad(Pad that, CodeContext cc) {
19761 super(that, cc);
19762 }
19763
19764 @Override
19765 public Pad transform(CodeContext cc, CodeTransformer ot) {
19766 return new Pad(this, cc);
19767 }
19768
19769 Pad(CodeType resultType, Value data, Value pads, java.util.Optional<Value> constant_value, java.util.Optional<Value> axes, java.util.Optional<String> mode) {
19770 super(SCHEMA, resultType, Set.of(), List.of(data, pads, constant_value, axes), List.of(mode));
19771 }
19772
19773 @Override
19774 public SequencedSet<OnnxParameter> onnxOutputs() {
19775 return onnxOutputs(SCHEMA);
19776 }
19777
19778 @Override
19779 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19780 return onnxInputs(SCHEMA, List.of(data(), pads(), constant_value(), axes()));
19781 }
19782
19783 public Value data() {
19784 return operands().get(0);
19785 }
19786
19787 public Value pads() {
19788 return operands().get(1);
19789 }
19790
19791 public java.util.Optional<Value> constant_value() {
19792 int i = optionalInputArguments.indexOf(InputParameter.constant_value);
19793 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
19794 }
19795
19796 public java.util.Optional<Value> axes() {
19797 int i = optionalInputArguments.indexOf(InputParameter.axes);
19798 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
19799 }
19800
19801 public java.util.Optional<String> mode() {
19802 String mode = Attribute.mode.access(String.class, onnxAttributes);
19803 return java.util.Optional.ofNullable(mode);
19804 }
19805
19806 }
19807
19808 public static Pad Pad(CodeType resultType, Value data, Value pads, java.util.Optional<Value> constant_value, java.util.Optional<Value> axes, java.util.Optional<String> mode) {
19809 return new Pad(resultType, data, pads, constant_value, axes, mode);
19810 }
19811
19812 @OpFactoryHelper.OpDeclaration(Pow.NAME)
19813 public static final class Pow extends OnnxOp {
19814 public static final String NAME = "Pow";
19815
19816 public enum Attribute implements OnnxAttribute.None { }
19817
19818 public enum TypeConstraint implements OnnxTypeConstraint {
19819 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
19820 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
19821 ;
19822
19823 final OnnxType.TypeVariable typeVariable;
19824
19825 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19826 assert typeVariable.name().equals(name());
19827 this.typeVariable = typeVariable;
19828 }
19829
19830 @Override
19831 public OnnxType.TypeVariable typeVariable() {
19832 return typeVariable;
19833 }
19834 }
19835
19836 public enum InputParameter implements OnnxParameter {
19837 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19838 Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
19839 ;
19840
19841 final OnnxType type;
19842 final Quantifier quantifier;
19843
19844 InputParameter(OnnxType type, Quantifier quantifier) {
19845 this.type = type;
19846 this.quantifier = quantifier;
19847 }
19848
19849 @Override
19850 public OnnxType type() {
19851 return type;
19852 }
19853
19854 @Override
19855 public Quantifier quantifier() {
19856 return quantifier;
19857 }
19858 }
19859
19860 public enum OutputParameter implements OnnxParameter {
19861 Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
19862 ;
19863
19864 final OnnxType type;
19865 final Quantifier quantifier;
19866
19867 OutputParameter(OnnxType type, Quantifier quantifier) {
19868 this.type = type;
19869 this.quantifier = quantifier;
19870 }
19871
19872 @Override
19873 public OnnxType type() {
19874 return type;
19875 }
19876
19877 @Override
19878 public Quantifier quantifier() {
19879 return quantifier;
19880 }
19881 }
19882
19883 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
19884 NAME,
19885 List.of(Attribute.values()),
19886 List.of(TypeConstraint.values()),
19887 List.of(InputParameter.values()),
19888 List.of(OutputParameter.values())
19889 );
19890
19891 public Pow(ExternalizedOp def) {
19892 super(SCHEMA, def);
19893 }
19894
19895 Pow(Pow that, CodeContext cc) {
19896 super(that, cc);
19897 }
19898
19899 @Override
19900 public Pow transform(CodeContext cc, CodeTransformer ot) {
19901 return new Pow(this, cc);
19902 }
19903
19904 Pow(CodeType resultType, Value X, Value Y) {
19905 super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of());
19906 }
19907
19908 @Override
19909 public SequencedSet<OnnxParameter> onnxOutputs() {
19910 return onnxOutputs(SCHEMA);
19911 }
19912
19913 @Override
19914 public SequencedMap<OnnxParameter, Object> onnxInputs() {
19915 return onnxInputs(SCHEMA, List.of(X(), Y()));
19916 }
19917
19918 public Value X() {
19919 return operands().get(0);
19920 }
19921
19922 public Value Y() {
19923 return operands().get(1);
19924 }
19925
19926 }
19927
19928 public static Pow Pow(CodeType resultType, Value X, Value Y) {
19929 return new Pow(resultType, X, Y);
19930 }
19931
19932 @OpFactoryHelper.OpDeclaration(QLinearConv.NAME)
19933 public static final class QLinearConv extends OnnxOp {
19934 public static final String NAME = "QLinearConv";
19935
19936 public enum Attribute implements OnnxAttribute {
19937 pads(long[].class, true, null),
19938 dilations(long[].class, true, null),
19939 auto_pad(String.class, true, "NOTSET"),
19940 strides(long[].class, true, null),
19941 group(Long.class, true, 1),
19942 kernel_shape(long[].class, true, null),
19943 ;
19944
19945 final Class<?> t;
19946 final boolean optional;
19947 final Object defaultValue;
19948
19949 Attribute(Class<?> type, boolean optional, Object defaultValue) {
19950 this.t = type;
19951 this.optional = optional;
19952 this.defaultValue = defaultValue;
19953 assert optional || defaultValue == null;
19954 }
19955
19956 public Class<?> type() {
19957 return t;
19958 }
19959
19960 public boolean isOptional() {
19961 return optional;
19962 }
19963
19964 public Object defaultValue() {
19965 return defaultValue;
19966 }
19967 }
19968
19969 public enum TypeConstraint implements OnnxTypeConstraint {
19970 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
19971 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
19972 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))),
19973 T4(new OnnxType.TypeVariable("T4", List.of(OnnxType.tensor(OnnxType.int32())))),
19974 ;
19975
19976 final OnnxType.TypeVariable typeVariable;
19977
19978 TypeConstraint(OnnxType.TypeVariable typeVariable) {
19979 assert typeVariable.name().equals(name());
19980 this.typeVariable = typeVariable;
19981 }
19982
19983 @Override
19984 public OnnxType.TypeVariable typeVariable() {
19985 return typeVariable;
19986 }
19987 }
19988
19989 public enum InputParameter implements OnnxParameter {
19990 x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
19991 x_scale(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
19992 x_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
19993 w(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
19994 w_scale(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
19995 w_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
19996 y_scale(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
19997 y_zero_point(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
19998 B(TypeConstraint.T4.typeVariable(), Quantifier.OPTIONAL),
19999 ;
20000
20001 final OnnxType type;
20002 final Quantifier quantifier;
20003
20004 InputParameter(OnnxType type, Quantifier quantifier) {
20005 this.type = type;
20006 this.quantifier = quantifier;
20007 }
20008
20009 @Override
20010 public OnnxType type() {
20011 return type;
20012 }
20013
20014 @Override
20015 public Quantifier quantifier() {
20016 return quantifier;
20017 }
20018 }
20019
20020 public enum OutputParameter implements OnnxParameter {
20021 y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
20022 ;
20023
20024 final OnnxType type;
20025 final Quantifier quantifier;
20026
20027 OutputParameter(OnnxType type, Quantifier quantifier) {
20028 this.type = type;
20029 this.quantifier = quantifier;
20030 }
20031
20032 @Override
20033 public OnnxType type() {
20034 return type;
20035 }
20036
20037 @Override
20038 public Quantifier quantifier() {
20039 return quantifier;
20040 }
20041 }
20042
20043 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
20044 NAME,
20045 List.of(Attribute.values()),
20046 List.of(TypeConstraint.values()),
20047 List.of(InputParameter.values()),
20048 List.of(OutputParameter.values())
20049 );
20050
20051 public QLinearConv(ExternalizedOp def) {
20052 super(SCHEMA, def);
20053 }
20054
20055 QLinearConv(QLinearConv that, CodeContext cc) {
20056 super(that, cc);
20057 }
20058
20059 @Override
20060 public QLinearConv transform(CodeContext cc, CodeTransformer ot) {
20061 return new QLinearConv(this, cc);
20062 }
20063
20064 QLinearConv(CodeType resultType, Value x, Value x_scale, Value x_zero_point, Value w, Value w_scale, Value w_zero_point, Value y_scale, Value y_zero_point, java.util.Optional<Value> B, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
20065 super(SCHEMA, resultType, Set.of(), List.of(x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape));
20066 }
20067
20068 @Override
20069 public SequencedSet<OnnxParameter> onnxOutputs() {
20070 return onnxOutputs(SCHEMA);
20071 }
20072
20073 @Override
20074 public SequencedMap<OnnxParameter, Object> onnxInputs() {
20075 return onnxInputs(SCHEMA, List.of(x(), x_scale(), x_zero_point(), w(), w_scale(), w_zero_point(), y_scale(), y_zero_point(), B()));
20076 }
20077
20078 public Value x() {
20079 return operands().get(0);
20080 }
20081
20082 public Value x_scale() {
20083 return operands().get(1);
20084 }
20085
20086 public Value x_zero_point() {
20087 return operands().get(2);
20088 }
20089
20090 public Value w() {
20091 return operands().get(3);
20092 }
20093
20094 public Value w_scale() {
20095 return operands().get(4);
20096 }
20097
20098 public Value w_zero_point() {
20099 return operands().get(5);
20100 }
20101
20102 public Value y_scale() {
20103 return operands().get(6);
20104 }
20105
20106 public Value y_zero_point() {
20107 return operands().get(7);
20108 }
20109
20110 public java.util.Optional<Value> B() {
20111 int i = optionalInputArguments.indexOf(InputParameter.B);
20112 return i != -1 ? java.util.Optional.of(operands().get(8 + i)) : java.util.Optional.empty();
20113 }
20114
20115 public java.util.Optional<long[]> pads() {
20116 long[] pads = Attribute.pads.access(long[].class, onnxAttributes);
20117 return java.util.Optional.ofNullable(pads).map(long[]::clone);
20118 }
20119
20120 public java.util.Optional<long[]> dilations() {
20121 long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes);
20122 return java.util.Optional.ofNullable(dilations).map(long[]::clone);
20123 }
20124
20125 public java.util.Optional<String> auto_pad() {
20126 String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes);
20127 return java.util.Optional.ofNullable(auto_pad);
20128 }
20129
20130 public java.util.Optional<long[]> strides() {
20131 long[] strides = Attribute.strides.access(long[].class, onnxAttributes);
20132 return java.util.Optional.ofNullable(strides).map(long[]::clone);
20133 }
20134
20135 public java.util.Optional<Long> group() {
20136 Long group = Attribute.group.access(Long.class, onnxAttributes);
20137 return java.util.Optional.ofNullable(group);
20138 }
20139
20140 public java.util.Optional<long[]> kernel_shape() {
20141 long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes);
20142 return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone);
20143 }
20144
20145 }
20146
20147 public static QLinearConv QLinearConv(CodeType resultType, Value x, Value x_scale, Value x_zero_point, Value w, Value w_scale, Value w_zero_point, Value y_scale, Value y_zero_point, java.util.Optional<Value> B, java.util.Optional<long[]> pads, java.util.Optional<long[]> dilations, java.util.Optional<String> auto_pad, java.util.Optional<long[]> strides, java.util.Optional<Long> group, java.util.Optional<long[]> kernel_shape) {
20148 return new QLinearConv(resultType, x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B, pads, dilations, auto_pad, strides, group, kernel_shape);
20149 }
20150
20151 @OpFactoryHelper.OpDeclaration(QLinearMatMul.NAME)
20152 public static final class QLinearMatMul extends OnnxOp {
20153 public static final String NAME = "QLinearMatMul";
20154
20155 public enum Attribute implements OnnxAttribute.None { }
20156
20157 public enum TypeConstraint implements OnnxTypeConstraint {
20158 TS(new OnnxType.TypeVariable("TS", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))),
20159 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
20160 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
20161 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))),
20162 ;
20163
20164 final OnnxType.TypeVariable typeVariable;
20165
20166 TypeConstraint(OnnxType.TypeVariable typeVariable) {
20167 assert typeVariable.name().equals(name());
20168 this.typeVariable = typeVariable;
20169 }
20170
20171 @Override
20172 public OnnxType.TypeVariable typeVariable() {
20173 return typeVariable;
20174 }
20175 }
20176
20177 public enum InputParameter implements OnnxParameter {
20178 a(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
20179 a_scale(TypeConstraint.TS.typeVariable(), Quantifier.REQUIRED),
20180 a_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
20181 b(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
20182 b_scale(TypeConstraint.TS.typeVariable(), Quantifier.REQUIRED),
20183 b_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
20184 y_scale(TypeConstraint.TS.typeVariable(), Quantifier.REQUIRED),
20185 y_zero_point(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
20186 ;
20187
20188 final OnnxType type;
20189 final Quantifier quantifier;
20190
20191 InputParameter(OnnxType type, Quantifier quantifier) {
20192 this.type = type;
20193 this.quantifier = quantifier;
20194 }
20195
20196 @Override
20197 public OnnxType type() {
20198 return type;
20199 }
20200
20201 @Override
20202 public Quantifier quantifier() {
20203 return quantifier;
20204 }
20205 }
20206
20207 public enum OutputParameter implements OnnxParameter {
20208 y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
20209 ;
20210
20211 final OnnxType type;
20212 final Quantifier quantifier;
20213
20214 OutputParameter(OnnxType type, Quantifier quantifier) {
20215 this.type = type;
20216 this.quantifier = quantifier;
20217 }
20218
20219 @Override
20220 public OnnxType type() {
20221 return type;
20222 }
20223
20224 @Override
20225 public Quantifier quantifier() {
20226 return quantifier;
20227 }
20228 }
20229
20230 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
20231 NAME,
20232 List.of(Attribute.values()),
20233 List.of(TypeConstraint.values()),
20234 List.of(InputParameter.values()),
20235 List.of(OutputParameter.values())
20236 );
20237
20238 public QLinearMatMul(ExternalizedOp def) {
20239 super(SCHEMA, def);
20240 }
20241
20242 QLinearMatMul(QLinearMatMul that, CodeContext cc) {
20243 super(that, cc);
20244 }
20245
20246 @Override
20247 public QLinearMatMul transform(CodeContext cc, CodeTransformer ot) {
20248 return new QLinearMatMul(this, cc);
20249 }
20250
20251 QLinearMatMul(CodeType resultType, Value a, Value a_scale, Value a_zero_point, Value b, Value b_scale, Value b_zero_point, Value y_scale, Value y_zero_point) {
20252 super(SCHEMA, resultType, Set.of(), List.of(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point), List.of());
20253 }
20254
20255 @Override
20256 public SequencedSet<OnnxParameter> onnxOutputs() {
20257 return onnxOutputs(SCHEMA);
20258 }
20259
20260 @Override
20261 public SequencedMap<OnnxParameter, Object> onnxInputs() {
20262 return onnxInputs(SCHEMA, List.of(a(), a_scale(), a_zero_point(), b(), b_scale(), b_zero_point(), y_scale(), y_zero_point()));
20263 }
20264
20265 public Value a() {
20266 return operands().get(0);
20267 }
20268
20269 public Value a_scale() {
20270 return operands().get(1);
20271 }
20272
20273 public Value a_zero_point() {
20274 return operands().get(2);
20275 }
20276
20277 public Value b() {
20278 return operands().get(3);
20279 }
20280
20281 public Value b_scale() {
20282 return operands().get(4);
20283 }
20284
20285 public Value b_zero_point() {
20286 return operands().get(5);
20287 }
20288
20289 public Value y_scale() {
20290 return operands().get(6);
20291 }
20292
20293 public Value y_zero_point() {
20294 return operands().get(7);
20295 }
20296
20297 }
20298
20299 public static QLinearMatMul QLinearMatMul(CodeType resultType, Value a, Value a_scale, Value a_zero_point, Value b, Value b_scale, Value b_zero_point, Value y_scale, Value y_zero_point) {
20300 return new QLinearMatMul(resultType, a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point);
20301 }
20302
20303 @OpFactoryHelper.OpDeclaration(QuantizeLinear.NAME)
20304 public static final class QuantizeLinear extends OnnxOp {
20305 public static final String NAME = "QuantizeLinear";
20306
20307 public enum Attribute implements OnnxAttribute {
20308 output_dtype(Long.class, true, 0),
20309 saturate(Long.class, true, 1),
20310 precision(Long.class, true, 0),
20311 axis(Long.class, true, 1),
20312 block_size(Long.class, true, 0),
20313 ;
20314
20315 final Class<?> t;
20316 final boolean optional;
20317 final Object defaultValue;
20318
20319 Attribute(Class<?> type, boolean optional, Object defaultValue) {
20320 this.t = type;
20321 this.optional = optional;
20322 this.defaultValue = defaultValue;
20323 assert optional || defaultValue == null;
20324 }
20325
20326 public Class<?> type() {
20327 return t;
20328 }
20329
20330 public boolean isOptional() {
20331 return optional;
20332 }
20333
20334 public Object defaultValue() {
20335 return defaultValue;
20336 }
20337 }
20338
20339 public enum TypeConstraint implements OnnxTypeConstraint {
20340 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.int32())))),
20341 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.float8e8m0())))),
20342 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
20343 ;
20344
20345 final OnnxType.TypeVariable typeVariable;
20346
20347 TypeConstraint(OnnxType.TypeVariable typeVariable) {
20348 assert typeVariable.name().equals(name());
20349 this.typeVariable = typeVariable;
20350 }
20351
20352 @Override
20353 public OnnxType.TypeVariable typeVariable() {
20354 return typeVariable;
20355 }
20356 }
20357
20358 public enum InputParameter implements OnnxParameter {
20359 x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
20360 y_scale(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
20361 y_zero_point(TypeConstraint.T3.typeVariable(), Quantifier.OPTIONAL),
20362 ;
20363
20364 final OnnxType type;
20365 final Quantifier quantifier;
20366
20367 InputParameter(OnnxType type, Quantifier quantifier) {
20368 this.type = type;
20369 this.quantifier = quantifier;
20370 }
20371
20372 @Override
20373 public OnnxType type() {
20374 return type;
20375 }
20376
20377 @Override
20378 public Quantifier quantifier() {
20379 return quantifier;
20380 }
20381 }
20382
20383 public enum OutputParameter implements OnnxParameter {
20384 y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
20385 ;
20386
20387 final OnnxType type;
20388 final Quantifier quantifier;
20389
20390 OutputParameter(OnnxType type, Quantifier quantifier) {
20391 this.type = type;
20392 this.quantifier = quantifier;
20393 }
20394
20395 @Override
20396 public OnnxType type() {
20397 return type;
20398 }
20399
20400 @Override
20401 public Quantifier quantifier() {
20402 return quantifier;
20403 }
20404 }
20405
20406 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
20407 NAME,
20408 List.of(Attribute.values()),
20409 List.of(TypeConstraint.values()),
20410 List.of(InputParameter.values()),
20411 List.of(OutputParameter.values())
20412 );
20413
20414 public QuantizeLinear(ExternalizedOp def) {
20415 super(SCHEMA, def);
20416 }
20417
20418 QuantizeLinear(QuantizeLinear that, CodeContext cc) {
20419 super(that, cc);
20420 }
20421
20422 @Override
20423 public QuantizeLinear transform(CodeContext cc, CodeTransformer ot) {
20424 return new QuantizeLinear(this, cc);
20425 }
20426
20427 QuantizeLinear(CodeType resultType, Value x, Value y_scale, java.util.Optional<Value> y_zero_point, java.util.Optional<Long> output_dtype, java.util.Optional<Long> saturate, java.util.Optional<Long> precision, java.util.Optional<Long> axis, java.util.Optional<Long> block_size) {
20428 super(SCHEMA, resultType, Set.of(), List.of(x, y_scale, y_zero_point), List.of(output_dtype, saturate, precision, axis, block_size));
20429 }
20430
20431 @Override
20432 public SequencedSet<OnnxParameter> onnxOutputs() {
20433 return onnxOutputs(SCHEMA);
20434 }
20435
20436 @Override
20437 public SequencedMap<OnnxParameter, Object> onnxInputs() {
20438 return onnxInputs(SCHEMA, List.of(x(), y_scale(), y_zero_point()));
20439 }
20440
20441 public Value x() {
20442 return operands().get(0);
20443 }
20444
20445 public Value y_scale() {
20446 return operands().get(1);
20447 }
20448
20449 public java.util.Optional<Value> y_zero_point() {
20450 int i = optionalInputArguments.indexOf(InputParameter.y_zero_point);
20451 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
20452 }
20453
20454 public java.util.Optional<Long> output_dtype() {
20455 Long output_dtype = Attribute.output_dtype.access(Long.class, onnxAttributes);
20456 return java.util.Optional.ofNullable(output_dtype);
20457 }
20458
20459 public java.util.Optional<Long> saturate() {
20460 Long saturate = Attribute.saturate.access(Long.class, onnxAttributes);
20461 return java.util.Optional.ofNullable(saturate);
20462 }
20463
20464 public java.util.Optional<Long> precision() {
20465 Long precision = Attribute.precision.access(Long.class, onnxAttributes);
20466 return java.util.Optional.ofNullable(precision);
20467 }
20468
20469 public java.util.Optional<Long> axis() {
20470 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
20471 return java.util.Optional.ofNullable(axis);
20472 }
20473
20474 public java.util.Optional<Long> block_size() {
20475 Long block_size = Attribute.block_size.access(Long.class, onnxAttributes);
20476 return java.util.Optional.ofNullable(block_size);
20477 }
20478
20479 }
20480
20481 public static QuantizeLinear QuantizeLinear(CodeType resultType, Value x, Value y_scale, java.util.Optional<Value> y_zero_point, java.util.Optional<Long> output_dtype, java.util.Optional<Long> saturate, java.util.Optional<Long> precision, java.util.Optional<Long> axis, java.util.Optional<Long> block_size) {
20482 return new QuantizeLinear(resultType, x, y_scale, y_zero_point, output_dtype, saturate, precision, axis, block_size);
20483 }
20484
20485 @OpFactoryHelper.OpDeclaration(RMSNormalization.NAME)
20486 public static final class RMSNormalization extends OnnxOp {
20487 public static final String NAME = "RMSNormalization";
20488
20489 public enum Attribute implements OnnxAttribute {
20490 epsilon(Float.class, true, 1.0E-5f),
20491 stash_type(Long.class, true, 1),
20492 axis(Long.class, true, -1),
20493 ;
20494
20495 final Class<?> t;
20496 final boolean optional;
20497 final Object defaultValue;
20498
20499 Attribute(Class<?> type, boolean optional, Object defaultValue) {
20500 this.t = type;
20501 this.optional = optional;
20502 this.defaultValue = defaultValue;
20503 assert optional || defaultValue == null;
20504 }
20505
20506 public Class<?> type() {
20507 return t;
20508 }
20509
20510 public boolean isOptional() {
20511 return optional;
20512 }
20513
20514 public Object defaultValue() {
20515 return defaultValue;
20516 }
20517 }
20518
20519 public enum TypeConstraint implements OnnxTypeConstraint {
20520 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
20521 V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
20522 ;
20523
20524 final OnnxType.TypeVariable typeVariable;
20525
20526 TypeConstraint(OnnxType.TypeVariable typeVariable) {
20527 assert typeVariable.name().equals(name());
20528 this.typeVariable = typeVariable;
20529 }
20530
20531 @Override
20532 public OnnxType.TypeVariable typeVariable() {
20533 return typeVariable;
20534 }
20535 }
20536
20537 public enum InputParameter implements OnnxParameter {
20538 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
20539 scale(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED),
20540 ;
20541
20542 final OnnxType type;
20543 final Quantifier quantifier;
20544
20545 InputParameter(OnnxType type, Quantifier quantifier) {
20546 this.type = type;
20547 this.quantifier = quantifier;
20548 }
20549
20550 @Override
20551 public OnnxType type() {
20552 return type;
20553 }
20554
20555 @Override
20556 public Quantifier quantifier() {
20557 return quantifier;
20558 }
20559 }
20560
20561 public enum OutputParameter implements OnnxParameter {
20562 Y(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED),
20563 ;
20564
20565 final OnnxType type;
20566 final Quantifier quantifier;
20567
20568 OutputParameter(OnnxType type, Quantifier quantifier) {
20569 this.type = type;
20570 this.quantifier = quantifier;
20571 }
20572
20573 @Override
20574 public OnnxType type() {
20575 return type;
20576 }
20577
20578 @Override
20579 public Quantifier quantifier() {
20580 return quantifier;
20581 }
20582 }
20583
20584 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
20585 NAME,
20586 List.of(Attribute.values()),
20587 List.of(TypeConstraint.values()),
20588 List.of(InputParameter.values()),
20589 List.of(OutputParameter.values())
20590 );
20591
20592 public RMSNormalization(ExternalizedOp def) {
20593 super(SCHEMA, def);
20594 }
20595
20596 RMSNormalization(RMSNormalization that, CodeContext cc) {
20597 super(that, cc);
20598 }
20599
20600 @Override
20601 public RMSNormalization transform(CodeContext cc, CodeTransformer ot) {
20602 return new RMSNormalization(this, cc);
20603 }
20604
20605 RMSNormalization(CodeType resultType, Value X, Value scale, java.util.Optional<Float> epsilon, java.util.Optional<Long> stash_type, java.util.Optional<Long> axis) {
20606 super(SCHEMA, resultType, Set.of(), List.of(X, scale), List.of(epsilon, stash_type, axis));
20607 }
20608
20609 @Override
20610 public SequencedSet<OnnxParameter> onnxOutputs() {
20611 return onnxOutputs(SCHEMA);
20612 }
20613
20614 @Override
20615 public SequencedMap<OnnxParameter, Object> onnxInputs() {
20616 return onnxInputs(SCHEMA, List.of(X(), scale()));
20617 }
20618
20619 public Value X() {
20620 return operands().get(0);
20621 }
20622
20623 public Value scale() {
20624 return operands().get(1);
20625 }
20626
20627 public java.util.Optional<Float> epsilon() {
20628 Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes);
20629 return java.util.Optional.ofNullable(epsilon);
20630 }
20631
20632 public java.util.Optional<Long> stash_type() {
20633 Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes);
20634 return java.util.Optional.ofNullable(stash_type);
20635 }
20636
20637 public java.util.Optional<Long> axis() {
20638 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
20639 return java.util.Optional.ofNullable(axis);
20640 }
20641
20642 }
20643
20644 public static RMSNormalization RMSNormalization(CodeType resultType, Value X, Value scale, java.util.Optional<Float> epsilon, java.util.Optional<Long> stash_type, java.util.Optional<Long> axis) {
20645 return new RMSNormalization(resultType, X, scale, epsilon, stash_type, axis);
20646 }
20647
20648 @OpFactoryHelper.OpDeclaration(RNN.NAME)
20649 public static final class RNN extends OnnxOp {
20650 public static final String NAME = "RNN";
20651
20652 public enum Attribute implements OnnxAttribute {
20653 layout(Long.class, true, 0),
20654 activation_alpha(float[].class, true, null),
20655 hidden_size(Long.class, true, null),
20656 activation_beta(float[].class, true, null),
20657 activations(String[].class, true, null),
20658 clip(Float.class, true, null),
20659 direction(String.class, true, "forward"),
20660 ;
20661
20662 final Class<?> t;
20663 final boolean optional;
20664 final Object defaultValue;
20665
20666 Attribute(Class<?> type, boolean optional, Object defaultValue) {
20667 this.t = type;
20668 this.optional = optional;
20669 this.defaultValue = defaultValue;
20670 assert optional || defaultValue == null;
20671 }
20672
20673 public Class<?> type() {
20674 return t;
20675 }
20676
20677 public boolean isOptional() {
20678 return optional;
20679 }
20680
20681 public Object defaultValue() {
20682 return defaultValue;
20683 }
20684 }
20685
20686 public enum TypeConstraint implements OnnxTypeConstraint {
20687 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
20688 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32())))),
20689 ;
20690
20691 final OnnxType.TypeVariable typeVariable;
20692
20693 TypeConstraint(OnnxType.TypeVariable typeVariable) {
20694 assert typeVariable.name().equals(name());
20695 this.typeVariable = typeVariable;
20696 }
20697
20698 @Override
20699 public OnnxType.TypeVariable typeVariable() {
20700 return typeVariable;
20701 }
20702 }
20703
20704 public enum InputParameter implements OnnxParameter {
20705 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
20706 W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
20707 R(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
20708 B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
20709 sequence_lens(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
20710 initial_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
20711 ;
20712
20713 final OnnxType type;
20714 final Quantifier quantifier;
20715
20716 InputParameter(OnnxType type, Quantifier quantifier) {
20717 this.type = type;
20718 this.quantifier = quantifier;
20719 }
20720
20721 @Override
20722 public OnnxType type() {
20723 return type;
20724 }
20725
20726 @Override
20727 public Quantifier quantifier() {
20728 return quantifier;
20729 }
20730 }
20731
20732 public enum OutputParameter implements OnnxParameter {
20733 Y(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
20734 Y_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
20735 ;
20736
20737 final OnnxType type;
20738 final Quantifier quantifier;
20739
20740 OutputParameter(OnnxType type, Quantifier quantifier) {
20741 this.type = type;
20742 this.quantifier = quantifier;
20743 }
20744
20745 @Override
20746 public OnnxType type() {
20747 return type;
20748 }
20749
20750 @Override
20751 public Quantifier quantifier() {
20752 return quantifier;
20753 }
20754 }
20755
20756 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
20757 NAME,
20758 List.of(Attribute.values()),
20759 List.of(TypeConstraint.values()),
20760 List.of(InputParameter.values()),
20761 List.of(OutputParameter.values())
20762 );
20763
20764 public RNN(ExternalizedOp def) {
20765 super(SCHEMA, def);
20766 }
20767
20768 RNN(RNN that, CodeContext cc) {
20769 super(that, cc);
20770 }
20771
20772 @Override
20773 public RNN transform(CodeContext cc, CodeTransformer ot) {
20774 return new RNN(this, cc);
20775 }
20776
20777 RNN(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, Value W, Value R, java.util.Optional<Value> B, java.util.Optional<Value> sequence_lens, java.util.Optional<Value> initial_h, java.util.Optional<Long> layout, java.util.Optional<float[]> activation_alpha, java.util.Optional<Long> hidden_size, java.util.Optional<float[]> activation_beta, java.util.Optional<String[]> activations, java.util.Optional<Float> clip, java.util.Optional<String> direction) {
20778 super(SCHEMA, resultType, optionalOutputs, List.of(X, W, R, B, sequence_lens, initial_h), List.of(layout, activation_alpha, hidden_size, activation_beta, activations, clip, direction));
20779 }
20780
20781 @Override
20782 public SequencedSet<OnnxParameter> onnxOutputs() {
20783 return onnxOutputs(SCHEMA);
20784 }
20785
20786 @Override
20787 public SequencedMap<OnnxParameter, Object> onnxInputs() {
20788 return onnxInputs(SCHEMA, List.of(X(), W(), R(), B(), sequence_lens(), initial_h()));
20789 }
20790
20791 public Value X() {
20792 return operands().get(0);
20793 }
20794
20795 public Value W() {
20796 return operands().get(1);
20797 }
20798
20799 public Value R() {
20800 return operands().get(2);
20801 }
20802
20803 public java.util.Optional<Value> B() {
20804 int i = optionalInputArguments.indexOf(InputParameter.B);
20805 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
20806 }
20807
20808 public java.util.Optional<Value> sequence_lens() {
20809 int i = optionalInputArguments.indexOf(InputParameter.sequence_lens);
20810 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
20811 }
20812
20813 public java.util.Optional<Value> initial_h() {
20814 int i = optionalInputArguments.indexOf(InputParameter.initial_h);
20815 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
20816 }
20817
20818 public java.util.Optional<Long> layout() {
20819 Long layout = Attribute.layout.access(Long.class, onnxAttributes);
20820 return java.util.Optional.ofNullable(layout);
20821 }
20822
20823 public java.util.Optional<float[]> activation_alpha() {
20824 float[] activation_alpha = Attribute.activation_alpha.access(float[].class, onnxAttributes);
20825 return java.util.Optional.ofNullable(activation_alpha).map(float[]::clone);
20826 }
20827
20828 public java.util.Optional<Long> hidden_size() {
20829 Long hidden_size = Attribute.hidden_size.access(Long.class, onnxAttributes);
20830 return java.util.Optional.ofNullable(hidden_size);
20831 }
20832
20833 public java.util.Optional<float[]> activation_beta() {
20834 float[] activation_beta = Attribute.activation_beta.access(float[].class, onnxAttributes);
20835 return java.util.Optional.ofNullable(activation_beta).map(float[]::clone);
20836 }
20837
20838 public java.util.Optional<String[]> activations() {
20839 String[] activations = Attribute.activations.access(String[].class, onnxAttributes);
20840 return java.util.Optional.ofNullable(activations).map(String[]::clone);
20841 }
20842
20843 public java.util.Optional<Float> clip() {
20844 Float clip = Attribute.clip.access(Float.class, onnxAttributes);
20845 return java.util.Optional.ofNullable(clip);
20846 }
20847
20848 public java.util.Optional<String> direction() {
20849 String direction = Attribute.direction.access(String.class, onnxAttributes);
20850 return java.util.Optional.ofNullable(direction);
20851 }
20852
20853 }
20854
20855 public static RNN RNN(CodeType resultType, Set<RNN.OutputParameter> optionalOutputs, Value X, Value W, Value R, java.util.Optional<Value> B, java.util.Optional<Value> sequence_lens, java.util.Optional<Value> initial_h, java.util.Optional<Long> layout, java.util.Optional<float[]> activation_alpha, java.util.Optional<Long> hidden_size, java.util.Optional<float[]> activation_beta, java.util.Optional<String[]> activations, java.util.Optional<Float> clip, java.util.Optional<String> direction) {
20856 return new RNN(resultType, optionalOutputs, X, W, R, B, sequence_lens, initial_h, layout, activation_alpha, hidden_size, activation_beta, activations, clip, direction);
20857 }
20858
20859 @OpFactoryHelper.OpDeclaration(RandomNormal.NAME)
20860 public static final class RandomNormal extends OnnxOp {
20861 public static final String NAME = "RandomNormal";
20862
20863 public enum Attribute implements OnnxAttribute {
20864 shape(long[].class, false, null),
20865 seed(Float.class, true, null),
20866 mean(Float.class, true, 0.0f),
20867 scale(Float.class, true, 1.0f),
20868 dtype(Long.class, true, 1),
20869 ;
20870
20871 final Class<?> t;
20872 final boolean optional;
20873 final Object defaultValue;
20874
20875 Attribute(Class<?> type, boolean optional, Object defaultValue) {
20876 this.t = type;
20877 this.optional = optional;
20878 this.defaultValue = defaultValue;
20879 assert optional || defaultValue == null;
20880 }
20881
20882 public Class<?> type() {
20883 return t;
20884 }
20885
20886 public boolean isOptional() {
20887 return optional;
20888 }
20889
20890 public Object defaultValue() {
20891 return defaultValue;
20892 }
20893 }
20894
20895 public enum TypeConstraint implements OnnxTypeConstraint {
20896 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
20897 ;
20898
20899 final OnnxType.TypeVariable typeVariable;
20900
20901 TypeConstraint(OnnxType.TypeVariable typeVariable) {
20902 assert typeVariable.name().equals(name());
20903 this.typeVariable = typeVariable;
20904 }
20905
20906 @Override
20907 public OnnxType.TypeVariable typeVariable() {
20908 return typeVariable;
20909 }
20910 }
20911
20912 public enum InputParameter implements OnnxParameter.None { }
20913
20914 public enum OutputParameter implements OnnxParameter {
20915 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
20916 ;
20917
20918 final OnnxType type;
20919 final Quantifier quantifier;
20920
20921 OutputParameter(OnnxType type, Quantifier quantifier) {
20922 this.type = type;
20923 this.quantifier = quantifier;
20924 }
20925
20926 @Override
20927 public OnnxType type() {
20928 return type;
20929 }
20930
20931 @Override
20932 public Quantifier quantifier() {
20933 return quantifier;
20934 }
20935 }
20936
20937 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
20938 NAME,
20939 List.of(Attribute.values()),
20940 List.of(TypeConstraint.values()),
20941 List.of(InputParameter.values()),
20942 List.of(OutputParameter.values())
20943 );
20944
20945 public RandomNormal(ExternalizedOp def) {
20946 super(SCHEMA, def);
20947 }
20948
20949 RandomNormal(RandomNormal that, CodeContext cc) {
20950 super(that, cc);
20951 }
20952
20953 @Override
20954 public RandomNormal transform(CodeContext cc, CodeTransformer ot) {
20955 return new RandomNormal(this, cc);
20956 }
20957
20958 RandomNormal(CodeType resultType, long[] shape, java.util.Optional<Float> seed, java.util.Optional<Float> mean, java.util.Optional<Float> scale, java.util.Optional<Long> dtype) {
20959 super(SCHEMA, resultType, Set.of(), List.of(), List.of(shape, seed, mean, scale, dtype));
20960 }
20961
20962 @Override
20963 public SequencedSet<OnnxParameter> onnxOutputs() {
20964 return onnxOutputs(SCHEMA);
20965 }
20966
20967 @Override
20968 public SequencedMap<OnnxParameter, Object> onnxInputs() {
20969 return onnxInputs(SCHEMA, List.of());
20970 }
20971
20972 public long[] shape() {
20973 long[] shape = Attribute.shape.access(long[].class, onnxAttributes);
20974 return shape.clone();
20975 }
20976
20977 public java.util.Optional<Float> seed() {
20978 Float seed = Attribute.seed.access(Float.class, onnxAttributes);
20979 return java.util.Optional.ofNullable(seed);
20980 }
20981
20982 public java.util.Optional<Float> mean() {
20983 Float mean = Attribute.mean.access(Float.class, onnxAttributes);
20984 return java.util.Optional.ofNullable(mean);
20985 }
20986
20987 public java.util.Optional<Float> scale() {
20988 Float scale = Attribute.scale.access(Float.class, onnxAttributes);
20989 return java.util.Optional.ofNullable(scale);
20990 }
20991
20992 public java.util.Optional<Long> dtype() {
20993 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
20994 return java.util.Optional.ofNullable(dtype);
20995 }
20996
20997 }
20998
20999 public static RandomNormal RandomNormal(CodeType resultType, long[] shape, java.util.Optional<Float> seed, java.util.Optional<Float> mean, java.util.Optional<Float> scale, java.util.Optional<Long> dtype) {
21000 return new RandomNormal(resultType, shape, seed, mean, scale, dtype);
21001 }
21002
21003 @OpFactoryHelper.OpDeclaration(RandomNormalLike.NAME)
21004 public static final class RandomNormalLike extends OnnxOp {
21005 public static final String NAME = "RandomNormalLike";
21006
21007 public enum Attribute implements OnnxAttribute {
21008 seed(Float.class, true, null),
21009 mean(Float.class, true, 0.0f),
21010 scale(Float.class, true, 1.0f),
21011 dtype(Long.class, true, null),
21012 ;
21013
21014 final Class<?> t;
21015 final boolean optional;
21016 final Object defaultValue;
21017
21018 Attribute(Class<?> type, boolean optional, Object defaultValue) {
21019 this.t = type;
21020 this.optional = optional;
21021 this.defaultValue = defaultValue;
21022 assert optional || defaultValue == null;
21023 }
21024
21025 public Class<?> type() {
21026 return t;
21027 }
21028
21029 public boolean isOptional() {
21030 return optional;
21031 }
21032
21033 public Object defaultValue() {
21034 return defaultValue;
21035 }
21036 }
21037
21038 public enum TypeConstraint implements OnnxTypeConstraint {
21039 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
21040 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
21041 ;
21042
21043 final OnnxType.TypeVariable typeVariable;
21044
21045 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21046 assert typeVariable.name().equals(name());
21047 this.typeVariable = typeVariable;
21048 }
21049
21050 @Override
21051 public OnnxType.TypeVariable typeVariable() {
21052 return typeVariable;
21053 }
21054 }
21055
21056 public enum InputParameter implements OnnxParameter {
21057 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
21058 ;
21059
21060 final OnnxType type;
21061 final Quantifier quantifier;
21062
21063 InputParameter(OnnxType type, Quantifier quantifier) {
21064 this.type = type;
21065 this.quantifier = quantifier;
21066 }
21067
21068 @Override
21069 public OnnxType type() {
21070 return type;
21071 }
21072
21073 @Override
21074 public Quantifier quantifier() {
21075 return quantifier;
21076 }
21077 }
21078
21079 public enum OutputParameter implements OnnxParameter {
21080 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
21081 ;
21082
21083 final OnnxType type;
21084 final Quantifier quantifier;
21085
21086 OutputParameter(OnnxType type, Quantifier quantifier) {
21087 this.type = type;
21088 this.quantifier = quantifier;
21089 }
21090
21091 @Override
21092 public OnnxType type() {
21093 return type;
21094 }
21095
21096 @Override
21097 public Quantifier quantifier() {
21098 return quantifier;
21099 }
21100 }
21101
21102 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21103 NAME,
21104 List.of(Attribute.values()),
21105 List.of(TypeConstraint.values()),
21106 List.of(InputParameter.values()),
21107 List.of(OutputParameter.values())
21108 );
21109
21110 public RandomNormalLike(ExternalizedOp def) {
21111 super(SCHEMA, def);
21112 }
21113
21114 RandomNormalLike(RandomNormalLike that, CodeContext cc) {
21115 super(that, cc);
21116 }
21117
21118 @Override
21119 public RandomNormalLike transform(CodeContext cc, CodeTransformer ot) {
21120 return new RandomNormalLike(this, cc);
21121 }
21122
21123 RandomNormalLike(CodeType resultType, Value input, java.util.Optional<Float> seed, java.util.Optional<Float> mean, java.util.Optional<Float> scale, java.util.Optional<Long> dtype) {
21124 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(seed, mean, scale, dtype));
21125 }
21126
21127 @Override
21128 public SequencedSet<OnnxParameter> onnxOutputs() {
21129 return onnxOutputs(SCHEMA);
21130 }
21131
21132 @Override
21133 public SequencedMap<OnnxParameter, Object> onnxInputs() {
21134 return onnxInputs(SCHEMA, List.of(input()));
21135 }
21136
21137 public Value input() {
21138 return operands().get(0);
21139 }
21140
21141 public java.util.Optional<Float> seed() {
21142 Float seed = Attribute.seed.access(Float.class, onnxAttributes);
21143 return java.util.Optional.ofNullable(seed);
21144 }
21145
21146 public java.util.Optional<Float> mean() {
21147 Float mean = Attribute.mean.access(Float.class, onnxAttributes);
21148 return java.util.Optional.ofNullable(mean);
21149 }
21150
21151 public java.util.Optional<Float> scale() {
21152 Float scale = Attribute.scale.access(Float.class, onnxAttributes);
21153 return java.util.Optional.ofNullable(scale);
21154 }
21155
21156 public java.util.Optional<Long> dtype() {
21157 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
21158 return java.util.Optional.ofNullable(dtype);
21159 }
21160
21161 }
21162
21163 public static RandomNormalLike RandomNormalLike(CodeType resultType, Value input, java.util.Optional<Float> seed, java.util.Optional<Float> mean, java.util.Optional<Float> scale, java.util.Optional<Long> dtype) {
21164 return new RandomNormalLike(resultType, input, seed, mean, scale, dtype);
21165 }
21166
21167 @OpFactoryHelper.OpDeclaration(RandomUniform.NAME)
21168 public static final class RandomUniform extends OnnxOp {
21169 public static final String NAME = "RandomUniform";
21170
21171 public enum Attribute implements OnnxAttribute {
21172 high(Float.class, true, 1.0f),
21173 shape(long[].class, false, null),
21174 seed(Float.class, true, null),
21175 low(Float.class, true, 0.0f),
21176 dtype(Long.class, true, 1),
21177 ;
21178
21179 final Class<?> t;
21180 final boolean optional;
21181 final Object defaultValue;
21182
21183 Attribute(Class<?> type, boolean optional, Object defaultValue) {
21184 this.t = type;
21185 this.optional = optional;
21186 this.defaultValue = defaultValue;
21187 assert optional || defaultValue == null;
21188 }
21189
21190 public Class<?> type() {
21191 return t;
21192 }
21193
21194 public boolean isOptional() {
21195 return optional;
21196 }
21197
21198 public Object defaultValue() {
21199 return defaultValue;
21200 }
21201 }
21202
21203 public enum TypeConstraint implements OnnxTypeConstraint {
21204 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
21205 ;
21206
21207 final OnnxType.TypeVariable typeVariable;
21208
21209 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21210 assert typeVariable.name().equals(name());
21211 this.typeVariable = typeVariable;
21212 }
21213
21214 @Override
21215 public OnnxType.TypeVariable typeVariable() {
21216 return typeVariable;
21217 }
21218 }
21219
21220 public enum InputParameter implements OnnxParameter.None { }
21221
21222 public enum OutputParameter implements OnnxParameter {
21223 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21224 ;
21225
21226 final OnnxType type;
21227 final Quantifier quantifier;
21228
21229 OutputParameter(OnnxType type, Quantifier quantifier) {
21230 this.type = type;
21231 this.quantifier = quantifier;
21232 }
21233
21234 @Override
21235 public OnnxType type() {
21236 return type;
21237 }
21238
21239 @Override
21240 public Quantifier quantifier() {
21241 return quantifier;
21242 }
21243 }
21244
21245 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21246 NAME,
21247 List.of(Attribute.values()),
21248 List.of(TypeConstraint.values()),
21249 List.of(InputParameter.values()),
21250 List.of(OutputParameter.values())
21251 );
21252
21253 public RandomUniform(ExternalizedOp def) {
21254 super(SCHEMA, def);
21255 }
21256
21257 RandomUniform(RandomUniform that, CodeContext cc) {
21258 super(that, cc);
21259 }
21260
21261 @Override
21262 public RandomUniform transform(CodeContext cc, CodeTransformer ot) {
21263 return new RandomUniform(this, cc);
21264 }
21265
21266 RandomUniform(CodeType resultType, java.util.Optional<Float> high, long[] shape, java.util.Optional<Float> seed, java.util.Optional<Float> low, java.util.Optional<Long> dtype) {
21267 super(SCHEMA, resultType, Set.of(), List.of(), List.of(high, shape, seed, low, dtype));
21268 }
21269
21270 @Override
21271 public SequencedSet<OnnxParameter> onnxOutputs() {
21272 return onnxOutputs(SCHEMA);
21273 }
21274
21275 @Override
21276 public SequencedMap<OnnxParameter, Object> onnxInputs() {
21277 return onnxInputs(SCHEMA, List.of());
21278 }
21279
21280 public java.util.Optional<Float> high() {
21281 Float high = Attribute.high.access(Float.class, onnxAttributes);
21282 return java.util.Optional.ofNullable(high);
21283 }
21284
21285 public long[] shape() {
21286 long[] shape = Attribute.shape.access(long[].class, onnxAttributes);
21287 return shape.clone();
21288 }
21289
21290 public java.util.Optional<Float> seed() {
21291 Float seed = Attribute.seed.access(Float.class, onnxAttributes);
21292 return java.util.Optional.ofNullable(seed);
21293 }
21294
21295 public java.util.Optional<Float> low() {
21296 Float low = Attribute.low.access(Float.class, onnxAttributes);
21297 return java.util.Optional.ofNullable(low);
21298 }
21299
21300 public java.util.Optional<Long> dtype() {
21301 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
21302 return java.util.Optional.ofNullable(dtype);
21303 }
21304
21305 }
21306
21307 public static RandomUniform RandomUniform(CodeType resultType, java.util.Optional<Float> high, long[] shape, java.util.Optional<Float> seed, java.util.Optional<Float> low, java.util.Optional<Long> dtype) {
21308 return new RandomUniform(resultType, high, shape, seed, low, dtype);
21309 }
21310
21311 @OpFactoryHelper.OpDeclaration(RandomUniformLike.NAME)
21312 public static final class RandomUniformLike extends OnnxOp {
21313 public static final String NAME = "RandomUniformLike";
21314
21315 public enum Attribute implements OnnxAttribute {
21316 high(Float.class, true, 1.0f),
21317 seed(Float.class, true, null),
21318 low(Float.class, true, 0.0f),
21319 dtype(Long.class, true, null),
21320 ;
21321
21322 final Class<?> t;
21323 final boolean optional;
21324 final Object defaultValue;
21325
21326 Attribute(Class<?> type, boolean optional, Object defaultValue) {
21327 this.t = type;
21328 this.optional = optional;
21329 this.defaultValue = defaultValue;
21330 assert optional || defaultValue == null;
21331 }
21332
21333 public Class<?> type() {
21334 return t;
21335 }
21336
21337 public boolean isOptional() {
21338 return optional;
21339 }
21340
21341 public Object defaultValue() {
21342 return defaultValue;
21343 }
21344 }
21345
21346 public enum TypeConstraint implements OnnxTypeConstraint {
21347 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
21348 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
21349 ;
21350
21351 final OnnxType.TypeVariable typeVariable;
21352
21353 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21354 assert typeVariable.name().equals(name());
21355 this.typeVariable = typeVariable;
21356 }
21357
21358 @Override
21359 public OnnxType.TypeVariable typeVariable() {
21360 return typeVariable;
21361 }
21362 }
21363
21364 public enum InputParameter implements OnnxParameter {
21365 input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
21366 ;
21367
21368 final OnnxType type;
21369 final Quantifier quantifier;
21370
21371 InputParameter(OnnxType type, Quantifier quantifier) {
21372 this.type = type;
21373 this.quantifier = quantifier;
21374 }
21375
21376 @Override
21377 public OnnxType type() {
21378 return type;
21379 }
21380
21381 @Override
21382 public Quantifier quantifier() {
21383 return quantifier;
21384 }
21385 }
21386
21387 public enum OutputParameter implements OnnxParameter {
21388 output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
21389 ;
21390
21391 final OnnxType type;
21392 final Quantifier quantifier;
21393
21394 OutputParameter(OnnxType type, Quantifier quantifier) {
21395 this.type = type;
21396 this.quantifier = quantifier;
21397 }
21398
21399 @Override
21400 public OnnxType type() {
21401 return type;
21402 }
21403
21404 @Override
21405 public Quantifier quantifier() {
21406 return quantifier;
21407 }
21408 }
21409
21410 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21411 NAME,
21412 List.of(Attribute.values()),
21413 List.of(TypeConstraint.values()),
21414 List.of(InputParameter.values()),
21415 List.of(OutputParameter.values())
21416 );
21417
21418 public RandomUniformLike(ExternalizedOp def) {
21419 super(SCHEMA, def);
21420 }
21421
21422 RandomUniformLike(RandomUniformLike that, CodeContext cc) {
21423 super(that, cc);
21424 }
21425
21426 @Override
21427 public RandomUniformLike transform(CodeContext cc, CodeTransformer ot) {
21428 return new RandomUniformLike(this, cc);
21429 }
21430
21431 RandomUniformLike(CodeType resultType, Value input, java.util.Optional<Float> high, java.util.Optional<Float> seed, java.util.Optional<Float> low, java.util.Optional<Long> dtype) {
21432 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(high, seed, low, dtype));
21433 }
21434
21435 @Override
21436 public SequencedSet<OnnxParameter> onnxOutputs() {
21437 return onnxOutputs(SCHEMA);
21438 }
21439
21440 @Override
21441 public SequencedMap<OnnxParameter, Object> onnxInputs() {
21442 return onnxInputs(SCHEMA, List.of(input()));
21443 }
21444
21445 public Value input() {
21446 return operands().get(0);
21447 }
21448
21449 public java.util.Optional<Float> high() {
21450 Float high = Attribute.high.access(Float.class, onnxAttributes);
21451 return java.util.Optional.ofNullable(high);
21452 }
21453
21454 public java.util.Optional<Float> seed() {
21455 Float seed = Attribute.seed.access(Float.class, onnxAttributes);
21456 return java.util.Optional.ofNullable(seed);
21457 }
21458
21459 public java.util.Optional<Float> low() {
21460 Float low = Attribute.low.access(Float.class, onnxAttributes);
21461 return java.util.Optional.ofNullable(low);
21462 }
21463
21464 public java.util.Optional<Long> dtype() {
21465 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
21466 return java.util.Optional.ofNullable(dtype);
21467 }
21468
21469 }
21470
21471 public static RandomUniformLike RandomUniformLike(CodeType resultType, Value input, java.util.Optional<Float> high, java.util.Optional<Float> seed, java.util.Optional<Float> low, java.util.Optional<Long> dtype) {
21472 return new RandomUniformLike(resultType, input, high, seed, low, dtype);
21473 }
21474
21475 @OpFactoryHelper.OpDeclaration(Range.NAME)
21476 public static final class Range extends OnnxOp {
21477 public static final String NAME = "Range";
21478
21479 public enum Attribute implements OnnxAttribute {
21480 stash_type(Long.class, true, 1),
21481 ;
21482
21483 final Class<?> t;
21484 final boolean optional;
21485 final Object defaultValue;
21486
21487 Attribute(Class<?> type, boolean optional, Object defaultValue) {
21488 this.t = type;
21489 this.optional = optional;
21490 this.defaultValue = defaultValue;
21491 assert optional || defaultValue == null;
21492 }
21493
21494 public Class<?> type() {
21495 return t;
21496 }
21497
21498 public boolean isOptional() {
21499 return optional;
21500 }
21501
21502 public Object defaultValue() {
21503 return defaultValue;
21504 }
21505 }
21506
21507 public enum TypeConstraint implements OnnxTypeConstraint {
21508 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))),
21509 ;
21510
21511 final OnnxType.TypeVariable typeVariable;
21512
21513 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21514 assert typeVariable.name().equals(name());
21515 this.typeVariable = typeVariable;
21516 }
21517
21518 @Override
21519 public OnnxType.TypeVariable typeVariable() {
21520 return typeVariable;
21521 }
21522 }
21523
21524 public enum InputParameter implements OnnxParameter {
21525 start(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21526 limit(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21527 delta(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21528 ;
21529
21530 final OnnxType type;
21531 final Quantifier quantifier;
21532
21533 InputParameter(OnnxType type, Quantifier quantifier) {
21534 this.type = type;
21535 this.quantifier = quantifier;
21536 }
21537
21538 @Override
21539 public OnnxType type() {
21540 return type;
21541 }
21542
21543 @Override
21544 public Quantifier quantifier() {
21545 return quantifier;
21546 }
21547 }
21548
21549 public enum OutputParameter implements OnnxParameter {
21550 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21551 ;
21552
21553 final OnnxType type;
21554 final Quantifier quantifier;
21555
21556 OutputParameter(OnnxType type, Quantifier quantifier) {
21557 this.type = type;
21558 this.quantifier = quantifier;
21559 }
21560
21561 @Override
21562 public OnnxType type() {
21563 return type;
21564 }
21565
21566 @Override
21567 public Quantifier quantifier() {
21568 return quantifier;
21569 }
21570 }
21571
21572 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21573 NAME,
21574 List.of(Attribute.values()),
21575 List.of(TypeConstraint.values()),
21576 List.of(InputParameter.values()),
21577 List.of(OutputParameter.values())
21578 );
21579
21580 public Range(ExternalizedOp def) {
21581 super(SCHEMA, def);
21582 }
21583
21584 Range(Range that, CodeContext cc) {
21585 super(that, cc);
21586 }
21587
21588 @Override
21589 public Range transform(CodeContext cc, CodeTransformer ot) {
21590 return new Range(this, cc);
21591 }
21592
21593 Range(CodeType resultType, Value start, Value limit, Value delta, java.util.Optional<Long> stash_type) {
21594 super(SCHEMA, resultType, Set.of(), List.of(start, limit, delta), List.of(stash_type));
21595 }
21596
21597 @Override
21598 public SequencedSet<OnnxParameter> onnxOutputs() {
21599 return onnxOutputs(SCHEMA);
21600 }
21601
21602 @Override
21603 public SequencedMap<OnnxParameter, Object> onnxInputs() {
21604 return onnxInputs(SCHEMA, List.of(start(), limit(), delta()));
21605 }
21606
21607 public Value start() {
21608 return operands().get(0);
21609 }
21610
21611 public Value limit() {
21612 return operands().get(1);
21613 }
21614
21615 public Value delta() {
21616 return operands().get(2);
21617 }
21618
21619 public java.util.Optional<Long> stash_type() {
21620 Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes);
21621 return java.util.Optional.ofNullable(stash_type);
21622 }
21623
21624 }
21625
21626 public static Range Range(CodeType resultType, Value start, Value limit, Value delta, java.util.Optional<Long> stash_type) {
21627 return new Range(resultType, start, limit, delta, stash_type);
21628 }
21629
21630 @OpFactoryHelper.OpDeclaration(Reciprocal.NAME)
21631 public static final class Reciprocal extends OnnxOp {
21632 public static final String NAME = "Reciprocal";
21633
21634 public enum Attribute implements OnnxAttribute.None { }
21635
21636 public enum TypeConstraint implements OnnxTypeConstraint {
21637 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
21638 ;
21639
21640 final OnnxType.TypeVariable typeVariable;
21641
21642 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21643 assert typeVariable.name().equals(name());
21644 this.typeVariable = typeVariable;
21645 }
21646
21647 @Override
21648 public OnnxType.TypeVariable typeVariable() {
21649 return typeVariable;
21650 }
21651 }
21652
21653 public enum InputParameter implements OnnxParameter {
21654 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21655 ;
21656
21657 final OnnxType type;
21658 final Quantifier quantifier;
21659
21660 InputParameter(OnnxType type, Quantifier quantifier) {
21661 this.type = type;
21662 this.quantifier = quantifier;
21663 }
21664
21665 @Override
21666 public OnnxType type() {
21667 return type;
21668 }
21669
21670 @Override
21671 public Quantifier quantifier() {
21672 return quantifier;
21673 }
21674 }
21675
21676 public enum OutputParameter implements OnnxParameter {
21677 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21678 ;
21679
21680 final OnnxType type;
21681 final Quantifier quantifier;
21682
21683 OutputParameter(OnnxType type, Quantifier quantifier) {
21684 this.type = type;
21685 this.quantifier = quantifier;
21686 }
21687
21688 @Override
21689 public OnnxType type() {
21690 return type;
21691 }
21692
21693 @Override
21694 public Quantifier quantifier() {
21695 return quantifier;
21696 }
21697 }
21698
21699 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21700 NAME,
21701 List.of(Attribute.values()),
21702 List.of(TypeConstraint.values()),
21703 List.of(InputParameter.values()),
21704 List.of(OutputParameter.values())
21705 );
21706
21707 public Reciprocal(ExternalizedOp def) {
21708 super(SCHEMA, def);
21709 }
21710
21711 Reciprocal(Reciprocal that, CodeContext cc) {
21712 super(that, cc);
21713 }
21714
21715 @Override
21716 public Reciprocal transform(CodeContext cc, CodeTransformer ot) {
21717 return new Reciprocal(this, cc);
21718 }
21719
21720 Reciprocal(CodeType resultType, Value X) {
21721 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
21722 }
21723
21724 @Override
21725 public SequencedSet<OnnxParameter> onnxOutputs() {
21726 return onnxOutputs(SCHEMA);
21727 }
21728
21729 @Override
21730 public SequencedMap<OnnxParameter, Object> onnxInputs() {
21731 return onnxInputs(SCHEMA, List.of(X()));
21732 }
21733
21734 public Value X() {
21735 return operands().get(0);
21736 }
21737
21738 }
21739
21740 public static Reciprocal Reciprocal(CodeType resultType, Value X) {
21741 return new Reciprocal(resultType, X);
21742 }
21743
21744 @OpFactoryHelper.OpDeclaration(ReduceL1.NAME)
21745 public static final class ReduceL1 extends OnnxOp {
21746 public static final String NAME = "ReduceL1";
21747
21748 public enum Attribute implements OnnxAttribute {
21749 noop_with_empty_axes(Long.class, true, 0),
21750 keepdims(Long.class, true, 1),
21751 ;
21752
21753 final Class<?> t;
21754 final boolean optional;
21755 final Object defaultValue;
21756
21757 Attribute(Class<?> type, boolean optional, Object defaultValue) {
21758 this.t = type;
21759 this.optional = optional;
21760 this.defaultValue = defaultValue;
21761 assert optional || defaultValue == null;
21762 }
21763
21764 public Class<?> type() {
21765 return t;
21766 }
21767
21768 public boolean isOptional() {
21769 return optional;
21770 }
21771
21772 public Object defaultValue() {
21773 return defaultValue;
21774 }
21775 }
21776
21777 public enum TypeConstraint implements OnnxTypeConstraint {
21778 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
21779 ;
21780
21781 final OnnxType.TypeVariable typeVariable;
21782
21783 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21784 assert typeVariable.name().equals(name());
21785 this.typeVariable = typeVariable;
21786 }
21787
21788 @Override
21789 public OnnxType.TypeVariable typeVariable() {
21790 return typeVariable;
21791 }
21792 }
21793
21794 public enum InputParameter implements OnnxParameter {
21795 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21796 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
21797 ;
21798
21799 final OnnxType type;
21800 final Quantifier quantifier;
21801
21802 InputParameter(OnnxType type, Quantifier quantifier) {
21803 this.type = type;
21804 this.quantifier = quantifier;
21805 }
21806
21807 @Override
21808 public OnnxType type() {
21809 return type;
21810 }
21811
21812 @Override
21813 public Quantifier quantifier() {
21814 return quantifier;
21815 }
21816 }
21817
21818 public enum OutputParameter implements OnnxParameter {
21819 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21820 ;
21821
21822 final OnnxType type;
21823 final Quantifier quantifier;
21824
21825 OutputParameter(OnnxType type, Quantifier quantifier) {
21826 this.type = type;
21827 this.quantifier = quantifier;
21828 }
21829
21830 @Override
21831 public OnnxType type() {
21832 return type;
21833 }
21834
21835 @Override
21836 public Quantifier quantifier() {
21837 return quantifier;
21838 }
21839 }
21840
21841 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21842 NAME,
21843 List.of(Attribute.values()),
21844 List.of(TypeConstraint.values()),
21845 List.of(InputParameter.values()),
21846 List.of(OutputParameter.values())
21847 );
21848
21849 public ReduceL1(ExternalizedOp def) {
21850 super(SCHEMA, def);
21851 }
21852
21853 ReduceL1(ReduceL1 that, CodeContext cc) {
21854 super(that, cc);
21855 }
21856
21857 @Override
21858 public ReduceL1 transform(CodeContext cc, CodeTransformer ot) {
21859 return new ReduceL1(this, cc);
21860 }
21861
21862 ReduceL1(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
21863 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
21864 }
21865
21866 @Override
21867 public SequencedSet<OnnxParameter> onnxOutputs() {
21868 return onnxOutputs(SCHEMA);
21869 }
21870
21871 @Override
21872 public SequencedMap<OnnxParameter, Object> onnxInputs() {
21873 return onnxInputs(SCHEMA, List.of(data(), axes()));
21874 }
21875
21876 public Value data() {
21877 return operands().get(0);
21878 }
21879
21880 public java.util.Optional<Value> axes() {
21881 int i = optionalInputArguments.indexOf(InputParameter.axes);
21882 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
21883 }
21884
21885 public java.util.Optional<Long> noop_with_empty_axes() {
21886 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
21887 return java.util.Optional.ofNullable(noop_with_empty_axes);
21888 }
21889
21890 public java.util.Optional<Long> keepdims() {
21891 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
21892 return java.util.Optional.ofNullable(keepdims);
21893 }
21894
21895 }
21896
21897 public static ReduceL1 ReduceL1(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
21898 return new ReduceL1(resultType, data, axes, noop_with_empty_axes, keepdims);
21899 }
21900
21901 @OpFactoryHelper.OpDeclaration(ReduceL2.NAME)
21902 public static final class ReduceL2 extends OnnxOp {
21903 public static final String NAME = "ReduceL2";
21904
21905 public enum Attribute implements OnnxAttribute {
21906 noop_with_empty_axes(Long.class, true, 0),
21907 keepdims(Long.class, true, 1),
21908 ;
21909
21910 final Class<?> t;
21911 final boolean optional;
21912 final Object defaultValue;
21913
21914 Attribute(Class<?> type, boolean optional, Object defaultValue) {
21915 this.t = type;
21916 this.optional = optional;
21917 this.defaultValue = defaultValue;
21918 assert optional || defaultValue == null;
21919 }
21920
21921 public Class<?> type() {
21922 return t;
21923 }
21924
21925 public boolean isOptional() {
21926 return optional;
21927 }
21928
21929 public Object defaultValue() {
21930 return defaultValue;
21931 }
21932 }
21933
21934 public enum TypeConstraint implements OnnxTypeConstraint {
21935 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
21936 ;
21937
21938 final OnnxType.TypeVariable typeVariable;
21939
21940 TypeConstraint(OnnxType.TypeVariable typeVariable) {
21941 assert typeVariable.name().equals(name());
21942 this.typeVariable = typeVariable;
21943 }
21944
21945 @Override
21946 public OnnxType.TypeVariable typeVariable() {
21947 return typeVariable;
21948 }
21949 }
21950
21951 public enum InputParameter implements OnnxParameter {
21952 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21953 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
21954 ;
21955
21956 final OnnxType type;
21957 final Quantifier quantifier;
21958
21959 InputParameter(OnnxType type, Quantifier quantifier) {
21960 this.type = type;
21961 this.quantifier = quantifier;
21962 }
21963
21964 @Override
21965 public OnnxType type() {
21966 return type;
21967 }
21968
21969 @Override
21970 public Quantifier quantifier() {
21971 return quantifier;
21972 }
21973 }
21974
21975 public enum OutputParameter implements OnnxParameter {
21976 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
21977 ;
21978
21979 final OnnxType type;
21980 final Quantifier quantifier;
21981
21982 OutputParameter(OnnxType type, Quantifier quantifier) {
21983 this.type = type;
21984 this.quantifier = quantifier;
21985 }
21986
21987 @Override
21988 public OnnxType type() {
21989 return type;
21990 }
21991
21992 @Override
21993 public Quantifier quantifier() {
21994 return quantifier;
21995 }
21996 }
21997
21998 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
21999 NAME,
22000 List.of(Attribute.values()),
22001 List.of(TypeConstraint.values()),
22002 List.of(InputParameter.values()),
22003 List.of(OutputParameter.values())
22004 );
22005
22006 public ReduceL2(ExternalizedOp def) {
22007 super(SCHEMA, def);
22008 }
22009
22010 ReduceL2(ReduceL2 that, CodeContext cc) {
22011 super(that, cc);
22012 }
22013
22014 @Override
22015 public ReduceL2 transform(CodeContext cc, CodeTransformer ot) {
22016 return new ReduceL2(this, cc);
22017 }
22018
22019 ReduceL2(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22020 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22021 }
22022
22023 @Override
22024 public SequencedSet<OnnxParameter> onnxOutputs() {
22025 return onnxOutputs(SCHEMA);
22026 }
22027
22028 @Override
22029 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22030 return onnxInputs(SCHEMA, List.of(data(), axes()));
22031 }
22032
22033 public Value data() {
22034 return operands().get(0);
22035 }
22036
22037 public java.util.Optional<Value> axes() {
22038 int i = optionalInputArguments.indexOf(InputParameter.axes);
22039 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22040 }
22041
22042 public java.util.Optional<Long> noop_with_empty_axes() {
22043 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22044 return java.util.Optional.ofNullable(noop_with_empty_axes);
22045 }
22046
22047 public java.util.Optional<Long> keepdims() {
22048 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22049 return java.util.Optional.ofNullable(keepdims);
22050 }
22051
22052 }
22053
22054 public static ReduceL2 ReduceL2(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22055 return new ReduceL2(resultType, data, axes, noop_with_empty_axes, keepdims);
22056 }
22057
22058 @OpFactoryHelper.OpDeclaration(ReduceLogSum.NAME)
22059 public static final class ReduceLogSum extends OnnxOp {
22060 public static final String NAME = "ReduceLogSum";
22061
22062 public enum Attribute implements OnnxAttribute {
22063 noop_with_empty_axes(Long.class, true, 0),
22064 keepdims(Long.class, true, 1),
22065 ;
22066
22067 final Class<?> t;
22068 final boolean optional;
22069 final Object defaultValue;
22070
22071 Attribute(Class<?> type, boolean optional, Object defaultValue) {
22072 this.t = type;
22073 this.optional = optional;
22074 this.defaultValue = defaultValue;
22075 assert optional || defaultValue == null;
22076 }
22077
22078 public Class<?> type() {
22079 return t;
22080 }
22081
22082 public boolean isOptional() {
22083 return optional;
22084 }
22085
22086 public Object defaultValue() {
22087 return defaultValue;
22088 }
22089 }
22090
22091 public enum TypeConstraint implements OnnxTypeConstraint {
22092 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
22093 ;
22094
22095 final OnnxType.TypeVariable typeVariable;
22096
22097 TypeConstraint(OnnxType.TypeVariable typeVariable) {
22098 assert typeVariable.name().equals(name());
22099 this.typeVariable = typeVariable;
22100 }
22101
22102 @Override
22103 public OnnxType.TypeVariable typeVariable() {
22104 return typeVariable;
22105 }
22106 }
22107
22108 public enum InputParameter implements OnnxParameter {
22109 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22110 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
22111 ;
22112
22113 final OnnxType type;
22114 final Quantifier quantifier;
22115
22116 InputParameter(OnnxType type, Quantifier quantifier) {
22117 this.type = type;
22118 this.quantifier = quantifier;
22119 }
22120
22121 @Override
22122 public OnnxType type() {
22123 return type;
22124 }
22125
22126 @Override
22127 public Quantifier quantifier() {
22128 return quantifier;
22129 }
22130 }
22131
22132 public enum OutputParameter implements OnnxParameter {
22133 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22134 ;
22135
22136 final OnnxType type;
22137 final Quantifier quantifier;
22138
22139 OutputParameter(OnnxType type, Quantifier quantifier) {
22140 this.type = type;
22141 this.quantifier = quantifier;
22142 }
22143
22144 @Override
22145 public OnnxType type() {
22146 return type;
22147 }
22148
22149 @Override
22150 public Quantifier quantifier() {
22151 return quantifier;
22152 }
22153 }
22154
22155 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
22156 NAME,
22157 List.of(Attribute.values()),
22158 List.of(TypeConstraint.values()),
22159 List.of(InputParameter.values()),
22160 List.of(OutputParameter.values())
22161 );
22162
22163 public ReduceLogSum(ExternalizedOp def) {
22164 super(SCHEMA, def);
22165 }
22166
22167 ReduceLogSum(ReduceLogSum that, CodeContext cc) {
22168 super(that, cc);
22169 }
22170
22171 @Override
22172 public ReduceLogSum transform(CodeContext cc, CodeTransformer ot) {
22173 return new ReduceLogSum(this, cc);
22174 }
22175
22176 ReduceLogSum(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22177 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22178 }
22179
22180 @Override
22181 public SequencedSet<OnnxParameter> onnxOutputs() {
22182 return onnxOutputs(SCHEMA);
22183 }
22184
22185 @Override
22186 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22187 return onnxInputs(SCHEMA, List.of(data(), axes()));
22188 }
22189
22190 public Value data() {
22191 return operands().get(0);
22192 }
22193
22194 public java.util.Optional<Value> axes() {
22195 int i = optionalInputArguments.indexOf(InputParameter.axes);
22196 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22197 }
22198
22199 public java.util.Optional<Long> noop_with_empty_axes() {
22200 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22201 return java.util.Optional.ofNullable(noop_with_empty_axes);
22202 }
22203
22204 public java.util.Optional<Long> keepdims() {
22205 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22206 return java.util.Optional.ofNullable(keepdims);
22207 }
22208
22209 }
22210
22211 public static ReduceLogSum ReduceLogSum(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22212 return new ReduceLogSum(resultType, data, axes, noop_with_empty_axes, keepdims);
22213 }
22214
22215 @OpFactoryHelper.OpDeclaration(ReduceLogSumExp.NAME)
22216 public static final class ReduceLogSumExp extends OnnxOp {
22217 public static final String NAME = "ReduceLogSumExp";
22218
22219 public enum Attribute implements OnnxAttribute {
22220 noop_with_empty_axes(Long.class, true, 0),
22221 keepdims(Long.class, true, 1),
22222 ;
22223
22224 final Class<?> t;
22225 final boolean optional;
22226 final Object defaultValue;
22227
22228 Attribute(Class<?> type, boolean optional, Object defaultValue) {
22229 this.t = type;
22230 this.optional = optional;
22231 this.defaultValue = defaultValue;
22232 assert optional || defaultValue == null;
22233 }
22234
22235 public Class<?> type() {
22236 return t;
22237 }
22238
22239 public boolean isOptional() {
22240 return optional;
22241 }
22242
22243 public Object defaultValue() {
22244 return defaultValue;
22245 }
22246 }
22247
22248 public enum TypeConstraint implements OnnxTypeConstraint {
22249 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
22250 ;
22251
22252 final OnnxType.TypeVariable typeVariable;
22253
22254 TypeConstraint(OnnxType.TypeVariable typeVariable) {
22255 assert typeVariable.name().equals(name());
22256 this.typeVariable = typeVariable;
22257 }
22258
22259 @Override
22260 public OnnxType.TypeVariable typeVariable() {
22261 return typeVariable;
22262 }
22263 }
22264
22265 public enum InputParameter implements OnnxParameter {
22266 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22267 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
22268 ;
22269
22270 final OnnxType type;
22271 final Quantifier quantifier;
22272
22273 InputParameter(OnnxType type, Quantifier quantifier) {
22274 this.type = type;
22275 this.quantifier = quantifier;
22276 }
22277
22278 @Override
22279 public OnnxType type() {
22280 return type;
22281 }
22282
22283 @Override
22284 public Quantifier quantifier() {
22285 return quantifier;
22286 }
22287 }
22288
22289 public enum OutputParameter implements OnnxParameter {
22290 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22291 ;
22292
22293 final OnnxType type;
22294 final Quantifier quantifier;
22295
22296 OutputParameter(OnnxType type, Quantifier quantifier) {
22297 this.type = type;
22298 this.quantifier = quantifier;
22299 }
22300
22301 @Override
22302 public OnnxType type() {
22303 return type;
22304 }
22305
22306 @Override
22307 public Quantifier quantifier() {
22308 return quantifier;
22309 }
22310 }
22311
22312 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
22313 NAME,
22314 List.of(Attribute.values()),
22315 List.of(TypeConstraint.values()),
22316 List.of(InputParameter.values()),
22317 List.of(OutputParameter.values())
22318 );
22319
22320 public ReduceLogSumExp(ExternalizedOp def) {
22321 super(SCHEMA, def);
22322 }
22323
22324 ReduceLogSumExp(ReduceLogSumExp that, CodeContext cc) {
22325 super(that, cc);
22326 }
22327
22328 @Override
22329 public ReduceLogSumExp transform(CodeContext cc, CodeTransformer ot) {
22330 return new ReduceLogSumExp(this, cc);
22331 }
22332
22333 ReduceLogSumExp(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22334 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22335 }
22336
22337 @Override
22338 public SequencedSet<OnnxParameter> onnxOutputs() {
22339 return onnxOutputs(SCHEMA);
22340 }
22341
22342 @Override
22343 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22344 return onnxInputs(SCHEMA, List.of(data(), axes()));
22345 }
22346
22347 public Value data() {
22348 return operands().get(0);
22349 }
22350
22351 public java.util.Optional<Value> axes() {
22352 int i = optionalInputArguments.indexOf(InputParameter.axes);
22353 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22354 }
22355
22356 public java.util.Optional<Long> noop_with_empty_axes() {
22357 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22358 return java.util.Optional.ofNullable(noop_with_empty_axes);
22359 }
22360
22361 public java.util.Optional<Long> keepdims() {
22362 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22363 return java.util.Optional.ofNullable(keepdims);
22364 }
22365
22366 }
22367
22368 public static ReduceLogSumExp ReduceLogSumExp(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22369 return new ReduceLogSumExp(resultType, data, axes, noop_with_empty_axes, keepdims);
22370 }
22371
22372 @OpFactoryHelper.OpDeclaration(ReduceMax.NAME)
22373 public static final class ReduceMax extends OnnxOp {
22374 public static final String NAME = "ReduceMax";
22375
22376 public enum Attribute implements OnnxAttribute {
22377 noop_with_empty_axes(Long.class, true, 0),
22378 keepdims(Long.class, true, 1),
22379 ;
22380
22381 final Class<?> t;
22382 final boolean optional;
22383 final Object defaultValue;
22384
22385 Attribute(Class<?> type, boolean optional, Object defaultValue) {
22386 this.t = type;
22387 this.optional = optional;
22388 this.defaultValue = defaultValue;
22389 assert optional || defaultValue == null;
22390 }
22391
22392 public Class<?> type() {
22393 return t;
22394 }
22395
22396 public boolean isOptional() {
22397 return optional;
22398 }
22399
22400 public Object defaultValue() {
22401 return defaultValue;
22402 }
22403 }
22404
22405 public enum TypeConstraint implements OnnxTypeConstraint {
22406 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.bool())))),
22407 ;
22408
22409 final OnnxType.TypeVariable typeVariable;
22410
22411 TypeConstraint(OnnxType.TypeVariable typeVariable) {
22412 assert typeVariable.name().equals(name());
22413 this.typeVariable = typeVariable;
22414 }
22415
22416 @Override
22417 public OnnxType.TypeVariable typeVariable() {
22418 return typeVariable;
22419 }
22420 }
22421
22422 public enum InputParameter implements OnnxParameter {
22423 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22424 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
22425 ;
22426
22427 final OnnxType type;
22428 final Quantifier quantifier;
22429
22430 InputParameter(OnnxType type, Quantifier quantifier) {
22431 this.type = type;
22432 this.quantifier = quantifier;
22433 }
22434
22435 @Override
22436 public OnnxType type() {
22437 return type;
22438 }
22439
22440 @Override
22441 public Quantifier quantifier() {
22442 return quantifier;
22443 }
22444 }
22445
22446 public enum OutputParameter implements OnnxParameter {
22447 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22448 ;
22449
22450 final OnnxType type;
22451 final Quantifier quantifier;
22452
22453 OutputParameter(OnnxType type, Quantifier quantifier) {
22454 this.type = type;
22455 this.quantifier = quantifier;
22456 }
22457
22458 @Override
22459 public OnnxType type() {
22460 return type;
22461 }
22462
22463 @Override
22464 public Quantifier quantifier() {
22465 return quantifier;
22466 }
22467 }
22468
22469 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
22470 NAME,
22471 List.of(Attribute.values()),
22472 List.of(TypeConstraint.values()),
22473 List.of(InputParameter.values()),
22474 List.of(OutputParameter.values())
22475 );
22476
22477 public ReduceMax(ExternalizedOp def) {
22478 super(SCHEMA, def);
22479 }
22480
22481 ReduceMax(ReduceMax that, CodeContext cc) {
22482 super(that, cc);
22483 }
22484
22485 @Override
22486 public ReduceMax transform(CodeContext cc, CodeTransformer ot) {
22487 return new ReduceMax(this, cc);
22488 }
22489
22490 ReduceMax(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22491 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22492 }
22493
22494 @Override
22495 public SequencedSet<OnnxParameter> onnxOutputs() {
22496 return onnxOutputs(SCHEMA);
22497 }
22498
22499 @Override
22500 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22501 return onnxInputs(SCHEMA, List.of(data(), axes()));
22502 }
22503
22504 public Value data() {
22505 return operands().get(0);
22506 }
22507
22508 public java.util.Optional<Value> axes() {
22509 int i = optionalInputArguments.indexOf(InputParameter.axes);
22510 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22511 }
22512
22513 public java.util.Optional<Long> noop_with_empty_axes() {
22514 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22515 return java.util.Optional.ofNullable(noop_with_empty_axes);
22516 }
22517
22518 public java.util.Optional<Long> keepdims() {
22519 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22520 return java.util.Optional.ofNullable(keepdims);
22521 }
22522
22523 }
22524
22525 public static ReduceMax ReduceMax(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22526 return new ReduceMax(resultType, data, axes, noop_with_empty_axes, keepdims);
22527 }
22528
22529 @OpFactoryHelper.OpDeclaration(ReduceMean.NAME)
22530 public static final class ReduceMean extends OnnxOp {
22531 public static final String NAME = "ReduceMean";
22532
22533 public enum Attribute implements OnnxAttribute {
22534 noop_with_empty_axes(Long.class, true, 0),
22535 keepdims(Long.class, true, 1),
22536 ;
22537
22538 final Class<?> t;
22539 final boolean optional;
22540 final Object defaultValue;
22541
22542 Attribute(Class<?> type, boolean optional, Object defaultValue) {
22543 this.t = type;
22544 this.optional = optional;
22545 this.defaultValue = defaultValue;
22546 assert optional || defaultValue == null;
22547 }
22548
22549 public Class<?> type() {
22550 return t;
22551 }
22552
22553 public boolean isOptional() {
22554 return optional;
22555 }
22556
22557 public Object defaultValue() {
22558 return defaultValue;
22559 }
22560 }
22561
22562 public enum TypeConstraint implements OnnxTypeConstraint {
22563 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
22564 ;
22565
22566 final OnnxType.TypeVariable typeVariable;
22567
22568 TypeConstraint(OnnxType.TypeVariable typeVariable) {
22569 assert typeVariable.name().equals(name());
22570 this.typeVariable = typeVariable;
22571 }
22572
22573 @Override
22574 public OnnxType.TypeVariable typeVariable() {
22575 return typeVariable;
22576 }
22577 }
22578
22579 public enum InputParameter implements OnnxParameter {
22580 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22581 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
22582 ;
22583
22584 final OnnxType type;
22585 final Quantifier quantifier;
22586
22587 InputParameter(OnnxType type, Quantifier quantifier) {
22588 this.type = type;
22589 this.quantifier = quantifier;
22590 }
22591
22592 @Override
22593 public OnnxType type() {
22594 return type;
22595 }
22596
22597 @Override
22598 public Quantifier quantifier() {
22599 return quantifier;
22600 }
22601 }
22602
22603 public enum OutputParameter implements OnnxParameter {
22604 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22605 ;
22606
22607 final OnnxType type;
22608 final Quantifier quantifier;
22609
22610 OutputParameter(OnnxType type, Quantifier quantifier) {
22611 this.type = type;
22612 this.quantifier = quantifier;
22613 }
22614
22615 @Override
22616 public OnnxType type() {
22617 return type;
22618 }
22619
22620 @Override
22621 public Quantifier quantifier() {
22622 return quantifier;
22623 }
22624 }
22625
22626 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
22627 NAME,
22628 List.of(Attribute.values()),
22629 List.of(TypeConstraint.values()),
22630 List.of(InputParameter.values()),
22631 List.of(OutputParameter.values())
22632 );
22633
22634 public ReduceMean(ExternalizedOp def) {
22635 super(SCHEMA, def);
22636 }
22637
22638 ReduceMean(ReduceMean that, CodeContext cc) {
22639 super(that, cc);
22640 }
22641
22642 @Override
22643 public ReduceMean transform(CodeContext cc, CodeTransformer ot) {
22644 return new ReduceMean(this, cc);
22645 }
22646
22647 ReduceMean(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22648 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22649 }
22650
22651 @Override
22652 public SequencedSet<OnnxParameter> onnxOutputs() {
22653 return onnxOutputs(SCHEMA);
22654 }
22655
22656 @Override
22657 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22658 return onnxInputs(SCHEMA, List.of(data(), axes()));
22659 }
22660
22661 public Value data() {
22662 return operands().get(0);
22663 }
22664
22665 public java.util.Optional<Value> axes() {
22666 int i = optionalInputArguments.indexOf(InputParameter.axes);
22667 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22668 }
22669
22670 public java.util.Optional<Long> noop_with_empty_axes() {
22671 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22672 return java.util.Optional.ofNullable(noop_with_empty_axes);
22673 }
22674
22675 public java.util.Optional<Long> keepdims() {
22676 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22677 return java.util.Optional.ofNullable(keepdims);
22678 }
22679
22680 }
22681
22682 public static ReduceMean ReduceMean(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22683 return new ReduceMean(resultType, data, axes, noop_with_empty_axes, keepdims);
22684 }
22685
22686 @OpFactoryHelper.OpDeclaration(ReduceMin.NAME)
22687 public static final class ReduceMin extends OnnxOp {
22688 public static final String NAME = "ReduceMin";
22689
22690 public enum Attribute implements OnnxAttribute {
22691 noop_with_empty_axes(Long.class, true, 0),
22692 keepdims(Long.class, true, 1),
22693 ;
22694
22695 final Class<?> t;
22696 final boolean optional;
22697 final Object defaultValue;
22698
22699 Attribute(Class<?> type, boolean optional, Object defaultValue) {
22700 this.t = type;
22701 this.optional = optional;
22702 this.defaultValue = defaultValue;
22703 assert optional || defaultValue == null;
22704 }
22705
22706 public Class<?> type() {
22707 return t;
22708 }
22709
22710 public boolean isOptional() {
22711 return optional;
22712 }
22713
22714 public Object defaultValue() {
22715 return defaultValue;
22716 }
22717 }
22718
22719 public enum TypeConstraint implements OnnxTypeConstraint {
22720 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.bool())))),
22721 ;
22722
22723 final OnnxType.TypeVariable typeVariable;
22724
22725 TypeConstraint(OnnxType.TypeVariable typeVariable) {
22726 assert typeVariable.name().equals(name());
22727 this.typeVariable = typeVariable;
22728 }
22729
22730 @Override
22731 public OnnxType.TypeVariable typeVariable() {
22732 return typeVariable;
22733 }
22734 }
22735
22736 public enum InputParameter implements OnnxParameter {
22737 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22738 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
22739 ;
22740
22741 final OnnxType type;
22742 final Quantifier quantifier;
22743
22744 InputParameter(OnnxType type, Quantifier quantifier) {
22745 this.type = type;
22746 this.quantifier = quantifier;
22747 }
22748
22749 @Override
22750 public OnnxType type() {
22751 return type;
22752 }
22753
22754 @Override
22755 public Quantifier quantifier() {
22756 return quantifier;
22757 }
22758 }
22759
22760 public enum OutputParameter implements OnnxParameter {
22761 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22762 ;
22763
22764 final OnnxType type;
22765 final Quantifier quantifier;
22766
22767 OutputParameter(OnnxType type, Quantifier quantifier) {
22768 this.type = type;
22769 this.quantifier = quantifier;
22770 }
22771
22772 @Override
22773 public OnnxType type() {
22774 return type;
22775 }
22776
22777 @Override
22778 public Quantifier quantifier() {
22779 return quantifier;
22780 }
22781 }
22782
22783 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
22784 NAME,
22785 List.of(Attribute.values()),
22786 List.of(TypeConstraint.values()),
22787 List.of(InputParameter.values()),
22788 List.of(OutputParameter.values())
22789 );
22790
22791 public ReduceMin(ExternalizedOp def) {
22792 super(SCHEMA, def);
22793 }
22794
22795 ReduceMin(ReduceMin that, CodeContext cc) {
22796 super(that, cc);
22797 }
22798
22799 @Override
22800 public ReduceMin transform(CodeContext cc, CodeTransformer ot) {
22801 return new ReduceMin(this, cc);
22802 }
22803
22804 ReduceMin(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22805 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22806 }
22807
22808 @Override
22809 public SequencedSet<OnnxParameter> onnxOutputs() {
22810 return onnxOutputs(SCHEMA);
22811 }
22812
22813 @Override
22814 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22815 return onnxInputs(SCHEMA, List.of(data(), axes()));
22816 }
22817
22818 public Value data() {
22819 return operands().get(0);
22820 }
22821
22822 public java.util.Optional<Value> axes() {
22823 int i = optionalInputArguments.indexOf(InputParameter.axes);
22824 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22825 }
22826
22827 public java.util.Optional<Long> noop_with_empty_axes() {
22828 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22829 return java.util.Optional.ofNullable(noop_with_empty_axes);
22830 }
22831
22832 public java.util.Optional<Long> keepdims() {
22833 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22834 return java.util.Optional.ofNullable(keepdims);
22835 }
22836
22837 }
22838
22839 public static ReduceMin ReduceMin(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22840 return new ReduceMin(resultType, data, axes, noop_with_empty_axes, keepdims);
22841 }
22842
22843 @OpFactoryHelper.OpDeclaration(ReduceProd.NAME)
22844 public static final class ReduceProd extends OnnxOp {
22845 public static final String NAME = "ReduceProd";
22846
22847 public enum Attribute implements OnnxAttribute {
22848 noop_with_empty_axes(Long.class, true, 0),
22849 keepdims(Long.class, true, 1),
22850 ;
22851
22852 final Class<?> t;
22853 final boolean optional;
22854 final Object defaultValue;
22855
22856 Attribute(Class<?> type, boolean optional, Object defaultValue) {
22857 this.t = type;
22858 this.optional = optional;
22859 this.defaultValue = defaultValue;
22860 assert optional || defaultValue == null;
22861 }
22862
22863 public Class<?> type() {
22864 return t;
22865 }
22866
22867 public boolean isOptional() {
22868 return optional;
22869 }
22870
22871 public Object defaultValue() {
22872 return defaultValue;
22873 }
22874 }
22875
22876 public enum TypeConstraint implements OnnxTypeConstraint {
22877 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
22878 ;
22879
22880 final OnnxType.TypeVariable typeVariable;
22881
22882 TypeConstraint(OnnxType.TypeVariable typeVariable) {
22883 assert typeVariable.name().equals(name());
22884 this.typeVariable = typeVariable;
22885 }
22886
22887 @Override
22888 public OnnxType.TypeVariable typeVariable() {
22889 return typeVariable;
22890 }
22891 }
22892
22893 public enum InputParameter implements OnnxParameter {
22894 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22895 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
22896 ;
22897
22898 final OnnxType type;
22899 final Quantifier quantifier;
22900
22901 InputParameter(OnnxType type, Quantifier quantifier) {
22902 this.type = type;
22903 this.quantifier = quantifier;
22904 }
22905
22906 @Override
22907 public OnnxType type() {
22908 return type;
22909 }
22910
22911 @Override
22912 public Quantifier quantifier() {
22913 return quantifier;
22914 }
22915 }
22916
22917 public enum OutputParameter implements OnnxParameter {
22918 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
22919 ;
22920
22921 final OnnxType type;
22922 final Quantifier quantifier;
22923
22924 OutputParameter(OnnxType type, Quantifier quantifier) {
22925 this.type = type;
22926 this.quantifier = quantifier;
22927 }
22928
22929 @Override
22930 public OnnxType type() {
22931 return type;
22932 }
22933
22934 @Override
22935 public Quantifier quantifier() {
22936 return quantifier;
22937 }
22938 }
22939
22940 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
22941 NAME,
22942 List.of(Attribute.values()),
22943 List.of(TypeConstraint.values()),
22944 List.of(InputParameter.values()),
22945 List.of(OutputParameter.values())
22946 );
22947
22948 public ReduceProd(ExternalizedOp def) {
22949 super(SCHEMA, def);
22950 }
22951
22952 ReduceProd(ReduceProd that, CodeContext cc) {
22953 super(that, cc);
22954 }
22955
22956 @Override
22957 public ReduceProd transform(CodeContext cc, CodeTransformer ot) {
22958 return new ReduceProd(this, cc);
22959 }
22960
22961 ReduceProd(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22962 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
22963 }
22964
22965 @Override
22966 public SequencedSet<OnnxParameter> onnxOutputs() {
22967 return onnxOutputs(SCHEMA);
22968 }
22969
22970 @Override
22971 public SequencedMap<OnnxParameter, Object> onnxInputs() {
22972 return onnxInputs(SCHEMA, List.of(data(), axes()));
22973 }
22974
22975 public Value data() {
22976 return operands().get(0);
22977 }
22978
22979 public java.util.Optional<Value> axes() {
22980 int i = optionalInputArguments.indexOf(InputParameter.axes);
22981 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
22982 }
22983
22984 public java.util.Optional<Long> noop_with_empty_axes() {
22985 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
22986 return java.util.Optional.ofNullable(noop_with_empty_axes);
22987 }
22988
22989 public java.util.Optional<Long> keepdims() {
22990 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
22991 return java.util.Optional.ofNullable(keepdims);
22992 }
22993
22994 }
22995
22996 public static ReduceProd ReduceProd(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
22997 return new ReduceProd(resultType, data, axes, noop_with_empty_axes, keepdims);
22998 }
22999
23000 @OpFactoryHelper.OpDeclaration(ReduceSum.NAME)
23001 public static final class ReduceSum extends OnnxOp {
23002 public static final String NAME = "ReduceSum";
23003
23004 public enum Attribute implements OnnxAttribute {
23005 noop_with_empty_axes(Long.class, true, 0),
23006 keepdims(Long.class, true, 1),
23007 ;
23008
23009 final Class<?> t;
23010 final boolean optional;
23011 final Object defaultValue;
23012
23013 Attribute(Class<?> type, boolean optional, Object defaultValue) {
23014 this.t = type;
23015 this.optional = optional;
23016 this.defaultValue = defaultValue;
23017 assert optional || defaultValue == null;
23018 }
23019
23020 public Class<?> type() {
23021 return t;
23022 }
23023
23024 public boolean isOptional() {
23025 return optional;
23026 }
23027
23028 public Object defaultValue() {
23029 return defaultValue;
23030 }
23031 }
23032
23033 public enum TypeConstraint implements OnnxTypeConstraint {
23034 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
23035 ;
23036
23037 final OnnxType.TypeVariable typeVariable;
23038
23039 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23040 assert typeVariable.name().equals(name());
23041 this.typeVariable = typeVariable;
23042 }
23043
23044 @Override
23045 public OnnxType.TypeVariable typeVariable() {
23046 return typeVariable;
23047 }
23048 }
23049
23050 public enum InputParameter implements OnnxParameter {
23051 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23052 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
23053 ;
23054
23055 final OnnxType type;
23056 final Quantifier quantifier;
23057
23058 InputParameter(OnnxType type, Quantifier quantifier) {
23059 this.type = type;
23060 this.quantifier = quantifier;
23061 }
23062
23063 @Override
23064 public OnnxType type() {
23065 return type;
23066 }
23067
23068 @Override
23069 public Quantifier quantifier() {
23070 return quantifier;
23071 }
23072 }
23073
23074 public enum OutputParameter implements OnnxParameter {
23075 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23076 ;
23077
23078 final OnnxType type;
23079 final Quantifier quantifier;
23080
23081 OutputParameter(OnnxType type, Quantifier quantifier) {
23082 this.type = type;
23083 this.quantifier = quantifier;
23084 }
23085
23086 @Override
23087 public OnnxType type() {
23088 return type;
23089 }
23090
23091 @Override
23092 public Quantifier quantifier() {
23093 return quantifier;
23094 }
23095 }
23096
23097 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
23098 NAME,
23099 List.of(Attribute.values()),
23100 List.of(TypeConstraint.values()),
23101 List.of(InputParameter.values()),
23102 List.of(OutputParameter.values())
23103 );
23104
23105 public ReduceSum(ExternalizedOp def) {
23106 super(SCHEMA, def);
23107 }
23108
23109 ReduceSum(ReduceSum that, CodeContext cc) {
23110 super(that, cc);
23111 }
23112
23113 @Override
23114 public ReduceSum transform(CodeContext cc, CodeTransformer ot) {
23115 return new ReduceSum(this, cc);
23116 }
23117
23118 ReduceSum(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
23119 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
23120 }
23121
23122 @Override
23123 public SequencedSet<OnnxParameter> onnxOutputs() {
23124 return onnxOutputs(SCHEMA);
23125 }
23126
23127 @Override
23128 public SequencedMap<OnnxParameter, Object> onnxInputs() {
23129 return onnxInputs(SCHEMA, List.of(data(), axes()));
23130 }
23131
23132 public Value data() {
23133 return operands().get(0);
23134 }
23135
23136 public java.util.Optional<Value> axes() {
23137 int i = optionalInputArguments.indexOf(InputParameter.axes);
23138 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
23139 }
23140
23141 public java.util.Optional<Long> noop_with_empty_axes() {
23142 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
23143 return java.util.Optional.ofNullable(noop_with_empty_axes);
23144 }
23145
23146 public java.util.Optional<Long> keepdims() {
23147 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
23148 return java.util.Optional.ofNullable(keepdims);
23149 }
23150
23151 }
23152
23153 public static ReduceSum ReduceSum(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
23154 return new ReduceSum(resultType, data, axes, noop_with_empty_axes, keepdims);
23155 }
23156
23157 @OpFactoryHelper.OpDeclaration(ReduceSumSquare.NAME)
23158 public static final class ReduceSumSquare extends OnnxOp {
23159 public static final String NAME = "ReduceSumSquare";
23160
23161 public enum Attribute implements OnnxAttribute {
23162 noop_with_empty_axes(Long.class, true, 0),
23163 keepdims(Long.class, true, 1),
23164 ;
23165
23166 final Class<?> t;
23167 final boolean optional;
23168 final Object defaultValue;
23169
23170 Attribute(Class<?> type, boolean optional, Object defaultValue) {
23171 this.t = type;
23172 this.optional = optional;
23173 this.defaultValue = defaultValue;
23174 assert optional || defaultValue == null;
23175 }
23176
23177 public Class<?> type() {
23178 return t;
23179 }
23180
23181 public boolean isOptional() {
23182 return optional;
23183 }
23184
23185 public Object defaultValue() {
23186 return defaultValue;
23187 }
23188 }
23189
23190 public enum TypeConstraint implements OnnxTypeConstraint {
23191 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
23192 ;
23193
23194 final OnnxType.TypeVariable typeVariable;
23195
23196 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23197 assert typeVariable.name().equals(name());
23198 this.typeVariable = typeVariable;
23199 }
23200
23201 @Override
23202 public OnnxType.TypeVariable typeVariable() {
23203 return typeVariable;
23204 }
23205 }
23206
23207 public enum InputParameter implements OnnxParameter {
23208 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23209 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
23210 ;
23211
23212 final OnnxType type;
23213 final Quantifier quantifier;
23214
23215 InputParameter(OnnxType type, Quantifier quantifier) {
23216 this.type = type;
23217 this.quantifier = quantifier;
23218 }
23219
23220 @Override
23221 public OnnxType type() {
23222 return type;
23223 }
23224
23225 @Override
23226 public Quantifier quantifier() {
23227 return quantifier;
23228 }
23229 }
23230
23231 public enum OutputParameter implements OnnxParameter {
23232 reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23233 ;
23234
23235 final OnnxType type;
23236 final Quantifier quantifier;
23237
23238 OutputParameter(OnnxType type, Quantifier quantifier) {
23239 this.type = type;
23240 this.quantifier = quantifier;
23241 }
23242
23243 @Override
23244 public OnnxType type() {
23245 return type;
23246 }
23247
23248 @Override
23249 public Quantifier quantifier() {
23250 return quantifier;
23251 }
23252 }
23253
23254 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
23255 NAME,
23256 List.of(Attribute.values()),
23257 List.of(TypeConstraint.values()),
23258 List.of(InputParameter.values()),
23259 List.of(OutputParameter.values())
23260 );
23261
23262 public ReduceSumSquare(ExternalizedOp def) {
23263 super(SCHEMA, def);
23264 }
23265
23266 ReduceSumSquare(ReduceSumSquare that, CodeContext cc) {
23267 super(that, cc);
23268 }
23269
23270 @Override
23271 public ReduceSumSquare transform(CodeContext cc, CodeTransformer ot) {
23272 return new ReduceSumSquare(this, cc);
23273 }
23274
23275 ReduceSumSquare(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
23276 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims));
23277 }
23278
23279 @Override
23280 public SequencedSet<OnnxParameter> onnxOutputs() {
23281 return onnxOutputs(SCHEMA);
23282 }
23283
23284 @Override
23285 public SequencedMap<OnnxParameter, Object> onnxInputs() {
23286 return onnxInputs(SCHEMA, List.of(data(), axes()));
23287 }
23288
23289 public Value data() {
23290 return operands().get(0);
23291 }
23292
23293 public java.util.Optional<Value> axes() {
23294 int i = optionalInputArguments.indexOf(InputParameter.axes);
23295 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
23296 }
23297
23298 public java.util.Optional<Long> noop_with_empty_axes() {
23299 Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes);
23300 return java.util.Optional.ofNullable(noop_with_empty_axes);
23301 }
23302
23303 public java.util.Optional<Long> keepdims() {
23304 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
23305 return java.util.Optional.ofNullable(keepdims);
23306 }
23307
23308 }
23309
23310 public static ReduceSumSquare ReduceSumSquare(CodeType resultType, Value data, java.util.Optional<Value> axes, java.util.Optional<Long> noop_with_empty_axes, java.util.Optional<Long> keepdims) {
23311 return new ReduceSumSquare(resultType, data, axes, noop_with_empty_axes, keepdims);
23312 }
23313
23314 @OpFactoryHelper.OpDeclaration(RegexFullMatch.NAME)
23315 public static final class RegexFullMatch extends OnnxOp {
23316 public static final String NAME = "RegexFullMatch";
23317
23318 public enum Attribute implements OnnxAttribute {
23319 pattern(String.class, true, null),
23320 ;
23321
23322 final Class<?> t;
23323 final boolean optional;
23324 final Object defaultValue;
23325
23326 Attribute(Class<?> type, boolean optional, Object defaultValue) {
23327 this.t = type;
23328 this.optional = optional;
23329 this.defaultValue = defaultValue;
23330 assert optional || defaultValue == null;
23331 }
23332
23333 public Class<?> type() {
23334 return t;
23335 }
23336
23337 public boolean isOptional() {
23338 return optional;
23339 }
23340
23341 public Object defaultValue() {
23342 return defaultValue;
23343 }
23344 }
23345
23346 public enum TypeConstraint implements OnnxTypeConstraint {
23347 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string())))),
23348 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))),
23349 ;
23350
23351 final OnnxType.TypeVariable typeVariable;
23352
23353 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23354 assert typeVariable.name().equals(name());
23355 this.typeVariable = typeVariable;
23356 }
23357
23358 @Override
23359 public OnnxType.TypeVariable typeVariable() {
23360 return typeVariable;
23361 }
23362 }
23363
23364 public enum InputParameter implements OnnxParameter {
23365 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
23366 ;
23367
23368 final OnnxType type;
23369 final Quantifier quantifier;
23370
23371 InputParameter(OnnxType type, Quantifier quantifier) {
23372 this.type = type;
23373 this.quantifier = quantifier;
23374 }
23375
23376 @Override
23377 public OnnxType type() {
23378 return type;
23379 }
23380
23381 @Override
23382 public Quantifier quantifier() {
23383 return quantifier;
23384 }
23385 }
23386
23387 public enum OutputParameter implements OnnxParameter {
23388 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
23389 ;
23390
23391 final OnnxType type;
23392 final Quantifier quantifier;
23393
23394 OutputParameter(OnnxType type, Quantifier quantifier) {
23395 this.type = type;
23396 this.quantifier = quantifier;
23397 }
23398
23399 @Override
23400 public OnnxType type() {
23401 return type;
23402 }
23403
23404 @Override
23405 public Quantifier quantifier() {
23406 return quantifier;
23407 }
23408 }
23409
23410 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
23411 NAME,
23412 List.of(Attribute.values()),
23413 List.of(TypeConstraint.values()),
23414 List.of(InputParameter.values()),
23415 List.of(OutputParameter.values())
23416 );
23417
23418 public RegexFullMatch(ExternalizedOp def) {
23419 super(SCHEMA, def);
23420 }
23421
23422 RegexFullMatch(RegexFullMatch that, CodeContext cc) {
23423 super(that, cc);
23424 }
23425
23426 @Override
23427 public RegexFullMatch transform(CodeContext cc, CodeTransformer ot) {
23428 return new RegexFullMatch(this, cc);
23429 }
23430
23431 RegexFullMatch(CodeType resultType, Value X, java.util.Optional<String> pattern) {
23432 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(pattern));
23433 }
23434
23435 @Override
23436 public SequencedSet<OnnxParameter> onnxOutputs() {
23437 return onnxOutputs(SCHEMA);
23438 }
23439
23440 @Override
23441 public SequencedMap<OnnxParameter, Object> onnxInputs() {
23442 return onnxInputs(SCHEMA, List.of(X()));
23443 }
23444
23445 public Value X() {
23446 return operands().get(0);
23447 }
23448
23449 public java.util.Optional<String> pattern() {
23450 String pattern = Attribute.pattern.access(String.class, onnxAttributes);
23451 return java.util.Optional.ofNullable(pattern);
23452 }
23453
23454 }
23455
23456 public static RegexFullMatch RegexFullMatch(CodeType resultType, Value X, java.util.Optional<String> pattern) {
23457 return new RegexFullMatch(resultType, X, pattern);
23458 }
23459
23460 @OpFactoryHelper.OpDeclaration(Relu.NAME)
23461 public static final class Relu extends OnnxOp {
23462 public static final String NAME = "Relu";
23463
23464 public enum Attribute implements OnnxAttribute.None { }
23465
23466 public enum TypeConstraint implements OnnxTypeConstraint {
23467 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
23468 ;
23469
23470 final OnnxType.TypeVariable typeVariable;
23471
23472 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23473 assert typeVariable.name().equals(name());
23474 this.typeVariable = typeVariable;
23475 }
23476
23477 @Override
23478 public OnnxType.TypeVariable typeVariable() {
23479 return typeVariable;
23480 }
23481 }
23482
23483 public enum InputParameter implements OnnxParameter {
23484 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23485 ;
23486
23487 final OnnxType type;
23488 final Quantifier quantifier;
23489
23490 InputParameter(OnnxType type, Quantifier quantifier) {
23491 this.type = type;
23492 this.quantifier = quantifier;
23493 }
23494
23495 @Override
23496 public OnnxType type() {
23497 return type;
23498 }
23499
23500 @Override
23501 public Quantifier quantifier() {
23502 return quantifier;
23503 }
23504 }
23505
23506 public enum OutputParameter implements OnnxParameter {
23507 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23508 ;
23509
23510 final OnnxType type;
23511 final Quantifier quantifier;
23512
23513 OutputParameter(OnnxType type, Quantifier quantifier) {
23514 this.type = type;
23515 this.quantifier = quantifier;
23516 }
23517
23518 @Override
23519 public OnnxType type() {
23520 return type;
23521 }
23522
23523 @Override
23524 public Quantifier quantifier() {
23525 return quantifier;
23526 }
23527 }
23528
23529 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
23530 NAME,
23531 List.of(Attribute.values()),
23532 List.of(TypeConstraint.values()),
23533 List.of(InputParameter.values()),
23534 List.of(OutputParameter.values())
23535 );
23536
23537 public Relu(ExternalizedOp def) {
23538 super(SCHEMA, def);
23539 }
23540
23541 Relu(Relu that, CodeContext cc) {
23542 super(that, cc);
23543 }
23544
23545 @Override
23546 public Relu transform(CodeContext cc, CodeTransformer ot) {
23547 return new Relu(this, cc);
23548 }
23549
23550 Relu(CodeType resultType, Value X) {
23551 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
23552 }
23553
23554 @Override
23555 public SequencedSet<OnnxParameter> onnxOutputs() {
23556 return onnxOutputs(SCHEMA);
23557 }
23558
23559 @Override
23560 public SequencedMap<OnnxParameter, Object> onnxInputs() {
23561 return onnxInputs(SCHEMA, List.of(X()));
23562 }
23563
23564 public Value X() {
23565 return operands().get(0);
23566 }
23567
23568 }
23569
23570 public static Relu Relu(CodeType resultType, Value X) {
23571 return new Relu(resultType, X);
23572 }
23573
23574 @OpFactoryHelper.OpDeclaration(Reshape.NAME)
23575 public static final class Reshape extends OnnxOp {
23576 public static final String NAME = "Reshape";
23577
23578 public enum Attribute implements OnnxAttribute {
23579 allowzero(Long.class, true, 0),
23580 ;
23581
23582 final Class<?> t;
23583 final boolean optional;
23584 final Object defaultValue;
23585
23586 Attribute(Class<?> type, boolean optional, Object defaultValue) {
23587 this.t = type;
23588 this.optional = optional;
23589 this.defaultValue = defaultValue;
23590 assert optional || defaultValue == null;
23591 }
23592
23593 public Class<?> type() {
23594 return t;
23595 }
23596
23597 public boolean isOptional() {
23598 return optional;
23599 }
23600
23601 public Object defaultValue() {
23602 return defaultValue;
23603 }
23604 }
23605
23606 public enum TypeConstraint implements OnnxTypeConstraint {
23607 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
23608 ;
23609
23610 final OnnxType.TypeVariable typeVariable;
23611
23612 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23613 assert typeVariable.name().equals(name());
23614 this.typeVariable = typeVariable;
23615 }
23616
23617 @Override
23618 public OnnxType.TypeVariable typeVariable() {
23619 return typeVariable;
23620 }
23621 }
23622
23623 public enum InputParameter implements OnnxParameter {
23624 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23625 shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
23626 ;
23627
23628 final OnnxType type;
23629 final Quantifier quantifier;
23630
23631 InputParameter(OnnxType type, Quantifier quantifier) {
23632 this.type = type;
23633 this.quantifier = quantifier;
23634 }
23635
23636 @Override
23637 public OnnxType type() {
23638 return type;
23639 }
23640
23641 @Override
23642 public Quantifier quantifier() {
23643 return quantifier;
23644 }
23645 }
23646
23647 public enum OutputParameter implements OnnxParameter {
23648 reshaped(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23649 ;
23650
23651 final OnnxType type;
23652 final Quantifier quantifier;
23653
23654 OutputParameter(OnnxType type, Quantifier quantifier) {
23655 this.type = type;
23656 this.quantifier = quantifier;
23657 }
23658
23659 @Override
23660 public OnnxType type() {
23661 return type;
23662 }
23663
23664 @Override
23665 public Quantifier quantifier() {
23666 return quantifier;
23667 }
23668 }
23669
23670 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
23671 NAME,
23672 List.of(Attribute.values()),
23673 List.of(TypeConstraint.values()),
23674 List.of(InputParameter.values()),
23675 List.of(OutputParameter.values())
23676 );
23677
23678 public Reshape(ExternalizedOp def) {
23679 super(SCHEMA, def);
23680 }
23681
23682 Reshape(Reshape that, CodeContext cc) {
23683 super(that, cc);
23684 }
23685
23686 @Override
23687 public Reshape transform(CodeContext cc, CodeTransformer ot) {
23688 return new Reshape(this, cc);
23689 }
23690
23691 Reshape(CodeType resultType, Value data, Value shape, java.util.Optional<Long> allowzero) {
23692 super(SCHEMA, resultType, Set.of(), List.of(data, shape), List.of(allowzero));
23693 }
23694
23695 @Override
23696 public SequencedSet<OnnxParameter> onnxOutputs() {
23697 return onnxOutputs(SCHEMA);
23698 }
23699
23700 @Override
23701 public SequencedMap<OnnxParameter, Object> onnxInputs() {
23702 return onnxInputs(SCHEMA, List.of(data(), shape()));
23703 }
23704
23705 public Value data() {
23706 return operands().get(0);
23707 }
23708
23709 public Value shape() {
23710 return operands().get(1);
23711 }
23712
23713 public java.util.Optional<Long> allowzero() {
23714 Long allowzero = Attribute.allowzero.access(Long.class, onnxAttributes);
23715 return java.util.Optional.ofNullable(allowzero);
23716 }
23717
23718 }
23719
23720 public static Reshape Reshape(CodeType resultType, Value data, Value shape, java.util.Optional<Long> allowzero) {
23721 return new Reshape(resultType, data, shape, allowzero);
23722 }
23723
23724 @OpFactoryHelper.OpDeclaration(Resize.NAME)
23725 public static final class Resize extends OnnxOp {
23726 public static final String NAME = "Resize";
23727
23728 public enum Attribute implements OnnxAttribute {
23729 mode(String.class, true, "nearest"),
23730 extrapolation_value(Float.class, true, 0.0f),
23731 nearest_mode(String.class, true, "round_prefer_floor"),
23732 antialias(Long.class, true, 0),
23733 cubic_coeff_a(Float.class, true, -0.75f),
23734 axes(long[].class, true, null),
23735 coordinate_transformation_mode(String.class, true, "half_pixel"),
23736 keep_aspect_ratio_policy(String.class, true, "stretch"),
23737 exclude_outside(Long.class, true, 0),
23738 ;
23739
23740 final Class<?> t;
23741 final boolean optional;
23742 final Object defaultValue;
23743
23744 Attribute(Class<?> type, boolean optional, Object defaultValue) {
23745 this.t = type;
23746 this.optional = optional;
23747 this.defaultValue = defaultValue;
23748 assert optional || defaultValue == null;
23749 }
23750
23751 public Class<?> type() {
23752 return t;
23753 }
23754
23755 public boolean isOptional() {
23756 return optional;
23757 }
23758
23759 public Object defaultValue() {
23760 return defaultValue;
23761 }
23762 }
23763
23764 public enum TypeConstraint implements OnnxTypeConstraint {
23765 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
23766 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
23767 ;
23768
23769 final OnnxType.TypeVariable typeVariable;
23770
23771 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23772 assert typeVariable.name().equals(name());
23773 this.typeVariable = typeVariable;
23774 }
23775
23776 @Override
23777 public OnnxType.TypeVariable typeVariable() {
23778 return typeVariable;
23779 }
23780 }
23781
23782 public enum InputParameter implements OnnxParameter {
23783 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
23784 roi(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
23785 scales(OnnxType.tensor(OnnxType.float32()), Quantifier.OPTIONAL),
23786 sizes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
23787 ;
23788
23789 final OnnxType type;
23790 final Quantifier quantifier;
23791
23792 InputParameter(OnnxType type, Quantifier quantifier) {
23793 this.type = type;
23794 this.quantifier = quantifier;
23795 }
23796
23797 @Override
23798 public OnnxType type() {
23799 return type;
23800 }
23801
23802 @Override
23803 public Quantifier quantifier() {
23804 return quantifier;
23805 }
23806 }
23807
23808 public enum OutputParameter implements OnnxParameter {
23809 Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
23810 ;
23811
23812 final OnnxType type;
23813 final Quantifier quantifier;
23814
23815 OutputParameter(OnnxType type, Quantifier quantifier) {
23816 this.type = type;
23817 this.quantifier = quantifier;
23818 }
23819
23820 @Override
23821 public OnnxType type() {
23822 return type;
23823 }
23824
23825 @Override
23826 public Quantifier quantifier() {
23827 return quantifier;
23828 }
23829 }
23830
23831 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
23832 NAME,
23833 List.of(Attribute.values()),
23834 List.of(TypeConstraint.values()),
23835 List.of(InputParameter.values()),
23836 List.of(OutputParameter.values())
23837 );
23838
23839 public Resize(ExternalizedOp def) {
23840 super(SCHEMA, def);
23841 }
23842
23843 Resize(Resize that, CodeContext cc) {
23844 super(that, cc);
23845 }
23846
23847 @Override
23848 public Resize transform(CodeContext cc, CodeTransformer ot) {
23849 return new Resize(this, cc);
23850 }
23851
23852 Resize(CodeType resultType, Value X, java.util.Optional<Value> roi, java.util.Optional<Value> scales, java.util.Optional<Value> sizes, java.util.Optional<String> mode, java.util.Optional<Float> extrapolation_value, java.util.Optional<String> nearest_mode, java.util.Optional<Long> antialias, java.util.Optional<Float> cubic_coeff_a, java.util.Optional<long[]> axes, java.util.Optional<String> coordinate_transformation_mode, java.util.Optional<String> keep_aspect_ratio_policy, java.util.Optional<Long> exclude_outside) {
23853 super(SCHEMA, resultType, Set.of(), List.of(X, roi, scales, sizes), List.of(mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside));
23854 }
23855
23856 @Override
23857 public SequencedSet<OnnxParameter> onnxOutputs() {
23858 return onnxOutputs(SCHEMA);
23859 }
23860
23861 @Override
23862 public SequencedMap<OnnxParameter, Object> onnxInputs() {
23863 return onnxInputs(SCHEMA, List.of(X(), roi(), scales(), sizes()));
23864 }
23865
23866 public Value X() {
23867 return operands().get(0);
23868 }
23869
23870 public java.util.Optional<Value> roi() {
23871 int i = optionalInputArguments.indexOf(InputParameter.roi);
23872 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
23873 }
23874
23875 public java.util.Optional<Value> scales() {
23876 int i = optionalInputArguments.indexOf(InputParameter.scales);
23877 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
23878 }
23879
23880 public java.util.Optional<Value> sizes() {
23881 int i = optionalInputArguments.indexOf(InputParameter.sizes);
23882 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
23883 }
23884
23885 public java.util.Optional<String> mode() {
23886 String mode = Attribute.mode.access(String.class, onnxAttributes);
23887 return java.util.Optional.ofNullable(mode);
23888 }
23889
23890 public java.util.Optional<Float> extrapolation_value() {
23891 Float extrapolation_value = Attribute.extrapolation_value.access(Float.class, onnxAttributes);
23892 return java.util.Optional.ofNullable(extrapolation_value);
23893 }
23894
23895 public java.util.Optional<String> nearest_mode() {
23896 String nearest_mode = Attribute.nearest_mode.access(String.class, onnxAttributes);
23897 return java.util.Optional.ofNullable(nearest_mode);
23898 }
23899
23900 public java.util.Optional<Long> antialias() {
23901 Long antialias = Attribute.antialias.access(Long.class, onnxAttributes);
23902 return java.util.Optional.ofNullable(antialias);
23903 }
23904
23905 public java.util.Optional<Float> cubic_coeff_a() {
23906 Float cubic_coeff_a = Attribute.cubic_coeff_a.access(Float.class, onnxAttributes);
23907 return java.util.Optional.ofNullable(cubic_coeff_a);
23908 }
23909
23910 public java.util.Optional<long[]> axes() {
23911 long[] axes = Attribute.axes.access(long[].class, onnxAttributes);
23912 return java.util.Optional.ofNullable(axes).map(long[]::clone);
23913 }
23914
23915 public java.util.Optional<String> coordinate_transformation_mode() {
23916 String coordinate_transformation_mode = Attribute.coordinate_transformation_mode.access(String.class, onnxAttributes);
23917 return java.util.Optional.ofNullable(coordinate_transformation_mode);
23918 }
23919
23920 public java.util.Optional<String> keep_aspect_ratio_policy() {
23921 String keep_aspect_ratio_policy = Attribute.keep_aspect_ratio_policy.access(String.class, onnxAttributes);
23922 return java.util.Optional.ofNullable(keep_aspect_ratio_policy);
23923 }
23924
23925 public java.util.Optional<Long> exclude_outside() {
23926 Long exclude_outside = Attribute.exclude_outside.access(Long.class, onnxAttributes);
23927 return java.util.Optional.ofNullable(exclude_outside);
23928 }
23929
23930 }
23931
23932 public static Resize Resize(CodeType resultType, Value X, java.util.Optional<Value> roi, java.util.Optional<Value> scales, java.util.Optional<Value> sizes, java.util.Optional<String> mode, java.util.Optional<Float> extrapolation_value, java.util.Optional<String> nearest_mode, java.util.Optional<Long> antialias, java.util.Optional<Float> cubic_coeff_a, java.util.Optional<long[]> axes, java.util.Optional<String> coordinate_transformation_mode, java.util.Optional<String> keep_aspect_ratio_policy, java.util.Optional<Long> exclude_outside) {
23933 return new Resize(resultType, X, roi, scales, sizes, mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside);
23934 }
23935
23936 @OpFactoryHelper.OpDeclaration(ReverseSequence.NAME)
23937 public static final class ReverseSequence extends OnnxOp {
23938 public static final String NAME = "ReverseSequence";
23939
23940 public enum Attribute implements OnnxAttribute {
23941 time_axis(Long.class, true, 0),
23942 batch_axis(Long.class, true, 1),
23943 ;
23944
23945 final Class<?> t;
23946 final boolean optional;
23947 final Object defaultValue;
23948
23949 Attribute(Class<?> type, boolean optional, Object defaultValue) {
23950 this.t = type;
23951 this.optional = optional;
23952 this.defaultValue = defaultValue;
23953 assert optional || defaultValue == null;
23954 }
23955
23956 public Class<?> type() {
23957 return t;
23958 }
23959
23960 public boolean isOptional() {
23961 return optional;
23962 }
23963
23964 public Object defaultValue() {
23965 return defaultValue;
23966 }
23967 }
23968
23969 public enum TypeConstraint implements OnnxTypeConstraint {
23970 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
23971 ;
23972
23973 final OnnxType.TypeVariable typeVariable;
23974
23975 TypeConstraint(OnnxType.TypeVariable typeVariable) {
23976 assert typeVariable.name().equals(name());
23977 this.typeVariable = typeVariable;
23978 }
23979
23980 @Override
23981 public OnnxType.TypeVariable typeVariable() {
23982 return typeVariable;
23983 }
23984 }
23985
23986 public enum InputParameter implements OnnxParameter {
23987 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
23988 sequence_lens(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
23989 ;
23990
23991 final OnnxType type;
23992 final Quantifier quantifier;
23993
23994 InputParameter(OnnxType type, Quantifier quantifier) {
23995 this.type = type;
23996 this.quantifier = quantifier;
23997 }
23998
23999 @Override
24000 public OnnxType type() {
24001 return type;
24002 }
24003
24004 @Override
24005 public Quantifier quantifier() {
24006 return quantifier;
24007 }
24008 }
24009
24010 public enum OutputParameter implements OnnxParameter {
24011 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24012 ;
24013
24014 final OnnxType type;
24015 final Quantifier quantifier;
24016
24017 OutputParameter(OnnxType type, Quantifier quantifier) {
24018 this.type = type;
24019 this.quantifier = quantifier;
24020 }
24021
24022 @Override
24023 public OnnxType type() {
24024 return type;
24025 }
24026
24027 @Override
24028 public Quantifier quantifier() {
24029 return quantifier;
24030 }
24031 }
24032
24033 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
24034 NAME,
24035 List.of(Attribute.values()),
24036 List.of(TypeConstraint.values()),
24037 List.of(InputParameter.values()),
24038 List.of(OutputParameter.values())
24039 );
24040
24041 public ReverseSequence(ExternalizedOp def) {
24042 super(SCHEMA, def);
24043 }
24044
24045 ReverseSequence(ReverseSequence that, CodeContext cc) {
24046 super(that, cc);
24047 }
24048
24049 @Override
24050 public ReverseSequence transform(CodeContext cc, CodeTransformer ot) {
24051 return new ReverseSequence(this, cc);
24052 }
24053
24054 ReverseSequence(CodeType resultType, Value input, Value sequence_lens, java.util.Optional<Long> time_axis, java.util.Optional<Long> batch_axis) {
24055 super(SCHEMA, resultType, Set.of(), List.of(input, sequence_lens), List.of(time_axis, batch_axis));
24056 }
24057
24058 @Override
24059 public SequencedSet<OnnxParameter> onnxOutputs() {
24060 return onnxOutputs(SCHEMA);
24061 }
24062
24063 @Override
24064 public SequencedMap<OnnxParameter, Object> onnxInputs() {
24065 return onnxInputs(SCHEMA, List.of(input(), sequence_lens()));
24066 }
24067
24068 public Value input() {
24069 return operands().get(0);
24070 }
24071
24072 public Value sequence_lens() {
24073 return operands().get(1);
24074 }
24075
24076 public java.util.Optional<Long> time_axis() {
24077 Long time_axis = Attribute.time_axis.access(Long.class, onnxAttributes);
24078 return java.util.Optional.ofNullable(time_axis);
24079 }
24080
24081 public java.util.Optional<Long> batch_axis() {
24082 Long batch_axis = Attribute.batch_axis.access(Long.class, onnxAttributes);
24083 return java.util.Optional.ofNullable(batch_axis);
24084 }
24085
24086 }
24087
24088 public static ReverseSequence ReverseSequence(CodeType resultType, Value input, Value sequence_lens, java.util.Optional<Long> time_axis, java.util.Optional<Long> batch_axis) {
24089 return new ReverseSequence(resultType, input, sequence_lens, time_axis, batch_axis);
24090 }
24091
24092 @OpFactoryHelper.OpDeclaration(RoiAlign.NAME)
24093 public static final class RoiAlign extends OnnxOp {
24094 public static final String NAME = "RoiAlign";
24095
24096 public enum Attribute implements OnnxAttribute {
24097 mode(String.class, true, "avg"),
24098 output_width(Long.class, true, 1),
24099 spatial_scale(Float.class, true, 1.0f),
24100 coordinate_transformation_mode(String.class, true, "half_pixel"),
24101 sampling_ratio(Long.class, true, 0),
24102 output_height(Long.class, true, 1),
24103 ;
24104
24105 final Class<?> t;
24106 final boolean optional;
24107 final Object defaultValue;
24108
24109 Attribute(Class<?> type, boolean optional, Object defaultValue) {
24110 this.t = type;
24111 this.optional = optional;
24112 this.defaultValue = defaultValue;
24113 assert optional || defaultValue == null;
24114 }
24115
24116 public Class<?> type() {
24117 return t;
24118 }
24119
24120 public boolean isOptional() {
24121 return optional;
24122 }
24123
24124 public Object defaultValue() {
24125 return defaultValue;
24126 }
24127 }
24128
24129 public enum TypeConstraint implements OnnxTypeConstraint {
24130 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
24131 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))),
24132 ;
24133
24134 final OnnxType.TypeVariable typeVariable;
24135
24136 TypeConstraint(OnnxType.TypeVariable typeVariable) {
24137 assert typeVariable.name().equals(name());
24138 this.typeVariable = typeVariable;
24139 }
24140
24141 @Override
24142 public OnnxType.TypeVariable typeVariable() {
24143 return typeVariable;
24144 }
24145 }
24146
24147 public enum InputParameter implements OnnxParameter {
24148 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
24149 rois(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
24150 batch_indices(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
24151 ;
24152
24153 final OnnxType type;
24154 final Quantifier quantifier;
24155
24156 InputParameter(OnnxType type, Quantifier quantifier) {
24157 this.type = type;
24158 this.quantifier = quantifier;
24159 }
24160
24161 @Override
24162 public OnnxType type() {
24163 return type;
24164 }
24165
24166 @Override
24167 public Quantifier quantifier() {
24168 return quantifier;
24169 }
24170 }
24171
24172 public enum OutputParameter implements OnnxParameter {
24173 Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
24174 ;
24175
24176 final OnnxType type;
24177 final Quantifier quantifier;
24178
24179 OutputParameter(OnnxType type, Quantifier quantifier) {
24180 this.type = type;
24181 this.quantifier = quantifier;
24182 }
24183
24184 @Override
24185 public OnnxType type() {
24186 return type;
24187 }
24188
24189 @Override
24190 public Quantifier quantifier() {
24191 return quantifier;
24192 }
24193 }
24194
24195 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
24196 NAME,
24197 List.of(Attribute.values()),
24198 List.of(TypeConstraint.values()),
24199 List.of(InputParameter.values()),
24200 List.of(OutputParameter.values())
24201 );
24202
24203 public RoiAlign(ExternalizedOp def) {
24204 super(SCHEMA, def);
24205 }
24206
24207 RoiAlign(RoiAlign that, CodeContext cc) {
24208 super(that, cc);
24209 }
24210
24211 @Override
24212 public RoiAlign transform(CodeContext cc, CodeTransformer ot) {
24213 return new RoiAlign(this, cc);
24214 }
24215
24216 RoiAlign(CodeType resultType, Value X, Value rois, Value batch_indices, java.util.Optional<String> mode, java.util.Optional<Long> output_width, java.util.Optional<Float> spatial_scale, java.util.Optional<String> coordinate_transformation_mode, java.util.Optional<Long> sampling_ratio, java.util.Optional<Long> output_height) {
24217 super(SCHEMA, resultType, Set.of(), List.of(X, rois, batch_indices), List.of(mode, output_width, spatial_scale, coordinate_transformation_mode, sampling_ratio, output_height));
24218 }
24219
24220 @Override
24221 public SequencedSet<OnnxParameter> onnxOutputs() {
24222 return onnxOutputs(SCHEMA);
24223 }
24224
24225 @Override
24226 public SequencedMap<OnnxParameter, Object> onnxInputs() {
24227 return onnxInputs(SCHEMA, List.of(X(), rois(), batch_indices()));
24228 }
24229
24230 public Value X() {
24231 return operands().get(0);
24232 }
24233
24234 public Value rois() {
24235 return operands().get(1);
24236 }
24237
24238 public Value batch_indices() {
24239 return operands().get(2);
24240 }
24241
24242 public java.util.Optional<String> mode() {
24243 String mode = Attribute.mode.access(String.class, onnxAttributes);
24244 return java.util.Optional.ofNullable(mode);
24245 }
24246
24247 public java.util.Optional<Long> output_width() {
24248 Long output_width = Attribute.output_width.access(Long.class, onnxAttributes);
24249 return java.util.Optional.ofNullable(output_width);
24250 }
24251
24252 public java.util.Optional<Float> spatial_scale() {
24253 Float spatial_scale = Attribute.spatial_scale.access(Float.class, onnxAttributes);
24254 return java.util.Optional.ofNullable(spatial_scale);
24255 }
24256
24257 public java.util.Optional<String> coordinate_transformation_mode() {
24258 String coordinate_transformation_mode = Attribute.coordinate_transformation_mode.access(String.class, onnxAttributes);
24259 return java.util.Optional.ofNullable(coordinate_transformation_mode);
24260 }
24261
24262 public java.util.Optional<Long> sampling_ratio() {
24263 Long sampling_ratio = Attribute.sampling_ratio.access(Long.class, onnxAttributes);
24264 return java.util.Optional.ofNullable(sampling_ratio);
24265 }
24266
24267 public java.util.Optional<Long> output_height() {
24268 Long output_height = Attribute.output_height.access(Long.class, onnxAttributes);
24269 return java.util.Optional.ofNullable(output_height);
24270 }
24271
24272 }
24273
24274 public static RoiAlign RoiAlign(CodeType resultType, Value X, Value rois, Value batch_indices, java.util.Optional<String> mode, java.util.Optional<Long> output_width, java.util.Optional<Float> spatial_scale, java.util.Optional<String> coordinate_transformation_mode, java.util.Optional<Long> sampling_ratio, java.util.Optional<Long> output_height) {
24275 return new RoiAlign(resultType, X, rois, batch_indices, mode, output_width, spatial_scale, coordinate_transformation_mode, sampling_ratio, output_height);
24276 }
24277
24278 @OpFactoryHelper.OpDeclaration(RotaryEmbedding.NAME)
24279 public static final class RotaryEmbedding extends OnnxOp {
24280 public static final String NAME = "RotaryEmbedding";
24281
24282 public enum Attribute implements OnnxAttribute {
24283 num_heads(Long.class, true, null),
24284 rotary_embedding_dim(Long.class, true, 0),
24285 interleaved(Long.class, true, 0),
24286 ;
24287
24288 final Class<?> t;
24289 final boolean optional;
24290 final Object defaultValue;
24291
24292 Attribute(Class<?> type, boolean optional, Object defaultValue) {
24293 this.t = type;
24294 this.optional = optional;
24295 this.defaultValue = defaultValue;
24296 assert optional || defaultValue == null;
24297 }
24298
24299 public Class<?> type() {
24300 return t;
24301 }
24302
24303 public boolean isOptional() {
24304 return optional;
24305 }
24306
24307 public Object defaultValue() {
24308 return defaultValue;
24309 }
24310 }
24311
24312 public enum TypeConstraint implements OnnxTypeConstraint {
24313 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))),
24314 M(new OnnxType.TypeVariable("M", List.of(OnnxType.tensor(OnnxType.int64())))),
24315 ;
24316
24317 final OnnxType.TypeVariable typeVariable;
24318
24319 TypeConstraint(OnnxType.TypeVariable typeVariable) {
24320 assert typeVariable.name().equals(name());
24321 this.typeVariable = typeVariable;
24322 }
24323
24324 @Override
24325 public OnnxType.TypeVariable typeVariable() {
24326 return typeVariable;
24327 }
24328 }
24329
24330 public enum InputParameter implements OnnxParameter {
24331 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24332 cos_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24333 sin_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24334 position_ids(TypeConstraint.M.typeVariable(), Quantifier.OPTIONAL),
24335 ;
24336
24337 final OnnxType type;
24338 final Quantifier quantifier;
24339
24340 InputParameter(OnnxType type, Quantifier quantifier) {
24341 this.type = type;
24342 this.quantifier = quantifier;
24343 }
24344
24345 @Override
24346 public OnnxType type() {
24347 return type;
24348 }
24349
24350 @Override
24351 public Quantifier quantifier() {
24352 return quantifier;
24353 }
24354 }
24355
24356 public enum OutputParameter implements OnnxParameter {
24357 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24358 ;
24359
24360 final OnnxType type;
24361 final Quantifier quantifier;
24362
24363 OutputParameter(OnnxType type, Quantifier quantifier) {
24364 this.type = type;
24365 this.quantifier = quantifier;
24366 }
24367
24368 @Override
24369 public OnnxType type() {
24370 return type;
24371 }
24372
24373 @Override
24374 public Quantifier quantifier() {
24375 return quantifier;
24376 }
24377 }
24378
24379 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
24380 NAME,
24381 List.of(Attribute.values()),
24382 List.of(TypeConstraint.values()),
24383 List.of(InputParameter.values()),
24384 List.of(OutputParameter.values())
24385 );
24386
24387 public RotaryEmbedding(ExternalizedOp def) {
24388 super(SCHEMA, def);
24389 }
24390
24391 RotaryEmbedding(RotaryEmbedding that, CodeContext cc) {
24392 super(that, cc);
24393 }
24394
24395 @Override
24396 public RotaryEmbedding transform(CodeContext cc, CodeTransformer ot) {
24397 return new RotaryEmbedding(this, cc);
24398 }
24399
24400 RotaryEmbedding(CodeType resultType, Value X, Value cos_cache, Value sin_cache, java.util.Optional<Value> position_ids, java.util.Optional<Long> num_heads, java.util.Optional<Long> rotary_embedding_dim, java.util.Optional<Long> interleaved) {
24401 super(SCHEMA, resultType, Set.of(), List.of(X, cos_cache, sin_cache, position_ids), List.of(num_heads, rotary_embedding_dim, interleaved));
24402 }
24403
24404 @Override
24405 public SequencedSet<OnnxParameter> onnxOutputs() {
24406 return onnxOutputs(SCHEMA);
24407 }
24408
24409 @Override
24410 public SequencedMap<OnnxParameter, Object> onnxInputs() {
24411 return onnxInputs(SCHEMA, List.of(X(), cos_cache(), sin_cache(), position_ids()));
24412 }
24413
24414 public Value X() {
24415 return operands().get(0);
24416 }
24417
24418 public Value cos_cache() {
24419 return operands().get(1);
24420 }
24421
24422 public Value sin_cache() {
24423 return operands().get(2);
24424 }
24425
24426 public java.util.Optional<Value> position_ids() {
24427 int i = optionalInputArguments.indexOf(InputParameter.position_ids);
24428 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
24429 }
24430
24431 public java.util.Optional<Long> num_heads() {
24432 Long num_heads = Attribute.num_heads.access(Long.class, onnxAttributes);
24433 return java.util.Optional.ofNullable(num_heads);
24434 }
24435
24436 public java.util.Optional<Long> rotary_embedding_dim() {
24437 Long rotary_embedding_dim = Attribute.rotary_embedding_dim.access(Long.class, onnxAttributes);
24438 return java.util.Optional.ofNullable(rotary_embedding_dim);
24439 }
24440
24441 public java.util.Optional<Long> interleaved() {
24442 Long interleaved = Attribute.interleaved.access(Long.class, onnxAttributes);
24443 return java.util.Optional.ofNullable(interleaved);
24444 }
24445
24446 }
24447
24448 public static RotaryEmbedding RotaryEmbedding(CodeType resultType, Value X, Value cos_cache, Value sin_cache, java.util.Optional<Value> position_ids, java.util.Optional<Long> num_heads, java.util.Optional<Long> rotary_embedding_dim, java.util.Optional<Long> interleaved) {
24449 return new RotaryEmbedding(resultType, X, cos_cache, sin_cache, position_ids, num_heads, rotary_embedding_dim, interleaved);
24450 }
24451
24452 @OpFactoryHelper.OpDeclaration(Round.NAME)
24453 public static final class Round extends OnnxOp {
24454 public static final String NAME = "Round";
24455
24456 public enum Attribute implements OnnxAttribute.None { }
24457
24458 public enum TypeConstraint implements OnnxTypeConstraint {
24459 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
24460 ;
24461
24462 final OnnxType.TypeVariable typeVariable;
24463
24464 TypeConstraint(OnnxType.TypeVariable typeVariable) {
24465 assert typeVariable.name().equals(name());
24466 this.typeVariable = typeVariable;
24467 }
24468
24469 @Override
24470 public OnnxType.TypeVariable typeVariable() {
24471 return typeVariable;
24472 }
24473 }
24474
24475 public enum InputParameter implements OnnxParameter {
24476 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24477 ;
24478
24479 final OnnxType type;
24480 final Quantifier quantifier;
24481
24482 InputParameter(OnnxType type, Quantifier quantifier) {
24483 this.type = type;
24484 this.quantifier = quantifier;
24485 }
24486
24487 @Override
24488 public OnnxType type() {
24489 return type;
24490 }
24491
24492 @Override
24493 public Quantifier quantifier() {
24494 return quantifier;
24495 }
24496 }
24497
24498 public enum OutputParameter implements OnnxParameter {
24499 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24500 ;
24501
24502 final OnnxType type;
24503 final Quantifier quantifier;
24504
24505 OutputParameter(OnnxType type, Quantifier quantifier) {
24506 this.type = type;
24507 this.quantifier = quantifier;
24508 }
24509
24510 @Override
24511 public OnnxType type() {
24512 return type;
24513 }
24514
24515 @Override
24516 public Quantifier quantifier() {
24517 return quantifier;
24518 }
24519 }
24520
24521 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
24522 NAME,
24523 List.of(Attribute.values()),
24524 List.of(TypeConstraint.values()),
24525 List.of(InputParameter.values()),
24526 List.of(OutputParameter.values())
24527 );
24528
24529 public Round(ExternalizedOp def) {
24530 super(SCHEMA, def);
24531 }
24532
24533 Round(Round that, CodeContext cc) {
24534 super(that, cc);
24535 }
24536
24537 @Override
24538 public Round transform(CodeContext cc, CodeTransformer ot) {
24539 return new Round(this, cc);
24540 }
24541
24542 Round(CodeType resultType, Value X) {
24543 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
24544 }
24545
24546 @Override
24547 public SequencedSet<OnnxParameter> onnxOutputs() {
24548 return onnxOutputs(SCHEMA);
24549 }
24550
24551 @Override
24552 public SequencedMap<OnnxParameter, Object> onnxInputs() {
24553 return onnxInputs(SCHEMA, List.of(X()));
24554 }
24555
24556 public Value X() {
24557 return operands().get(0);
24558 }
24559
24560 }
24561
24562 public static Round Round(CodeType resultType, Value X) {
24563 return new Round(resultType, X);
24564 }
24565
24566 @OpFactoryHelper.OpDeclaration(STFT.NAME)
24567 public static final class STFT extends OnnxOp {
24568 public static final String NAME = "STFT";
24569
24570 public enum Attribute implements OnnxAttribute {
24571 onesided(Long.class, true, 1),
24572 ;
24573
24574 final Class<?> t;
24575 final boolean optional;
24576 final Object defaultValue;
24577
24578 Attribute(Class<?> type, boolean optional, Object defaultValue) {
24579 this.t = type;
24580 this.optional = optional;
24581 this.defaultValue = defaultValue;
24582 assert optional || defaultValue == null;
24583 }
24584
24585 public Class<?> type() {
24586 return t;
24587 }
24588
24589 public boolean isOptional() {
24590 return optional;
24591 }
24592
24593 public Object defaultValue() {
24594 return defaultValue;
24595 }
24596 }
24597
24598 public enum TypeConstraint implements OnnxTypeConstraint {
24599 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
24600 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
24601 ;
24602
24603 final OnnxType.TypeVariable typeVariable;
24604
24605 TypeConstraint(OnnxType.TypeVariable typeVariable) {
24606 assert typeVariable.name().equals(name());
24607 this.typeVariable = typeVariable;
24608 }
24609
24610 @Override
24611 public OnnxType.TypeVariable typeVariable() {
24612 return typeVariable;
24613 }
24614 }
24615
24616 public enum InputParameter implements OnnxParameter {
24617 signal(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
24618 frame_step(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
24619 window(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL),
24620 frame_length(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL),
24621 ;
24622
24623 final OnnxType type;
24624 final Quantifier quantifier;
24625
24626 InputParameter(OnnxType type, Quantifier quantifier) {
24627 this.type = type;
24628 this.quantifier = quantifier;
24629 }
24630
24631 @Override
24632 public OnnxType type() {
24633 return type;
24634 }
24635
24636 @Override
24637 public Quantifier quantifier() {
24638 return quantifier;
24639 }
24640 }
24641
24642 public enum OutputParameter implements OnnxParameter {
24643 output(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
24644 ;
24645
24646 final OnnxType type;
24647 final Quantifier quantifier;
24648
24649 OutputParameter(OnnxType type, Quantifier quantifier) {
24650 this.type = type;
24651 this.quantifier = quantifier;
24652 }
24653
24654 @Override
24655 public OnnxType type() {
24656 return type;
24657 }
24658
24659 @Override
24660 public Quantifier quantifier() {
24661 return quantifier;
24662 }
24663 }
24664
24665 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
24666 NAME,
24667 List.of(Attribute.values()),
24668 List.of(TypeConstraint.values()),
24669 List.of(InputParameter.values()),
24670 List.of(OutputParameter.values())
24671 );
24672
24673 public STFT(ExternalizedOp def) {
24674 super(SCHEMA, def);
24675 }
24676
24677 STFT(STFT that, CodeContext cc) {
24678 super(that, cc);
24679 }
24680
24681 @Override
24682 public STFT transform(CodeContext cc, CodeTransformer ot) {
24683 return new STFT(this, cc);
24684 }
24685
24686 STFT(CodeType resultType, Value signal, Value frame_step, java.util.Optional<Value> window, java.util.Optional<Value> frame_length, java.util.Optional<Long> onesided) {
24687 super(SCHEMA, resultType, Set.of(), List.of(signal, frame_step, window, frame_length), List.of(onesided));
24688 }
24689
24690 @Override
24691 public SequencedSet<OnnxParameter> onnxOutputs() {
24692 return onnxOutputs(SCHEMA);
24693 }
24694
24695 @Override
24696 public SequencedMap<OnnxParameter, Object> onnxInputs() {
24697 return onnxInputs(SCHEMA, List.of(signal(), frame_step(), window(), frame_length()));
24698 }
24699
24700 public Value signal() {
24701 return operands().get(0);
24702 }
24703
24704 public Value frame_step() {
24705 return operands().get(1);
24706 }
24707
24708 public java.util.Optional<Value> window() {
24709 int i = optionalInputArguments.indexOf(InputParameter.window);
24710 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
24711 }
24712
24713 public java.util.Optional<Value> frame_length() {
24714 int i = optionalInputArguments.indexOf(InputParameter.frame_length);
24715 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
24716 }
24717
24718 public java.util.Optional<Long> onesided() {
24719 Long onesided = Attribute.onesided.access(Long.class, onnxAttributes);
24720 return java.util.Optional.ofNullable(onesided);
24721 }
24722
24723 }
24724
24725 public static STFT STFT(CodeType resultType, Value signal, Value frame_step, java.util.Optional<Value> window, java.util.Optional<Value> frame_length, java.util.Optional<Long> onesided) {
24726 return new STFT(resultType, signal, frame_step, window, frame_length, onesided);
24727 }
24728
24729 @OpFactoryHelper.OpDeclaration(SVMClassifier.NAME)
24730 public static final class SVMClassifier extends OnnxOp {
24731 public static final String NAME = "SVMClassifier";
24732
24733 public enum Attribute implements OnnxAttribute {
24734 prob_b(float[].class, true, null),
24735 kernel_params(float[].class, true, null),
24736 kernel_type(String.class, true, "LINEAR"),
24737 classlabels_ints(long[].class, true, null),
24738 post_transform(String.class, true, "NONE"),
24739 rho(float[].class, true, null),
24740 coefficients(float[].class, true, null),
24741 support_vectors(float[].class, true, null),
24742 vectors_per_class(long[].class, true, null),
24743 prob_a(float[].class, true, null),
24744 classlabels_strings(String[].class, true, null),
24745 ;
24746
24747 final Class<?> t;
24748 final boolean optional;
24749 final Object defaultValue;
24750
24751 Attribute(Class<?> type, boolean optional, Object defaultValue) {
24752 this.t = type;
24753 this.optional = optional;
24754 this.defaultValue = defaultValue;
24755 assert optional || defaultValue == null;
24756 }
24757
24758 public Class<?> type() {
24759 return t;
24760 }
24761
24762 public boolean isOptional() {
24763 return optional;
24764 }
24765
24766 public Object defaultValue() {
24767 return defaultValue;
24768 }
24769 }
24770
24771 public enum TypeConstraint implements OnnxTypeConstraint {
24772 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
24773 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))),
24774 ;
24775
24776 final OnnxType.TypeVariable typeVariable;
24777
24778 TypeConstraint(OnnxType.TypeVariable typeVariable) {
24779 assert typeVariable.name().equals(name());
24780 this.typeVariable = typeVariable;
24781 }
24782
24783 @Override
24784 public OnnxType.TypeVariable typeVariable() {
24785 return typeVariable;
24786 }
24787 }
24788
24789 public enum InputParameter implements OnnxParameter {
24790 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
24791 ;
24792
24793 final OnnxType type;
24794 final Quantifier quantifier;
24795
24796 InputParameter(OnnxType type, Quantifier quantifier) {
24797 this.type = type;
24798 this.quantifier = quantifier;
24799 }
24800
24801 @Override
24802 public OnnxType type() {
24803 return type;
24804 }
24805
24806 @Override
24807 public Quantifier quantifier() {
24808 return quantifier;
24809 }
24810 }
24811
24812 public enum OutputParameter implements OnnxParameter {
24813 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
24814 Z(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
24815 ;
24816
24817 final OnnxType type;
24818 final Quantifier quantifier;
24819
24820 OutputParameter(OnnxType type, Quantifier quantifier) {
24821 this.type = type;
24822 this.quantifier = quantifier;
24823 }
24824
24825 @Override
24826 public OnnxType type() {
24827 return type;
24828 }
24829
24830 @Override
24831 public Quantifier quantifier() {
24832 return quantifier;
24833 }
24834 }
24835
24836 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
24837 NAME,
24838 List.of(Attribute.values()),
24839 List.of(TypeConstraint.values()),
24840 List.of(InputParameter.values()),
24841 List.of(OutputParameter.values())
24842 );
24843
24844 public SVMClassifier(ExternalizedOp def) {
24845 super(SCHEMA, def);
24846 }
24847
24848 SVMClassifier(SVMClassifier that, CodeContext cc) {
24849 super(that, cc);
24850 }
24851
24852 @Override
24853 public SVMClassifier transform(CodeContext cc, CodeTransformer ot) {
24854 return new SVMClassifier(this, cc);
24855 }
24856
24857 SVMClassifier(CodeType resultType, Value X, java.util.Optional<float[]> prob_b, java.util.Optional<float[]> kernel_params, java.util.Optional<String> kernel_type, java.util.Optional<long[]> classlabels_ints, java.util.Optional<String> post_transform, java.util.Optional<float[]> rho, java.util.Optional<float[]> coefficients, java.util.Optional<float[]> support_vectors, java.util.Optional<long[]> vectors_per_class, java.util.Optional<float[]> prob_a, java.util.Optional<String[]> classlabels_strings) {
24858 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings));
24859 }
24860
24861 @Override
24862 public SequencedSet<OnnxParameter> onnxOutputs() {
24863 return onnxOutputs(SCHEMA);
24864 }
24865
24866 @Override
24867 public SequencedMap<OnnxParameter, Object> onnxInputs() {
24868 return onnxInputs(SCHEMA, List.of(X()));
24869 }
24870
24871 public Value X() {
24872 return operands().get(0);
24873 }
24874
24875 public java.util.Optional<float[]> prob_b() {
24876 float[] prob_b = Attribute.prob_b.access(float[].class, onnxAttributes);
24877 return java.util.Optional.ofNullable(prob_b).map(float[]::clone);
24878 }
24879
24880 public java.util.Optional<float[]> kernel_params() {
24881 float[] kernel_params = Attribute.kernel_params.access(float[].class, onnxAttributes);
24882 return java.util.Optional.ofNullable(kernel_params).map(float[]::clone);
24883 }
24884
24885 public java.util.Optional<String> kernel_type() {
24886 String kernel_type = Attribute.kernel_type.access(String.class, onnxAttributes);
24887 return java.util.Optional.ofNullable(kernel_type);
24888 }
24889
24890 public java.util.Optional<long[]> classlabels_ints() {
24891 long[] classlabels_ints = Attribute.classlabels_ints.access(long[].class, onnxAttributes);
24892 return java.util.Optional.ofNullable(classlabels_ints).map(long[]::clone);
24893 }
24894
24895 public java.util.Optional<String> post_transform() {
24896 String post_transform = Attribute.post_transform.access(String.class, onnxAttributes);
24897 return java.util.Optional.ofNullable(post_transform);
24898 }
24899
24900 public java.util.Optional<float[]> rho() {
24901 float[] rho = Attribute.rho.access(float[].class, onnxAttributes);
24902 return java.util.Optional.ofNullable(rho).map(float[]::clone);
24903 }
24904
24905 public java.util.Optional<float[]> coefficients() {
24906 float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes);
24907 return java.util.Optional.ofNullable(coefficients).map(float[]::clone);
24908 }
24909
24910 public java.util.Optional<float[]> support_vectors() {
24911 float[] support_vectors = Attribute.support_vectors.access(float[].class, onnxAttributes);
24912 return java.util.Optional.ofNullable(support_vectors).map(float[]::clone);
24913 }
24914
24915 public java.util.Optional<long[]> vectors_per_class() {
24916 long[] vectors_per_class = Attribute.vectors_per_class.access(long[].class, onnxAttributes);
24917 return java.util.Optional.ofNullable(vectors_per_class).map(long[]::clone);
24918 }
24919
24920 public java.util.Optional<float[]> prob_a() {
24921 float[] prob_a = Attribute.prob_a.access(float[].class, onnxAttributes);
24922 return java.util.Optional.ofNullable(prob_a).map(float[]::clone);
24923 }
24924
24925 public java.util.Optional<String[]> classlabels_strings() {
24926 String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes);
24927 return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone);
24928 }
24929
24930 }
24931
24932 public static SVMClassifier SVMClassifier(CodeType resultType, Value X, java.util.Optional<float[]> prob_b, java.util.Optional<float[]> kernel_params, java.util.Optional<String> kernel_type, java.util.Optional<long[]> classlabels_ints, java.util.Optional<String> post_transform, java.util.Optional<float[]> rho, java.util.Optional<float[]> coefficients, java.util.Optional<float[]> support_vectors, java.util.Optional<long[]> vectors_per_class, java.util.Optional<float[]> prob_a, java.util.Optional<String[]> classlabels_strings) {
24933 return new SVMClassifier(resultType, X, prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings);
24934 }
24935
24936 @OpFactoryHelper.OpDeclaration(SVMRegressor.NAME)
24937 public static final class SVMRegressor extends OnnxOp {
24938 public static final String NAME = "SVMRegressor";
24939
24940 public enum Attribute implements OnnxAttribute {
24941 kernel_type(String.class, true, "LINEAR"),
24942 kernel_params(float[].class, true, null),
24943 n_supports(Long.class, true, 0),
24944 rho(float[].class, true, null),
24945 post_transform(String.class, true, "NONE"),
24946 coefficients(float[].class, true, null),
24947 support_vectors(float[].class, true, null),
24948 one_class(Long.class, true, 0),
24949 ;
24950
24951 final Class<?> t;
24952 final boolean optional;
24953 final Object defaultValue;
24954
24955 Attribute(Class<?> type, boolean optional, Object defaultValue) {
24956 this.t = type;
24957 this.optional = optional;
24958 this.defaultValue = defaultValue;
24959 assert optional || defaultValue == null;
24960 }
24961
24962 public Class<?> type() {
24963 return t;
24964 }
24965
24966 public boolean isOptional() {
24967 return optional;
24968 }
24969
24970 public Object defaultValue() {
24971 return defaultValue;
24972 }
24973 }
24974
24975 public enum TypeConstraint implements OnnxTypeConstraint {
24976 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
24977 ;
24978
24979 final OnnxType.TypeVariable typeVariable;
24980
24981 TypeConstraint(OnnxType.TypeVariable typeVariable) {
24982 assert typeVariable.name().equals(name());
24983 this.typeVariable = typeVariable;
24984 }
24985
24986 @Override
24987 public OnnxType.TypeVariable typeVariable() {
24988 return typeVariable;
24989 }
24990 }
24991
24992 public enum InputParameter implements OnnxParameter {
24993 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
24994 ;
24995
24996 final OnnxType type;
24997 final Quantifier quantifier;
24998
24999 InputParameter(OnnxType type, Quantifier quantifier) {
25000 this.type = type;
25001 this.quantifier = quantifier;
25002 }
25003
25004 @Override
25005 public OnnxType type() {
25006 return type;
25007 }
25008
25009 @Override
25010 public Quantifier quantifier() {
25011 return quantifier;
25012 }
25013 }
25014
25015 public enum OutputParameter implements OnnxParameter {
25016 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
25017 ;
25018
25019 final OnnxType type;
25020 final Quantifier quantifier;
25021
25022 OutputParameter(OnnxType type, Quantifier quantifier) {
25023 this.type = type;
25024 this.quantifier = quantifier;
25025 }
25026
25027 @Override
25028 public OnnxType type() {
25029 return type;
25030 }
25031
25032 @Override
25033 public Quantifier quantifier() {
25034 return quantifier;
25035 }
25036 }
25037
25038 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25039 NAME,
25040 List.of(Attribute.values()),
25041 List.of(TypeConstraint.values()),
25042 List.of(InputParameter.values()),
25043 List.of(OutputParameter.values())
25044 );
25045
25046 public SVMRegressor(ExternalizedOp def) {
25047 super(SCHEMA, def);
25048 }
25049
25050 SVMRegressor(SVMRegressor that, CodeContext cc) {
25051 super(that, cc);
25052 }
25053
25054 @Override
25055 public SVMRegressor transform(CodeContext cc, CodeTransformer ot) {
25056 return new SVMRegressor(this, cc);
25057 }
25058
25059 SVMRegressor(CodeType resultType, Value X, java.util.Optional<String> kernel_type, java.util.Optional<float[]> kernel_params, java.util.Optional<Long> n_supports, java.util.Optional<float[]> rho, java.util.Optional<String> post_transform, java.util.Optional<float[]> coefficients, java.util.Optional<float[]> support_vectors, java.util.Optional<Long> one_class) {
25060 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class));
25061 }
25062
25063 @Override
25064 public SequencedSet<OnnxParameter> onnxOutputs() {
25065 return onnxOutputs(SCHEMA);
25066 }
25067
25068 @Override
25069 public SequencedMap<OnnxParameter, Object> onnxInputs() {
25070 return onnxInputs(SCHEMA, List.of(X()));
25071 }
25072
25073 public Value X() {
25074 return operands().get(0);
25075 }
25076
25077 public java.util.Optional<String> kernel_type() {
25078 String kernel_type = Attribute.kernel_type.access(String.class, onnxAttributes);
25079 return java.util.Optional.ofNullable(kernel_type);
25080 }
25081
25082 public java.util.Optional<float[]> kernel_params() {
25083 float[] kernel_params = Attribute.kernel_params.access(float[].class, onnxAttributes);
25084 return java.util.Optional.ofNullable(kernel_params).map(float[]::clone);
25085 }
25086
25087 public java.util.Optional<Long> n_supports() {
25088 Long n_supports = Attribute.n_supports.access(Long.class, onnxAttributes);
25089 return java.util.Optional.ofNullable(n_supports);
25090 }
25091
25092 public java.util.Optional<float[]> rho() {
25093 float[] rho = Attribute.rho.access(float[].class, onnxAttributes);
25094 return java.util.Optional.ofNullable(rho).map(float[]::clone);
25095 }
25096
25097 public java.util.Optional<String> post_transform() {
25098 String post_transform = Attribute.post_transform.access(String.class, onnxAttributes);
25099 return java.util.Optional.ofNullable(post_transform);
25100 }
25101
25102 public java.util.Optional<float[]> coefficients() {
25103 float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes);
25104 return java.util.Optional.ofNullable(coefficients).map(float[]::clone);
25105 }
25106
25107 public java.util.Optional<float[]> support_vectors() {
25108 float[] support_vectors = Attribute.support_vectors.access(float[].class, onnxAttributes);
25109 return java.util.Optional.ofNullable(support_vectors).map(float[]::clone);
25110 }
25111
25112 public java.util.Optional<Long> one_class() {
25113 Long one_class = Attribute.one_class.access(Long.class, onnxAttributes);
25114 return java.util.Optional.ofNullable(one_class);
25115 }
25116
25117 }
25118
25119 public static SVMRegressor SVMRegressor(CodeType resultType, Value X, java.util.Optional<String> kernel_type, java.util.Optional<float[]> kernel_params, java.util.Optional<Long> n_supports, java.util.Optional<float[]> rho, java.util.Optional<String> post_transform, java.util.Optional<float[]> coefficients, java.util.Optional<float[]> support_vectors, java.util.Optional<Long> one_class) {
25120 return new SVMRegressor(resultType, X, kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class);
25121 }
25122
25123 @OpFactoryHelper.OpDeclaration(Scaler.NAME)
25124 public static final class Scaler extends OnnxOp {
25125 public static final String NAME = "Scaler";
25126
25127 public enum Attribute implements OnnxAttribute {
25128 offset(float[].class, true, null),
25129 scale(float[].class, true, null),
25130 ;
25131
25132 final Class<?> t;
25133 final boolean optional;
25134 final Object defaultValue;
25135
25136 Attribute(Class<?> type, boolean optional, Object defaultValue) {
25137 this.t = type;
25138 this.optional = optional;
25139 this.defaultValue = defaultValue;
25140 assert optional || defaultValue == null;
25141 }
25142
25143 public Class<?> type() {
25144 return t;
25145 }
25146
25147 public boolean isOptional() {
25148 return optional;
25149 }
25150
25151 public Object defaultValue() {
25152 return defaultValue;
25153 }
25154 }
25155
25156 public enum TypeConstraint implements OnnxTypeConstraint {
25157 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
25158 ;
25159
25160 final OnnxType.TypeVariable typeVariable;
25161
25162 TypeConstraint(OnnxType.TypeVariable typeVariable) {
25163 assert typeVariable.name().equals(name());
25164 this.typeVariable = typeVariable;
25165 }
25166
25167 @Override
25168 public OnnxType.TypeVariable typeVariable() {
25169 return typeVariable;
25170 }
25171 }
25172
25173 public enum InputParameter implements OnnxParameter {
25174 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25175 ;
25176
25177 final OnnxType type;
25178 final Quantifier quantifier;
25179
25180 InputParameter(OnnxType type, Quantifier quantifier) {
25181 this.type = type;
25182 this.quantifier = quantifier;
25183 }
25184
25185 @Override
25186 public OnnxType type() {
25187 return type;
25188 }
25189
25190 @Override
25191 public Quantifier quantifier() {
25192 return quantifier;
25193 }
25194 }
25195
25196 public enum OutputParameter implements OnnxParameter {
25197 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
25198 ;
25199
25200 final OnnxType type;
25201 final Quantifier quantifier;
25202
25203 OutputParameter(OnnxType type, Quantifier quantifier) {
25204 this.type = type;
25205 this.quantifier = quantifier;
25206 }
25207
25208 @Override
25209 public OnnxType type() {
25210 return type;
25211 }
25212
25213 @Override
25214 public Quantifier quantifier() {
25215 return quantifier;
25216 }
25217 }
25218
25219 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25220 NAME,
25221 List.of(Attribute.values()),
25222 List.of(TypeConstraint.values()),
25223 List.of(InputParameter.values()),
25224 List.of(OutputParameter.values())
25225 );
25226
25227 public Scaler(ExternalizedOp def) {
25228 super(SCHEMA, def);
25229 }
25230
25231 Scaler(Scaler that, CodeContext cc) {
25232 super(that, cc);
25233 }
25234
25235 @Override
25236 public Scaler transform(CodeContext cc, CodeTransformer ot) {
25237 return new Scaler(this, cc);
25238 }
25239
25240 Scaler(CodeType resultType, Value X, java.util.Optional<float[]> offset, java.util.Optional<float[]> scale) {
25241 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(offset, scale));
25242 }
25243
25244 @Override
25245 public SequencedSet<OnnxParameter> onnxOutputs() {
25246 return onnxOutputs(SCHEMA);
25247 }
25248
25249 @Override
25250 public SequencedMap<OnnxParameter, Object> onnxInputs() {
25251 return onnxInputs(SCHEMA, List.of(X()));
25252 }
25253
25254 public Value X() {
25255 return operands().get(0);
25256 }
25257
25258 public java.util.Optional<float[]> offset() {
25259 float[] offset = Attribute.offset.access(float[].class, onnxAttributes);
25260 return java.util.Optional.ofNullable(offset).map(float[]::clone);
25261 }
25262
25263 public java.util.Optional<float[]> scale() {
25264 float[] scale = Attribute.scale.access(float[].class, onnxAttributes);
25265 return java.util.Optional.ofNullable(scale).map(float[]::clone);
25266 }
25267
25268 }
25269
25270 public static Scaler Scaler(CodeType resultType, Value X, java.util.Optional<float[]> offset, java.util.Optional<float[]> scale) {
25271 return new Scaler(resultType, X, offset, scale);
25272 }
25273
25274 @OpFactoryHelper.OpDeclaration(Scatter.NAME)
25275 public static final class Scatter extends OnnxOp {
25276 public static final String NAME = "Scatter";
25277
25278 public enum Attribute implements OnnxAttribute {
25279 axis(Long.class, true, 0),
25280 ;
25281
25282 final Class<?> t;
25283 final boolean optional;
25284 final Object defaultValue;
25285
25286 Attribute(Class<?> type, boolean optional, Object defaultValue) {
25287 this.t = type;
25288 this.optional = optional;
25289 this.defaultValue = defaultValue;
25290 assert optional || defaultValue == null;
25291 }
25292
25293 public Class<?> type() {
25294 return t;
25295 }
25296
25297 public boolean isOptional() {
25298 return optional;
25299 }
25300
25301 public Object defaultValue() {
25302 return defaultValue;
25303 }
25304 }
25305
25306 public enum TypeConstraint implements OnnxTypeConstraint {
25307 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
25308 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
25309 ;
25310
25311 final OnnxType.TypeVariable typeVariable;
25312
25313 TypeConstraint(OnnxType.TypeVariable typeVariable) {
25314 assert typeVariable.name().equals(name());
25315 this.typeVariable = typeVariable;
25316 }
25317
25318 @Override
25319 public OnnxType.TypeVariable typeVariable() {
25320 return typeVariable;
25321 }
25322 }
25323
25324 public enum InputParameter implements OnnxParameter {
25325 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25326 indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
25327 updates(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25328 ;
25329
25330 final OnnxType type;
25331 final Quantifier quantifier;
25332
25333 InputParameter(OnnxType type, Quantifier quantifier) {
25334 this.type = type;
25335 this.quantifier = quantifier;
25336 }
25337
25338 @Override
25339 public OnnxType type() {
25340 return type;
25341 }
25342
25343 @Override
25344 public Quantifier quantifier() {
25345 return quantifier;
25346 }
25347 }
25348
25349 public enum OutputParameter implements OnnxParameter {
25350 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25351 ;
25352
25353 final OnnxType type;
25354 final Quantifier quantifier;
25355
25356 OutputParameter(OnnxType type, Quantifier quantifier) {
25357 this.type = type;
25358 this.quantifier = quantifier;
25359 }
25360
25361 @Override
25362 public OnnxType type() {
25363 return type;
25364 }
25365
25366 @Override
25367 public Quantifier quantifier() {
25368 return quantifier;
25369 }
25370 }
25371
25372 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25373 NAME,
25374 List.of(Attribute.values()),
25375 List.of(TypeConstraint.values()),
25376 List.of(InputParameter.values()),
25377 List.of(OutputParameter.values())
25378 );
25379
25380 public Scatter(ExternalizedOp def) {
25381 super(SCHEMA, def);
25382 }
25383
25384 Scatter(Scatter that, CodeContext cc) {
25385 super(that, cc);
25386 }
25387
25388 @Override
25389 public Scatter transform(CodeContext cc, CodeTransformer ot) {
25390 return new Scatter(this, cc);
25391 }
25392
25393 Scatter(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional<Long> axis) {
25394 super(SCHEMA, resultType, Set.of(), List.of(data, indices, updates), List.of(axis));
25395 }
25396
25397 @Override
25398 public SequencedSet<OnnxParameter> onnxOutputs() {
25399 return onnxOutputs(SCHEMA);
25400 }
25401
25402 @Override
25403 public SequencedMap<OnnxParameter, Object> onnxInputs() {
25404 return onnxInputs(SCHEMA, List.of(data(), indices(), updates()));
25405 }
25406
25407 public Value data() {
25408 return operands().get(0);
25409 }
25410
25411 public Value indices() {
25412 return operands().get(1);
25413 }
25414
25415 public Value updates() {
25416 return operands().get(2);
25417 }
25418
25419 public java.util.Optional<Long> axis() {
25420 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
25421 return java.util.Optional.ofNullable(axis);
25422 }
25423
25424 }
25425
25426 public static Scatter Scatter(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional<Long> axis) {
25427 return new Scatter(resultType, data, indices, updates, axis);
25428 }
25429
25430 @OpFactoryHelper.OpDeclaration(ScatterElements.NAME)
25431 public static final class ScatterElements extends OnnxOp {
25432 public static final String NAME = "ScatterElements";
25433
25434 public enum Attribute implements OnnxAttribute {
25435 reduction(String.class, true, "none"),
25436 axis(Long.class, true, 0),
25437 ;
25438
25439 final Class<?> t;
25440 final boolean optional;
25441 final Object defaultValue;
25442
25443 Attribute(Class<?> type, boolean optional, Object defaultValue) {
25444 this.t = type;
25445 this.optional = optional;
25446 this.defaultValue = defaultValue;
25447 assert optional || defaultValue == null;
25448 }
25449
25450 public Class<?> type() {
25451 return t;
25452 }
25453
25454 public boolean isOptional() {
25455 return optional;
25456 }
25457
25458 public Object defaultValue() {
25459 return defaultValue;
25460 }
25461 }
25462
25463 public enum TypeConstraint implements OnnxTypeConstraint {
25464 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
25465 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
25466 ;
25467
25468 final OnnxType.TypeVariable typeVariable;
25469
25470 TypeConstraint(OnnxType.TypeVariable typeVariable) {
25471 assert typeVariable.name().equals(name());
25472 this.typeVariable = typeVariable;
25473 }
25474
25475 @Override
25476 public OnnxType.TypeVariable typeVariable() {
25477 return typeVariable;
25478 }
25479 }
25480
25481 public enum InputParameter implements OnnxParameter {
25482 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25483 indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
25484 updates(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25485 ;
25486
25487 final OnnxType type;
25488 final Quantifier quantifier;
25489
25490 InputParameter(OnnxType type, Quantifier quantifier) {
25491 this.type = type;
25492 this.quantifier = quantifier;
25493 }
25494
25495 @Override
25496 public OnnxType type() {
25497 return type;
25498 }
25499
25500 @Override
25501 public Quantifier quantifier() {
25502 return quantifier;
25503 }
25504 }
25505
25506 public enum OutputParameter implements OnnxParameter {
25507 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25508 ;
25509
25510 final OnnxType type;
25511 final Quantifier quantifier;
25512
25513 OutputParameter(OnnxType type, Quantifier quantifier) {
25514 this.type = type;
25515 this.quantifier = quantifier;
25516 }
25517
25518 @Override
25519 public OnnxType type() {
25520 return type;
25521 }
25522
25523 @Override
25524 public Quantifier quantifier() {
25525 return quantifier;
25526 }
25527 }
25528
25529 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25530 NAME,
25531 List.of(Attribute.values()),
25532 List.of(TypeConstraint.values()),
25533 List.of(InputParameter.values()),
25534 List.of(OutputParameter.values())
25535 );
25536
25537 public ScatterElements(ExternalizedOp def) {
25538 super(SCHEMA, def);
25539 }
25540
25541 ScatterElements(ScatterElements that, CodeContext cc) {
25542 super(that, cc);
25543 }
25544
25545 @Override
25546 public ScatterElements transform(CodeContext cc, CodeTransformer ot) {
25547 return new ScatterElements(this, cc);
25548 }
25549
25550 ScatterElements(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional<String> reduction, java.util.Optional<Long> axis) {
25551 super(SCHEMA, resultType, Set.of(), List.of(data, indices, updates), List.of(reduction, axis));
25552 }
25553
25554 @Override
25555 public SequencedSet<OnnxParameter> onnxOutputs() {
25556 return onnxOutputs(SCHEMA);
25557 }
25558
25559 @Override
25560 public SequencedMap<OnnxParameter, Object> onnxInputs() {
25561 return onnxInputs(SCHEMA, List.of(data(), indices(), updates()));
25562 }
25563
25564 public Value data() {
25565 return operands().get(0);
25566 }
25567
25568 public Value indices() {
25569 return operands().get(1);
25570 }
25571
25572 public Value updates() {
25573 return operands().get(2);
25574 }
25575
25576 public java.util.Optional<String> reduction() {
25577 String reduction = Attribute.reduction.access(String.class, onnxAttributes);
25578 return java.util.Optional.ofNullable(reduction);
25579 }
25580
25581 public java.util.Optional<Long> axis() {
25582 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
25583 return java.util.Optional.ofNullable(axis);
25584 }
25585
25586 }
25587
25588 public static ScatterElements ScatterElements(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional<String> reduction, java.util.Optional<Long> axis) {
25589 return new ScatterElements(resultType, data, indices, updates, reduction, axis);
25590 }
25591
25592 @OpFactoryHelper.OpDeclaration(ScatterND.NAME)
25593 public static final class ScatterND extends OnnxOp {
25594 public static final String NAME = "ScatterND";
25595
25596 public enum Attribute implements OnnxAttribute {
25597 reduction(String.class, true, "none"),
25598 ;
25599
25600 final Class<?> t;
25601 final boolean optional;
25602 final Object defaultValue;
25603
25604 Attribute(Class<?> type, boolean optional, Object defaultValue) {
25605 this.t = type;
25606 this.optional = optional;
25607 this.defaultValue = defaultValue;
25608 assert optional || defaultValue == null;
25609 }
25610
25611 public Class<?> type() {
25612 return t;
25613 }
25614
25615 public boolean isOptional() {
25616 return optional;
25617 }
25618
25619 public Object defaultValue() {
25620 return defaultValue;
25621 }
25622 }
25623
25624 public enum TypeConstraint implements OnnxTypeConstraint {
25625 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
25626 ;
25627
25628 final OnnxType.TypeVariable typeVariable;
25629
25630 TypeConstraint(OnnxType.TypeVariable typeVariable) {
25631 assert typeVariable.name().equals(name());
25632 this.typeVariable = typeVariable;
25633 }
25634
25635 @Override
25636 public OnnxType.TypeVariable typeVariable() {
25637 return typeVariable;
25638 }
25639 }
25640
25641 public enum InputParameter implements OnnxParameter {
25642 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25643 indices(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
25644 updates(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25645 ;
25646
25647 final OnnxType type;
25648 final Quantifier quantifier;
25649
25650 InputParameter(OnnxType type, Quantifier quantifier) {
25651 this.type = type;
25652 this.quantifier = quantifier;
25653 }
25654
25655 @Override
25656 public OnnxType type() {
25657 return type;
25658 }
25659
25660 @Override
25661 public Quantifier quantifier() {
25662 return quantifier;
25663 }
25664 }
25665
25666 public enum OutputParameter implements OnnxParameter {
25667 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25668 ;
25669
25670 final OnnxType type;
25671 final Quantifier quantifier;
25672
25673 OutputParameter(OnnxType type, Quantifier quantifier) {
25674 this.type = type;
25675 this.quantifier = quantifier;
25676 }
25677
25678 @Override
25679 public OnnxType type() {
25680 return type;
25681 }
25682
25683 @Override
25684 public Quantifier quantifier() {
25685 return quantifier;
25686 }
25687 }
25688
25689 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25690 NAME,
25691 List.of(Attribute.values()),
25692 List.of(TypeConstraint.values()),
25693 List.of(InputParameter.values()),
25694 List.of(OutputParameter.values())
25695 );
25696
25697 public ScatterND(ExternalizedOp def) {
25698 super(SCHEMA, def);
25699 }
25700
25701 ScatterND(ScatterND that, CodeContext cc) {
25702 super(that, cc);
25703 }
25704
25705 @Override
25706 public ScatterND transform(CodeContext cc, CodeTransformer ot) {
25707 return new ScatterND(this, cc);
25708 }
25709
25710 ScatterND(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional<String> reduction) {
25711 super(SCHEMA, resultType, Set.of(), List.of(data, indices, updates), List.of(reduction));
25712 }
25713
25714 @Override
25715 public SequencedSet<OnnxParameter> onnxOutputs() {
25716 return onnxOutputs(SCHEMA);
25717 }
25718
25719 @Override
25720 public SequencedMap<OnnxParameter, Object> onnxInputs() {
25721 return onnxInputs(SCHEMA, List.of(data(), indices(), updates()));
25722 }
25723
25724 public Value data() {
25725 return operands().get(0);
25726 }
25727
25728 public Value indices() {
25729 return operands().get(1);
25730 }
25731
25732 public Value updates() {
25733 return operands().get(2);
25734 }
25735
25736 public java.util.Optional<String> reduction() {
25737 String reduction = Attribute.reduction.access(String.class, onnxAttributes);
25738 return java.util.Optional.ofNullable(reduction);
25739 }
25740
25741 }
25742
25743 public static ScatterND ScatterND(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional<String> reduction) {
25744 return new ScatterND(resultType, data, indices, updates, reduction);
25745 }
25746
25747 @OpFactoryHelper.OpDeclaration(Selu.NAME)
25748 public static final class Selu extends OnnxOp {
25749 public static final String NAME = "Selu";
25750
25751 public enum Attribute implements OnnxAttribute {
25752 alpha(Float.class, true, 1.6732632f),
25753 gamma(Float.class, true, 1.050701f),
25754 ;
25755
25756 final Class<?> t;
25757 final boolean optional;
25758 final Object defaultValue;
25759
25760 Attribute(Class<?> type, boolean optional, Object defaultValue) {
25761 this.t = type;
25762 this.optional = optional;
25763 this.defaultValue = defaultValue;
25764 assert optional || defaultValue == null;
25765 }
25766
25767 public Class<?> type() {
25768 return t;
25769 }
25770
25771 public boolean isOptional() {
25772 return optional;
25773 }
25774
25775 public Object defaultValue() {
25776 return defaultValue;
25777 }
25778 }
25779
25780 public enum TypeConstraint implements OnnxTypeConstraint {
25781 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
25782 ;
25783
25784 final OnnxType.TypeVariable typeVariable;
25785
25786 TypeConstraint(OnnxType.TypeVariable typeVariable) {
25787 assert typeVariable.name().equals(name());
25788 this.typeVariable = typeVariable;
25789 }
25790
25791 @Override
25792 public OnnxType.TypeVariable typeVariable() {
25793 return typeVariable;
25794 }
25795 }
25796
25797 public enum InputParameter implements OnnxParameter {
25798 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25799 ;
25800
25801 final OnnxType type;
25802 final Quantifier quantifier;
25803
25804 InputParameter(OnnxType type, Quantifier quantifier) {
25805 this.type = type;
25806 this.quantifier = quantifier;
25807 }
25808
25809 @Override
25810 public OnnxType type() {
25811 return type;
25812 }
25813
25814 @Override
25815 public Quantifier quantifier() {
25816 return quantifier;
25817 }
25818 }
25819
25820 public enum OutputParameter implements OnnxParameter {
25821 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25822 ;
25823
25824 final OnnxType type;
25825 final Quantifier quantifier;
25826
25827 OutputParameter(OnnxType type, Quantifier quantifier) {
25828 this.type = type;
25829 this.quantifier = quantifier;
25830 }
25831
25832 @Override
25833 public OnnxType type() {
25834 return type;
25835 }
25836
25837 @Override
25838 public Quantifier quantifier() {
25839 return quantifier;
25840 }
25841 }
25842
25843 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25844 NAME,
25845 List.of(Attribute.values()),
25846 List.of(TypeConstraint.values()),
25847 List.of(InputParameter.values()),
25848 List.of(OutputParameter.values())
25849 );
25850
25851 public Selu(ExternalizedOp def) {
25852 super(SCHEMA, def);
25853 }
25854
25855 Selu(Selu that, CodeContext cc) {
25856 super(that, cc);
25857 }
25858
25859 @Override
25860 public Selu transform(CodeContext cc, CodeTransformer ot) {
25861 return new Selu(this, cc);
25862 }
25863
25864 Selu(CodeType resultType, Value X, java.util.Optional<Float> alpha, java.util.Optional<Float> gamma) {
25865 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha, gamma));
25866 }
25867
25868 @Override
25869 public SequencedSet<OnnxParameter> onnxOutputs() {
25870 return onnxOutputs(SCHEMA);
25871 }
25872
25873 @Override
25874 public SequencedMap<OnnxParameter, Object> onnxInputs() {
25875 return onnxInputs(SCHEMA, List.of(X()));
25876 }
25877
25878 public Value X() {
25879 return operands().get(0);
25880 }
25881
25882 public java.util.Optional<Float> alpha() {
25883 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
25884 return java.util.Optional.ofNullable(alpha);
25885 }
25886
25887 public java.util.Optional<Float> gamma() {
25888 Float gamma = Attribute.gamma.access(Float.class, onnxAttributes);
25889 return java.util.Optional.ofNullable(gamma);
25890 }
25891
25892 }
25893
25894 public static Selu Selu(CodeType resultType, Value X, java.util.Optional<Float> alpha, java.util.Optional<Float> gamma) {
25895 return new Selu(resultType, X, alpha, gamma);
25896 }
25897
25898 @OpFactoryHelper.OpDeclaration(SequenceAt.NAME)
25899 public static final class SequenceAt extends OnnxOp {
25900 public static final String NAME = "SequenceAt";
25901
25902 public enum Attribute implements OnnxAttribute.None { }
25903
25904 public enum TypeConstraint implements OnnxTypeConstraint {
25905 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
25906 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
25907 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
25908 ;
25909
25910 final OnnxType.TypeVariable typeVariable;
25911
25912 TypeConstraint(OnnxType.TypeVariable typeVariable) {
25913 assert typeVariable.name().equals(name());
25914 this.typeVariable = typeVariable;
25915 }
25916
25917 @Override
25918 public OnnxType.TypeVariable typeVariable() {
25919 return typeVariable;
25920 }
25921 }
25922
25923 public enum InputParameter implements OnnxParameter {
25924 input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
25925 position(TypeConstraint.I.typeVariable(), Quantifier.REQUIRED),
25926 ;
25927
25928 final OnnxType type;
25929 final Quantifier quantifier;
25930
25931 InputParameter(OnnxType type, Quantifier quantifier) {
25932 this.type = type;
25933 this.quantifier = quantifier;
25934 }
25935
25936 @Override
25937 public OnnxType type() {
25938 return type;
25939 }
25940
25941 @Override
25942 public Quantifier quantifier() {
25943 return quantifier;
25944 }
25945 }
25946
25947 public enum OutputParameter implements OnnxParameter {
25948 tensor(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
25949 ;
25950
25951 final OnnxType type;
25952 final Quantifier quantifier;
25953
25954 OutputParameter(OnnxType type, Quantifier quantifier) {
25955 this.type = type;
25956 this.quantifier = quantifier;
25957 }
25958
25959 @Override
25960 public OnnxType type() {
25961 return type;
25962 }
25963
25964 @Override
25965 public Quantifier quantifier() {
25966 return quantifier;
25967 }
25968 }
25969
25970 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
25971 NAME,
25972 List.of(Attribute.values()),
25973 List.of(TypeConstraint.values()),
25974 List.of(InputParameter.values()),
25975 List.of(OutputParameter.values())
25976 );
25977
25978 public SequenceAt(ExternalizedOp def) {
25979 super(SCHEMA, def);
25980 }
25981
25982 SequenceAt(SequenceAt that, CodeContext cc) {
25983 super(that, cc);
25984 }
25985
25986 @Override
25987 public SequenceAt transform(CodeContext cc, CodeTransformer ot) {
25988 return new SequenceAt(this, cc);
25989 }
25990
25991 SequenceAt(CodeType resultType, Value input_sequence, Value position) {
25992 super(SCHEMA, resultType, Set.of(), List.of(input_sequence, position), List.of());
25993 }
25994
25995 @Override
25996 public SequencedSet<OnnxParameter> onnxOutputs() {
25997 return onnxOutputs(SCHEMA);
25998 }
25999
26000 @Override
26001 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26002 return onnxInputs(SCHEMA, List.of(input_sequence(), position()));
26003 }
26004
26005 public Value input_sequence() {
26006 return operands().get(0);
26007 }
26008
26009 public Value position() {
26010 return operands().get(1);
26011 }
26012
26013 }
26014
26015 public static SequenceAt SequenceAt(CodeType resultType, Value input_sequence, Value position) {
26016 return new SequenceAt(resultType, input_sequence, position);
26017 }
26018
26019 @OpFactoryHelper.OpDeclaration(SequenceConstruct.NAME)
26020 public static final class SequenceConstruct extends OnnxOp {
26021 public static final String NAME = "SequenceConstruct";
26022
26023 public enum Attribute implements OnnxAttribute.None { }
26024
26025 public enum TypeConstraint implements OnnxTypeConstraint {
26026 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
26027 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
26028 ;
26029
26030 final OnnxType.TypeVariable typeVariable;
26031
26032 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26033 assert typeVariable.name().equals(name());
26034 this.typeVariable = typeVariable;
26035 }
26036
26037 @Override
26038 public OnnxType.TypeVariable typeVariable() {
26039 return typeVariable;
26040 }
26041 }
26042
26043 public enum InputParameter implements OnnxParameter {
26044 inputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
26045 ;
26046
26047 final OnnxType type;
26048 final Quantifier quantifier;
26049
26050 InputParameter(OnnxType type, Quantifier quantifier) {
26051 this.type = type;
26052 this.quantifier = quantifier;
26053 }
26054
26055 @Override
26056 public OnnxType type() {
26057 return type;
26058 }
26059
26060 @Override
26061 public Quantifier quantifier() {
26062 return quantifier;
26063 }
26064 }
26065
26066 public enum OutputParameter implements OnnxParameter {
26067 output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26068 ;
26069
26070 final OnnxType type;
26071 final Quantifier quantifier;
26072
26073 OutputParameter(OnnxType type, Quantifier quantifier) {
26074 this.type = type;
26075 this.quantifier = quantifier;
26076 }
26077
26078 @Override
26079 public OnnxType type() {
26080 return type;
26081 }
26082
26083 @Override
26084 public Quantifier quantifier() {
26085 return quantifier;
26086 }
26087 }
26088
26089 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26090 NAME,
26091 List.of(Attribute.values()),
26092 List.of(TypeConstraint.values()),
26093 List.of(InputParameter.values()),
26094 List.of(OutputParameter.values())
26095 );
26096
26097 public SequenceConstruct(ExternalizedOp def) {
26098 super(SCHEMA, def);
26099 }
26100
26101 SequenceConstruct(SequenceConstruct that, CodeContext cc) {
26102 super(that, cc);
26103 }
26104
26105 @Override
26106 public SequenceConstruct transform(CodeContext cc, CodeTransformer ot) {
26107 return new SequenceConstruct(this, cc);
26108 }
26109
26110 SequenceConstruct(CodeType resultType, List<Value> inputs) {
26111 super(SCHEMA, resultType, Set.of(), List.of(inputs), List.of());
26112 }
26113
26114 @Override
26115 public SequencedSet<OnnxParameter> onnxOutputs() {
26116 return onnxOutputs(SCHEMA);
26117 }
26118
26119 @Override
26120 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26121 return onnxInputs(SCHEMA, List.of(inputs()));
26122 }
26123
26124 public List<Value> inputs() {
26125 return operands();
26126 }
26127
26128 }
26129
26130 public static SequenceConstruct SequenceConstruct(CodeType resultType, List<Value> inputs) {
26131 return new SequenceConstruct(resultType, inputs);
26132 }
26133
26134 @OpFactoryHelper.OpDeclaration(SequenceEmpty.NAME)
26135 public static final class SequenceEmpty extends OnnxOp {
26136 public static final String NAME = "SequenceEmpty";
26137
26138 public enum Attribute implements OnnxAttribute {
26139 dtype(Long.class, true, null),
26140 ;
26141
26142 final Class<?> t;
26143 final boolean optional;
26144 final Object defaultValue;
26145
26146 Attribute(Class<?> type, boolean optional, Object defaultValue) {
26147 this.t = type;
26148 this.optional = optional;
26149 this.defaultValue = defaultValue;
26150 assert optional || defaultValue == null;
26151 }
26152
26153 public Class<?> type() {
26154 return t;
26155 }
26156
26157 public boolean isOptional() {
26158 return optional;
26159 }
26160
26161 public Object defaultValue() {
26162 return defaultValue;
26163 }
26164 }
26165
26166 public enum TypeConstraint implements OnnxTypeConstraint {
26167 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
26168 ;
26169
26170 final OnnxType.TypeVariable typeVariable;
26171
26172 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26173 assert typeVariable.name().equals(name());
26174 this.typeVariable = typeVariable;
26175 }
26176
26177 @Override
26178 public OnnxType.TypeVariable typeVariable() {
26179 return typeVariable;
26180 }
26181 }
26182
26183 public enum InputParameter implements OnnxParameter.None { }
26184
26185 public enum OutputParameter implements OnnxParameter {
26186 output(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26187 ;
26188
26189 final OnnxType type;
26190 final Quantifier quantifier;
26191
26192 OutputParameter(OnnxType type, Quantifier quantifier) {
26193 this.type = type;
26194 this.quantifier = quantifier;
26195 }
26196
26197 @Override
26198 public OnnxType type() {
26199 return type;
26200 }
26201
26202 @Override
26203 public Quantifier quantifier() {
26204 return quantifier;
26205 }
26206 }
26207
26208 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26209 NAME,
26210 List.of(Attribute.values()),
26211 List.of(TypeConstraint.values()),
26212 List.of(InputParameter.values()),
26213 List.of(OutputParameter.values())
26214 );
26215
26216 public SequenceEmpty(ExternalizedOp def) {
26217 super(SCHEMA, def);
26218 }
26219
26220 SequenceEmpty(SequenceEmpty that, CodeContext cc) {
26221 super(that, cc);
26222 }
26223
26224 @Override
26225 public SequenceEmpty transform(CodeContext cc, CodeTransformer ot) {
26226 return new SequenceEmpty(this, cc);
26227 }
26228
26229 SequenceEmpty(CodeType resultType, java.util.Optional<Long> dtype) {
26230 super(SCHEMA, resultType, Set.of(), List.of(), List.of(dtype));
26231 }
26232
26233 @Override
26234 public SequencedSet<OnnxParameter> onnxOutputs() {
26235 return onnxOutputs(SCHEMA);
26236 }
26237
26238 @Override
26239 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26240 return onnxInputs(SCHEMA, List.of());
26241 }
26242
26243 public java.util.Optional<Long> dtype() {
26244 Long dtype = Attribute.dtype.access(Long.class, onnxAttributes);
26245 return java.util.Optional.ofNullable(dtype);
26246 }
26247
26248 }
26249
26250 public static SequenceEmpty SequenceEmpty(CodeType resultType, java.util.Optional<Long> dtype) {
26251 return new SequenceEmpty(resultType, dtype);
26252 }
26253
26254 @OpFactoryHelper.OpDeclaration(SequenceErase.NAME)
26255 public static final class SequenceErase extends OnnxOp {
26256 public static final String NAME = "SequenceErase";
26257
26258 public enum Attribute implements OnnxAttribute.None { }
26259
26260 public enum TypeConstraint implements OnnxTypeConstraint {
26261 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
26262 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
26263 ;
26264
26265 final OnnxType.TypeVariable typeVariable;
26266
26267 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26268 assert typeVariable.name().equals(name());
26269 this.typeVariable = typeVariable;
26270 }
26271
26272 @Override
26273 public OnnxType.TypeVariable typeVariable() {
26274 return typeVariable;
26275 }
26276 }
26277
26278 public enum InputParameter implements OnnxParameter {
26279 input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26280 position(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL),
26281 ;
26282
26283 final OnnxType type;
26284 final Quantifier quantifier;
26285
26286 InputParameter(OnnxType type, Quantifier quantifier) {
26287 this.type = type;
26288 this.quantifier = quantifier;
26289 }
26290
26291 @Override
26292 public OnnxType type() {
26293 return type;
26294 }
26295
26296 @Override
26297 public Quantifier quantifier() {
26298 return quantifier;
26299 }
26300 }
26301
26302 public enum OutputParameter implements OnnxParameter {
26303 output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26304 ;
26305
26306 final OnnxType type;
26307 final Quantifier quantifier;
26308
26309 OutputParameter(OnnxType type, Quantifier quantifier) {
26310 this.type = type;
26311 this.quantifier = quantifier;
26312 }
26313
26314 @Override
26315 public OnnxType type() {
26316 return type;
26317 }
26318
26319 @Override
26320 public Quantifier quantifier() {
26321 return quantifier;
26322 }
26323 }
26324
26325 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26326 NAME,
26327 List.of(Attribute.values()),
26328 List.of(TypeConstraint.values()),
26329 List.of(InputParameter.values()),
26330 List.of(OutputParameter.values())
26331 );
26332
26333 public SequenceErase(ExternalizedOp def) {
26334 super(SCHEMA, def);
26335 }
26336
26337 SequenceErase(SequenceErase that, CodeContext cc) {
26338 super(that, cc);
26339 }
26340
26341 @Override
26342 public SequenceErase transform(CodeContext cc, CodeTransformer ot) {
26343 return new SequenceErase(this, cc);
26344 }
26345
26346 SequenceErase(CodeType resultType, Value input_sequence, java.util.Optional<Value> position) {
26347 super(SCHEMA, resultType, Set.of(), List.of(input_sequence, position), List.of());
26348 }
26349
26350 @Override
26351 public SequencedSet<OnnxParameter> onnxOutputs() {
26352 return onnxOutputs(SCHEMA);
26353 }
26354
26355 @Override
26356 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26357 return onnxInputs(SCHEMA, List.of(input_sequence(), position()));
26358 }
26359
26360 public Value input_sequence() {
26361 return operands().get(0);
26362 }
26363
26364 public java.util.Optional<Value> position() {
26365 int i = optionalInputArguments.indexOf(InputParameter.position);
26366 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
26367 }
26368
26369 }
26370
26371 public static SequenceErase SequenceErase(CodeType resultType, Value input_sequence, java.util.Optional<Value> position) {
26372 return new SequenceErase(resultType, input_sequence, position);
26373 }
26374
26375 @OpFactoryHelper.OpDeclaration(SequenceInsert.NAME)
26376 public static final class SequenceInsert extends OnnxOp {
26377 public static final String NAME = "SequenceInsert";
26378
26379 public enum Attribute implements OnnxAttribute.None { }
26380
26381 public enum TypeConstraint implements OnnxTypeConstraint {
26382 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
26383 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
26384 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
26385 ;
26386
26387 final OnnxType.TypeVariable typeVariable;
26388
26389 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26390 assert typeVariable.name().equals(name());
26391 this.typeVariable = typeVariable;
26392 }
26393
26394 @Override
26395 public OnnxType.TypeVariable typeVariable() {
26396 return typeVariable;
26397 }
26398 }
26399
26400 public enum InputParameter implements OnnxParameter {
26401 input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26402 tensor(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
26403 position(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL),
26404 ;
26405
26406 final OnnxType type;
26407 final Quantifier quantifier;
26408
26409 InputParameter(OnnxType type, Quantifier quantifier) {
26410 this.type = type;
26411 this.quantifier = quantifier;
26412 }
26413
26414 @Override
26415 public OnnxType type() {
26416 return type;
26417 }
26418
26419 @Override
26420 public Quantifier quantifier() {
26421 return quantifier;
26422 }
26423 }
26424
26425 public enum OutputParameter implements OnnxParameter {
26426 output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26427 ;
26428
26429 final OnnxType type;
26430 final Quantifier quantifier;
26431
26432 OutputParameter(OnnxType type, Quantifier quantifier) {
26433 this.type = type;
26434 this.quantifier = quantifier;
26435 }
26436
26437 @Override
26438 public OnnxType type() {
26439 return type;
26440 }
26441
26442 @Override
26443 public Quantifier quantifier() {
26444 return quantifier;
26445 }
26446 }
26447
26448 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26449 NAME,
26450 List.of(Attribute.values()),
26451 List.of(TypeConstraint.values()),
26452 List.of(InputParameter.values()),
26453 List.of(OutputParameter.values())
26454 );
26455
26456 public SequenceInsert(ExternalizedOp def) {
26457 super(SCHEMA, def);
26458 }
26459
26460 SequenceInsert(SequenceInsert that, CodeContext cc) {
26461 super(that, cc);
26462 }
26463
26464 @Override
26465 public SequenceInsert transform(CodeContext cc, CodeTransformer ot) {
26466 return new SequenceInsert(this, cc);
26467 }
26468
26469 SequenceInsert(CodeType resultType, Value input_sequence, Value tensor, java.util.Optional<Value> position) {
26470 super(SCHEMA, resultType, Set.of(), List.of(input_sequence, tensor, position), List.of());
26471 }
26472
26473 @Override
26474 public SequencedSet<OnnxParameter> onnxOutputs() {
26475 return onnxOutputs(SCHEMA);
26476 }
26477
26478 @Override
26479 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26480 return onnxInputs(SCHEMA, List.of(input_sequence(), tensor(), position()));
26481 }
26482
26483 public Value input_sequence() {
26484 return operands().get(0);
26485 }
26486
26487 public Value tensor() {
26488 return operands().get(1);
26489 }
26490
26491 public java.util.Optional<Value> position() {
26492 int i = optionalInputArguments.indexOf(InputParameter.position);
26493 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
26494 }
26495
26496 }
26497
26498 public static SequenceInsert SequenceInsert(CodeType resultType, Value input_sequence, Value tensor, java.util.Optional<Value> position) {
26499 return new SequenceInsert(resultType, input_sequence, tensor, position);
26500 }
26501
26502 @OpFactoryHelper.OpDeclaration(SequenceLength.NAME)
26503 public static final class SequenceLength extends OnnxOp {
26504 public static final String NAME = "SequenceLength";
26505
26506 public enum Attribute implements OnnxAttribute.None { }
26507
26508 public enum TypeConstraint implements OnnxTypeConstraint {
26509 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
26510 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int64())))),
26511 ;
26512
26513 final OnnxType.TypeVariable typeVariable;
26514
26515 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26516 assert typeVariable.name().equals(name());
26517 this.typeVariable = typeVariable;
26518 }
26519
26520 @Override
26521 public OnnxType.TypeVariable typeVariable() {
26522 return typeVariable;
26523 }
26524 }
26525
26526 public enum InputParameter implements OnnxParameter {
26527 input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
26528 ;
26529
26530 final OnnxType type;
26531 final Quantifier quantifier;
26532
26533 InputParameter(OnnxType type, Quantifier quantifier) {
26534 this.type = type;
26535 this.quantifier = quantifier;
26536 }
26537
26538 @Override
26539 public OnnxType type() {
26540 return type;
26541 }
26542
26543 @Override
26544 public Quantifier quantifier() {
26545 return quantifier;
26546 }
26547 }
26548
26549 public enum OutputParameter implements OnnxParameter {
26550 length(TypeConstraint.I.typeVariable(), Quantifier.REQUIRED),
26551 ;
26552
26553 final OnnxType type;
26554 final Quantifier quantifier;
26555
26556 OutputParameter(OnnxType type, Quantifier quantifier) {
26557 this.type = type;
26558 this.quantifier = quantifier;
26559 }
26560
26561 @Override
26562 public OnnxType type() {
26563 return type;
26564 }
26565
26566 @Override
26567 public Quantifier quantifier() {
26568 return quantifier;
26569 }
26570 }
26571
26572 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26573 NAME,
26574 List.of(Attribute.values()),
26575 List.of(TypeConstraint.values()),
26576 List.of(InputParameter.values()),
26577 List.of(OutputParameter.values())
26578 );
26579
26580 public SequenceLength(ExternalizedOp def) {
26581 super(SCHEMA, def);
26582 }
26583
26584 SequenceLength(SequenceLength that, CodeContext cc) {
26585 super(that, cc);
26586 }
26587
26588 @Override
26589 public SequenceLength transform(CodeContext cc, CodeTransformer ot) {
26590 return new SequenceLength(this, cc);
26591 }
26592
26593 SequenceLength(CodeType resultType, Value input_sequence) {
26594 super(SCHEMA, resultType, Set.of(), List.of(input_sequence), List.of());
26595 }
26596
26597 @Override
26598 public SequencedSet<OnnxParameter> onnxOutputs() {
26599 return onnxOutputs(SCHEMA);
26600 }
26601
26602 @Override
26603 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26604 return onnxInputs(SCHEMA, List.of(input_sequence()));
26605 }
26606
26607 public Value input_sequence() {
26608 return operands().get(0);
26609 }
26610
26611 }
26612
26613 public static SequenceLength SequenceLength(CodeType resultType, Value input_sequence) {
26614 return new SequenceLength(resultType, input_sequence);
26615 }
26616
26617 @OpFactoryHelper.OpDeclaration(Shape.NAME)
26618 public static final class Shape extends OnnxOp {
26619 public static final String NAME = "Shape";
26620
26621 public enum Attribute implements OnnxAttribute {
26622 start(Long.class, true, 0),
26623 end(Long.class, true, null),
26624 ;
26625
26626 final Class<?> t;
26627 final boolean optional;
26628 final Object defaultValue;
26629
26630 Attribute(Class<?> type, boolean optional, Object defaultValue) {
26631 this.t = type;
26632 this.optional = optional;
26633 this.defaultValue = defaultValue;
26634 assert optional || defaultValue == null;
26635 }
26636
26637 public Class<?> type() {
26638 return t;
26639 }
26640
26641 public boolean isOptional() {
26642 return optional;
26643 }
26644
26645 public Object defaultValue() {
26646 return defaultValue;
26647 }
26648 }
26649
26650 public enum TypeConstraint implements OnnxTypeConstraint {
26651 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
26652 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))),
26653 ;
26654
26655 final OnnxType.TypeVariable typeVariable;
26656
26657 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26658 assert typeVariable.name().equals(name());
26659 this.typeVariable = typeVariable;
26660 }
26661
26662 @Override
26663 public OnnxType.TypeVariable typeVariable() {
26664 return typeVariable;
26665 }
26666 }
26667
26668 public enum InputParameter implements OnnxParameter {
26669 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
26670 ;
26671
26672 final OnnxType type;
26673 final Quantifier quantifier;
26674
26675 InputParameter(OnnxType type, Quantifier quantifier) {
26676 this.type = type;
26677 this.quantifier = quantifier;
26678 }
26679
26680 @Override
26681 public OnnxType type() {
26682 return type;
26683 }
26684
26685 @Override
26686 public Quantifier quantifier() {
26687 return quantifier;
26688 }
26689 }
26690
26691 public enum OutputParameter implements OnnxParameter {
26692 shape(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
26693 ;
26694
26695 final OnnxType type;
26696 final Quantifier quantifier;
26697
26698 OutputParameter(OnnxType type, Quantifier quantifier) {
26699 this.type = type;
26700 this.quantifier = quantifier;
26701 }
26702
26703 @Override
26704 public OnnxType type() {
26705 return type;
26706 }
26707
26708 @Override
26709 public Quantifier quantifier() {
26710 return quantifier;
26711 }
26712 }
26713
26714 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26715 NAME,
26716 List.of(Attribute.values()),
26717 List.of(TypeConstraint.values()),
26718 List.of(InputParameter.values()),
26719 List.of(OutputParameter.values())
26720 );
26721
26722 public Shape(ExternalizedOp def) {
26723 super(SCHEMA, def);
26724 }
26725
26726 Shape(Shape that, CodeContext cc) {
26727 super(that, cc);
26728 }
26729
26730 @Override
26731 public Shape transform(CodeContext cc, CodeTransformer ot) {
26732 return new Shape(this, cc);
26733 }
26734
26735 Shape(CodeType resultType, Value data, java.util.Optional<Long> start, java.util.Optional<Long> end) {
26736 super(SCHEMA, resultType, Set.of(), List.of(data), List.of(start, end));
26737 }
26738
26739 @Override
26740 public SequencedSet<OnnxParameter> onnxOutputs() {
26741 return onnxOutputs(SCHEMA);
26742 }
26743
26744 @Override
26745 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26746 return onnxInputs(SCHEMA, List.of(data()));
26747 }
26748
26749 public Value data() {
26750 return operands().get(0);
26751 }
26752
26753 public java.util.Optional<Long> start() {
26754 Long start = Attribute.start.access(Long.class, onnxAttributes);
26755 return java.util.Optional.ofNullable(start);
26756 }
26757
26758 public java.util.Optional<Long> end() {
26759 Long end = Attribute.end.access(Long.class, onnxAttributes);
26760 return java.util.Optional.ofNullable(end);
26761 }
26762
26763 }
26764
26765 public static Shape Shape(CodeType resultType, Value data, java.util.Optional<Long> start, java.util.Optional<Long> end) {
26766 return new Shape(resultType, data, start, end);
26767 }
26768
26769 @OpFactoryHelper.OpDeclaration(Shrink.NAME)
26770 public static final class Shrink extends OnnxOp {
26771 public static final String NAME = "Shrink";
26772
26773 public enum Attribute implements OnnxAttribute {
26774 lambd(Float.class, true, 0.5f),
26775 bias(Float.class, true, 0.0f),
26776 ;
26777
26778 final Class<?> t;
26779 final boolean optional;
26780 final Object defaultValue;
26781
26782 Attribute(Class<?> type, boolean optional, Object defaultValue) {
26783 this.t = type;
26784 this.optional = optional;
26785 this.defaultValue = defaultValue;
26786 assert optional || defaultValue == null;
26787 }
26788
26789 public Class<?> type() {
26790 return t;
26791 }
26792
26793 public boolean isOptional() {
26794 return optional;
26795 }
26796
26797 public Object defaultValue() {
26798 return defaultValue;
26799 }
26800 }
26801
26802 public enum TypeConstraint implements OnnxTypeConstraint {
26803 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
26804 ;
26805
26806 final OnnxType.TypeVariable typeVariable;
26807
26808 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26809 assert typeVariable.name().equals(name());
26810 this.typeVariable = typeVariable;
26811 }
26812
26813 @Override
26814 public OnnxType.TypeVariable typeVariable() {
26815 return typeVariable;
26816 }
26817 }
26818
26819 public enum InputParameter implements OnnxParameter {
26820 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
26821 ;
26822
26823 final OnnxType type;
26824 final Quantifier quantifier;
26825
26826 InputParameter(OnnxType type, Quantifier quantifier) {
26827 this.type = type;
26828 this.quantifier = quantifier;
26829 }
26830
26831 @Override
26832 public OnnxType type() {
26833 return type;
26834 }
26835
26836 @Override
26837 public Quantifier quantifier() {
26838 return quantifier;
26839 }
26840 }
26841
26842 public enum OutputParameter implements OnnxParameter {
26843 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
26844 ;
26845
26846 final OnnxType type;
26847 final Quantifier quantifier;
26848
26849 OutputParameter(OnnxType type, Quantifier quantifier) {
26850 this.type = type;
26851 this.quantifier = quantifier;
26852 }
26853
26854 @Override
26855 public OnnxType type() {
26856 return type;
26857 }
26858
26859 @Override
26860 public Quantifier quantifier() {
26861 return quantifier;
26862 }
26863 }
26864
26865 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26866 NAME,
26867 List.of(Attribute.values()),
26868 List.of(TypeConstraint.values()),
26869 List.of(InputParameter.values()),
26870 List.of(OutputParameter.values())
26871 );
26872
26873 public Shrink(ExternalizedOp def) {
26874 super(SCHEMA, def);
26875 }
26876
26877 Shrink(Shrink that, CodeContext cc) {
26878 super(that, cc);
26879 }
26880
26881 @Override
26882 public Shrink transform(CodeContext cc, CodeTransformer ot) {
26883 return new Shrink(this, cc);
26884 }
26885
26886 Shrink(CodeType resultType, Value input, java.util.Optional<Float> lambd, java.util.Optional<Float> bias) {
26887 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(lambd, bias));
26888 }
26889
26890 @Override
26891 public SequencedSet<OnnxParameter> onnxOutputs() {
26892 return onnxOutputs(SCHEMA);
26893 }
26894
26895 @Override
26896 public SequencedMap<OnnxParameter, Object> onnxInputs() {
26897 return onnxInputs(SCHEMA, List.of(input()));
26898 }
26899
26900 public Value input() {
26901 return operands().get(0);
26902 }
26903
26904 public java.util.Optional<Float> lambd() {
26905 Float lambd = Attribute.lambd.access(Float.class, onnxAttributes);
26906 return java.util.Optional.ofNullable(lambd);
26907 }
26908
26909 public java.util.Optional<Float> bias() {
26910 Float bias = Attribute.bias.access(Float.class, onnxAttributes);
26911 return java.util.Optional.ofNullable(bias);
26912 }
26913
26914 }
26915
26916 public static Shrink Shrink(CodeType resultType, Value input, java.util.Optional<Float> lambd, java.util.Optional<Float> bias) {
26917 return new Shrink(resultType, input, lambd, bias);
26918 }
26919
26920 @OpFactoryHelper.OpDeclaration(Sigmoid.NAME)
26921 public static final class Sigmoid extends OnnxOp {
26922 public static final String NAME = "Sigmoid";
26923
26924 public enum Attribute implements OnnxAttribute.None { }
26925
26926 public enum TypeConstraint implements OnnxTypeConstraint {
26927 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
26928 ;
26929
26930 final OnnxType.TypeVariable typeVariable;
26931
26932 TypeConstraint(OnnxType.TypeVariable typeVariable) {
26933 assert typeVariable.name().equals(name());
26934 this.typeVariable = typeVariable;
26935 }
26936
26937 @Override
26938 public OnnxType.TypeVariable typeVariable() {
26939 return typeVariable;
26940 }
26941 }
26942
26943 public enum InputParameter implements OnnxParameter {
26944 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
26945 ;
26946
26947 final OnnxType type;
26948 final Quantifier quantifier;
26949
26950 InputParameter(OnnxType type, Quantifier quantifier) {
26951 this.type = type;
26952 this.quantifier = quantifier;
26953 }
26954
26955 @Override
26956 public OnnxType type() {
26957 return type;
26958 }
26959
26960 @Override
26961 public Quantifier quantifier() {
26962 return quantifier;
26963 }
26964 }
26965
26966 public enum OutputParameter implements OnnxParameter {
26967 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
26968 ;
26969
26970 final OnnxType type;
26971 final Quantifier quantifier;
26972
26973 OutputParameter(OnnxType type, Quantifier quantifier) {
26974 this.type = type;
26975 this.quantifier = quantifier;
26976 }
26977
26978 @Override
26979 public OnnxType type() {
26980 return type;
26981 }
26982
26983 @Override
26984 public Quantifier quantifier() {
26985 return quantifier;
26986 }
26987 }
26988
26989 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
26990 NAME,
26991 List.of(Attribute.values()),
26992 List.of(TypeConstraint.values()),
26993 List.of(InputParameter.values()),
26994 List.of(OutputParameter.values())
26995 );
26996
26997 public Sigmoid(ExternalizedOp def) {
26998 super(SCHEMA, def);
26999 }
27000
27001 Sigmoid(Sigmoid that, CodeContext cc) {
27002 super(that, cc);
27003 }
27004
27005 @Override
27006 public Sigmoid transform(CodeContext cc, CodeTransformer ot) {
27007 return new Sigmoid(this, cc);
27008 }
27009
27010 Sigmoid(CodeType resultType, Value X) {
27011 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
27012 }
27013
27014 @Override
27015 public SequencedSet<OnnxParameter> onnxOutputs() {
27016 return onnxOutputs(SCHEMA);
27017 }
27018
27019 @Override
27020 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27021 return onnxInputs(SCHEMA, List.of(X()));
27022 }
27023
27024 public Value X() {
27025 return operands().get(0);
27026 }
27027
27028 }
27029
27030 public static Sigmoid Sigmoid(CodeType resultType, Value X) {
27031 return new Sigmoid(resultType, X);
27032 }
27033
27034 @OpFactoryHelper.OpDeclaration(Sign.NAME)
27035 public static final class Sign extends OnnxOp {
27036 public static final String NAME = "Sign";
27037
27038 public enum Attribute implements OnnxAttribute.None { }
27039
27040 public enum TypeConstraint implements OnnxTypeConstraint {
27041 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
27042 ;
27043
27044 final OnnxType.TypeVariable typeVariable;
27045
27046 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27047 assert typeVariable.name().equals(name());
27048 this.typeVariable = typeVariable;
27049 }
27050
27051 @Override
27052 public OnnxType.TypeVariable typeVariable() {
27053 return typeVariable;
27054 }
27055 }
27056
27057 public enum InputParameter implements OnnxParameter {
27058 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27059 ;
27060
27061 final OnnxType type;
27062 final Quantifier quantifier;
27063
27064 InputParameter(OnnxType type, Quantifier quantifier) {
27065 this.type = type;
27066 this.quantifier = quantifier;
27067 }
27068
27069 @Override
27070 public OnnxType type() {
27071 return type;
27072 }
27073
27074 @Override
27075 public Quantifier quantifier() {
27076 return quantifier;
27077 }
27078 }
27079
27080 public enum OutputParameter implements OnnxParameter {
27081 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27082 ;
27083
27084 final OnnxType type;
27085 final Quantifier quantifier;
27086
27087 OutputParameter(OnnxType type, Quantifier quantifier) {
27088 this.type = type;
27089 this.quantifier = quantifier;
27090 }
27091
27092 @Override
27093 public OnnxType type() {
27094 return type;
27095 }
27096
27097 @Override
27098 public Quantifier quantifier() {
27099 return quantifier;
27100 }
27101 }
27102
27103 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27104 NAME,
27105 List.of(Attribute.values()),
27106 List.of(TypeConstraint.values()),
27107 List.of(InputParameter.values()),
27108 List.of(OutputParameter.values())
27109 );
27110
27111 public Sign(ExternalizedOp def) {
27112 super(SCHEMA, def);
27113 }
27114
27115 Sign(Sign that, CodeContext cc) {
27116 super(that, cc);
27117 }
27118
27119 @Override
27120 public Sign transform(CodeContext cc, CodeTransformer ot) {
27121 return new Sign(this, cc);
27122 }
27123
27124 Sign(CodeType resultType, Value input) {
27125 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
27126 }
27127
27128 @Override
27129 public SequencedSet<OnnxParameter> onnxOutputs() {
27130 return onnxOutputs(SCHEMA);
27131 }
27132
27133 @Override
27134 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27135 return onnxInputs(SCHEMA, List.of(input()));
27136 }
27137
27138 public Value input() {
27139 return operands().get(0);
27140 }
27141
27142 }
27143
27144 public static Sign Sign(CodeType resultType, Value input) {
27145 return new Sign(resultType, input);
27146 }
27147
27148 @OpFactoryHelper.OpDeclaration(Sin.NAME)
27149 public static final class Sin extends OnnxOp {
27150 public static final String NAME = "Sin";
27151
27152 public enum Attribute implements OnnxAttribute.None { }
27153
27154 public enum TypeConstraint implements OnnxTypeConstraint {
27155 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
27156 ;
27157
27158 final OnnxType.TypeVariable typeVariable;
27159
27160 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27161 assert typeVariable.name().equals(name());
27162 this.typeVariable = typeVariable;
27163 }
27164
27165 @Override
27166 public OnnxType.TypeVariable typeVariable() {
27167 return typeVariable;
27168 }
27169 }
27170
27171 public enum InputParameter implements OnnxParameter {
27172 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27173 ;
27174
27175 final OnnxType type;
27176 final Quantifier quantifier;
27177
27178 InputParameter(OnnxType type, Quantifier quantifier) {
27179 this.type = type;
27180 this.quantifier = quantifier;
27181 }
27182
27183 @Override
27184 public OnnxType type() {
27185 return type;
27186 }
27187
27188 @Override
27189 public Quantifier quantifier() {
27190 return quantifier;
27191 }
27192 }
27193
27194 public enum OutputParameter implements OnnxParameter {
27195 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27196 ;
27197
27198 final OnnxType type;
27199 final Quantifier quantifier;
27200
27201 OutputParameter(OnnxType type, Quantifier quantifier) {
27202 this.type = type;
27203 this.quantifier = quantifier;
27204 }
27205
27206 @Override
27207 public OnnxType type() {
27208 return type;
27209 }
27210
27211 @Override
27212 public Quantifier quantifier() {
27213 return quantifier;
27214 }
27215 }
27216
27217 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27218 NAME,
27219 List.of(Attribute.values()),
27220 List.of(TypeConstraint.values()),
27221 List.of(InputParameter.values()),
27222 List.of(OutputParameter.values())
27223 );
27224
27225 public Sin(ExternalizedOp def) {
27226 super(SCHEMA, def);
27227 }
27228
27229 Sin(Sin that, CodeContext cc) {
27230 super(that, cc);
27231 }
27232
27233 @Override
27234 public Sin transform(CodeContext cc, CodeTransformer ot) {
27235 return new Sin(this, cc);
27236 }
27237
27238 Sin(CodeType resultType, Value input) {
27239 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
27240 }
27241
27242 @Override
27243 public SequencedSet<OnnxParameter> onnxOutputs() {
27244 return onnxOutputs(SCHEMA);
27245 }
27246
27247 @Override
27248 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27249 return onnxInputs(SCHEMA, List.of(input()));
27250 }
27251
27252 public Value input() {
27253 return operands().get(0);
27254 }
27255
27256 }
27257
27258 public static Sin Sin(CodeType resultType, Value input) {
27259 return new Sin(resultType, input);
27260 }
27261
27262 @OpFactoryHelper.OpDeclaration(Sinh.NAME)
27263 public static final class Sinh extends OnnxOp {
27264 public static final String NAME = "Sinh";
27265
27266 public enum Attribute implements OnnxAttribute.None { }
27267
27268 public enum TypeConstraint implements OnnxTypeConstraint {
27269 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
27270 ;
27271
27272 final OnnxType.TypeVariable typeVariable;
27273
27274 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27275 assert typeVariable.name().equals(name());
27276 this.typeVariable = typeVariable;
27277 }
27278
27279 @Override
27280 public OnnxType.TypeVariable typeVariable() {
27281 return typeVariable;
27282 }
27283 }
27284
27285 public enum InputParameter implements OnnxParameter {
27286 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27287 ;
27288
27289 final OnnxType type;
27290 final Quantifier quantifier;
27291
27292 InputParameter(OnnxType type, Quantifier quantifier) {
27293 this.type = type;
27294 this.quantifier = quantifier;
27295 }
27296
27297 @Override
27298 public OnnxType type() {
27299 return type;
27300 }
27301
27302 @Override
27303 public Quantifier quantifier() {
27304 return quantifier;
27305 }
27306 }
27307
27308 public enum OutputParameter implements OnnxParameter {
27309 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27310 ;
27311
27312 final OnnxType type;
27313 final Quantifier quantifier;
27314
27315 OutputParameter(OnnxType type, Quantifier quantifier) {
27316 this.type = type;
27317 this.quantifier = quantifier;
27318 }
27319
27320 @Override
27321 public OnnxType type() {
27322 return type;
27323 }
27324
27325 @Override
27326 public Quantifier quantifier() {
27327 return quantifier;
27328 }
27329 }
27330
27331 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27332 NAME,
27333 List.of(Attribute.values()),
27334 List.of(TypeConstraint.values()),
27335 List.of(InputParameter.values()),
27336 List.of(OutputParameter.values())
27337 );
27338
27339 public Sinh(ExternalizedOp def) {
27340 super(SCHEMA, def);
27341 }
27342
27343 Sinh(Sinh that, CodeContext cc) {
27344 super(that, cc);
27345 }
27346
27347 @Override
27348 public Sinh transform(CodeContext cc, CodeTransformer ot) {
27349 return new Sinh(this, cc);
27350 }
27351
27352 Sinh(CodeType resultType, Value input) {
27353 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
27354 }
27355
27356 @Override
27357 public SequencedSet<OnnxParameter> onnxOutputs() {
27358 return onnxOutputs(SCHEMA);
27359 }
27360
27361 @Override
27362 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27363 return onnxInputs(SCHEMA, List.of(input()));
27364 }
27365
27366 public Value input() {
27367 return operands().get(0);
27368 }
27369
27370 }
27371
27372 public static Sinh Sinh(CodeType resultType, Value input) {
27373 return new Sinh(resultType, input);
27374 }
27375
27376 @OpFactoryHelper.OpDeclaration(Size.NAME)
27377 public static final class Size extends OnnxOp {
27378 public static final String NAME = "Size";
27379
27380 public enum Attribute implements OnnxAttribute.None { }
27381
27382 public enum TypeConstraint implements OnnxTypeConstraint {
27383 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
27384 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))),
27385 ;
27386
27387 final OnnxType.TypeVariable typeVariable;
27388
27389 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27390 assert typeVariable.name().equals(name());
27391 this.typeVariable = typeVariable;
27392 }
27393
27394 @Override
27395 public OnnxType.TypeVariable typeVariable() {
27396 return typeVariable;
27397 }
27398 }
27399
27400 public enum InputParameter implements OnnxParameter {
27401 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27402 ;
27403
27404 final OnnxType type;
27405 final Quantifier quantifier;
27406
27407 InputParameter(OnnxType type, Quantifier quantifier) {
27408 this.type = type;
27409 this.quantifier = quantifier;
27410 }
27411
27412 @Override
27413 public OnnxType type() {
27414 return type;
27415 }
27416
27417 @Override
27418 public Quantifier quantifier() {
27419 return quantifier;
27420 }
27421 }
27422
27423 public enum OutputParameter implements OnnxParameter {
27424 size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
27425 ;
27426
27427 final OnnxType type;
27428 final Quantifier quantifier;
27429
27430 OutputParameter(OnnxType type, Quantifier quantifier) {
27431 this.type = type;
27432 this.quantifier = quantifier;
27433 }
27434
27435 @Override
27436 public OnnxType type() {
27437 return type;
27438 }
27439
27440 @Override
27441 public Quantifier quantifier() {
27442 return quantifier;
27443 }
27444 }
27445
27446 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27447 NAME,
27448 List.of(Attribute.values()),
27449 List.of(TypeConstraint.values()),
27450 List.of(InputParameter.values()),
27451 List.of(OutputParameter.values())
27452 );
27453
27454 public Size(ExternalizedOp def) {
27455 super(SCHEMA, def);
27456 }
27457
27458 Size(Size that, CodeContext cc) {
27459 super(that, cc);
27460 }
27461
27462 @Override
27463 public Size transform(CodeContext cc, CodeTransformer ot) {
27464 return new Size(this, cc);
27465 }
27466
27467 Size(CodeType resultType, Value data) {
27468 super(SCHEMA, resultType, Set.of(), List.of(data), List.of());
27469 }
27470
27471 @Override
27472 public SequencedSet<OnnxParameter> onnxOutputs() {
27473 return onnxOutputs(SCHEMA);
27474 }
27475
27476 @Override
27477 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27478 return onnxInputs(SCHEMA, List.of(data()));
27479 }
27480
27481 public Value data() {
27482 return operands().get(0);
27483 }
27484
27485 }
27486
27487 public static Size Size(CodeType resultType, Value data) {
27488 return new Size(resultType, data);
27489 }
27490
27491 @OpFactoryHelper.OpDeclaration(Slice.NAME)
27492 public static final class Slice extends OnnxOp {
27493 public static final String NAME = "Slice";
27494
27495 public enum Attribute implements OnnxAttribute.None { }
27496
27497 public enum TypeConstraint implements OnnxTypeConstraint {
27498 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
27499 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
27500 ;
27501
27502 final OnnxType.TypeVariable typeVariable;
27503
27504 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27505 assert typeVariable.name().equals(name());
27506 this.typeVariable = typeVariable;
27507 }
27508
27509 @Override
27510 public OnnxType.TypeVariable typeVariable() {
27511 return typeVariable;
27512 }
27513 }
27514
27515 public enum InputParameter implements OnnxParameter {
27516 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27517 starts(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
27518 ends(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
27519 axes(TypeConstraint.Tind.typeVariable(), Quantifier.OPTIONAL),
27520 steps(TypeConstraint.Tind.typeVariable(), Quantifier.OPTIONAL),
27521 ;
27522
27523 final OnnxType type;
27524 final Quantifier quantifier;
27525
27526 InputParameter(OnnxType type, Quantifier quantifier) {
27527 this.type = type;
27528 this.quantifier = quantifier;
27529 }
27530
27531 @Override
27532 public OnnxType type() {
27533 return type;
27534 }
27535
27536 @Override
27537 public Quantifier quantifier() {
27538 return quantifier;
27539 }
27540 }
27541
27542 public enum OutputParameter implements OnnxParameter {
27543 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27544 ;
27545
27546 final OnnxType type;
27547 final Quantifier quantifier;
27548
27549 OutputParameter(OnnxType type, Quantifier quantifier) {
27550 this.type = type;
27551 this.quantifier = quantifier;
27552 }
27553
27554 @Override
27555 public OnnxType type() {
27556 return type;
27557 }
27558
27559 @Override
27560 public Quantifier quantifier() {
27561 return quantifier;
27562 }
27563 }
27564
27565 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27566 NAME,
27567 List.of(Attribute.values()),
27568 List.of(TypeConstraint.values()),
27569 List.of(InputParameter.values()),
27570 List.of(OutputParameter.values())
27571 );
27572
27573 public Slice(ExternalizedOp def) {
27574 super(SCHEMA, def);
27575 }
27576
27577 Slice(Slice that, CodeContext cc) {
27578 super(that, cc);
27579 }
27580
27581 @Override
27582 public Slice transform(CodeContext cc, CodeTransformer ot) {
27583 return new Slice(this, cc);
27584 }
27585
27586 Slice(CodeType resultType, Value data, Value starts, Value ends, java.util.Optional<Value> axes, java.util.Optional<Value> steps) {
27587 super(SCHEMA, resultType, Set.of(), List.of(data, starts, ends, axes, steps), List.of());
27588 }
27589
27590 @Override
27591 public SequencedSet<OnnxParameter> onnxOutputs() {
27592 return onnxOutputs(SCHEMA);
27593 }
27594
27595 @Override
27596 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27597 return onnxInputs(SCHEMA, List.of(data(), starts(), ends(), axes(), steps()));
27598 }
27599
27600 public Value data() {
27601 return operands().get(0);
27602 }
27603
27604 public Value starts() {
27605 return operands().get(1);
27606 }
27607
27608 public Value ends() {
27609 return operands().get(2);
27610 }
27611
27612 public java.util.Optional<Value> axes() {
27613 int i = optionalInputArguments.indexOf(InputParameter.axes);
27614 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
27615 }
27616
27617 public java.util.Optional<Value> steps() {
27618 int i = optionalInputArguments.indexOf(InputParameter.steps);
27619 return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty();
27620 }
27621
27622 }
27623
27624 public static Slice Slice(CodeType resultType, Value data, Value starts, Value ends, java.util.Optional<Value> axes, java.util.Optional<Value> steps) {
27625 return new Slice(resultType, data, starts, ends, axes, steps);
27626 }
27627
27628 @OpFactoryHelper.OpDeclaration(Softmax.NAME)
27629 public static final class Softmax extends OnnxOp {
27630 public static final String NAME = "Softmax";
27631
27632 public enum Attribute implements OnnxAttribute {
27633 axis(Long.class, true, -1),
27634 ;
27635
27636 final Class<?> t;
27637 final boolean optional;
27638 final Object defaultValue;
27639
27640 Attribute(Class<?> type, boolean optional, Object defaultValue) {
27641 this.t = type;
27642 this.optional = optional;
27643 this.defaultValue = defaultValue;
27644 assert optional || defaultValue == null;
27645 }
27646
27647 public Class<?> type() {
27648 return t;
27649 }
27650
27651 public boolean isOptional() {
27652 return optional;
27653 }
27654
27655 public Object defaultValue() {
27656 return defaultValue;
27657 }
27658 }
27659
27660 public enum TypeConstraint implements OnnxTypeConstraint {
27661 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
27662 ;
27663
27664 final OnnxType.TypeVariable typeVariable;
27665
27666 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27667 assert typeVariable.name().equals(name());
27668 this.typeVariable = typeVariable;
27669 }
27670
27671 @Override
27672 public OnnxType.TypeVariable typeVariable() {
27673 return typeVariable;
27674 }
27675 }
27676
27677 public enum InputParameter implements OnnxParameter {
27678 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27679 ;
27680
27681 final OnnxType type;
27682 final Quantifier quantifier;
27683
27684 InputParameter(OnnxType type, Quantifier quantifier) {
27685 this.type = type;
27686 this.quantifier = quantifier;
27687 }
27688
27689 @Override
27690 public OnnxType type() {
27691 return type;
27692 }
27693
27694 @Override
27695 public Quantifier quantifier() {
27696 return quantifier;
27697 }
27698 }
27699
27700 public enum OutputParameter implements OnnxParameter {
27701 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27702 ;
27703
27704 final OnnxType type;
27705 final Quantifier quantifier;
27706
27707 OutputParameter(OnnxType type, Quantifier quantifier) {
27708 this.type = type;
27709 this.quantifier = quantifier;
27710 }
27711
27712 @Override
27713 public OnnxType type() {
27714 return type;
27715 }
27716
27717 @Override
27718 public Quantifier quantifier() {
27719 return quantifier;
27720 }
27721 }
27722
27723 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27724 NAME,
27725 List.of(Attribute.values()),
27726 List.of(TypeConstraint.values()),
27727 List.of(InputParameter.values()),
27728 List.of(OutputParameter.values())
27729 );
27730
27731 public Softmax(ExternalizedOp def) {
27732 super(SCHEMA, def);
27733 }
27734
27735 Softmax(Softmax that, CodeContext cc) {
27736 super(that, cc);
27737 }
27738
27739 @Override
27740 public Softmax transform(CodeContext cc, CodeTransformer ot) {
27741 return new Softmax(this, cc);
27742 }
27743
27744 Softmax(CodeType resultType, Value input, java.util.Optional<Long> axis) {
27745 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis));
27746 }
27747
27748 @Override
27749 public SequencedSet<OnnxParameter> onnxOutputs() {
27750 return onnxOutputs(SCHEMA);
27751 }
27752
27753 @Override
27754 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27755 return onnxInputs(SCHEMA, List.of(input()));
27756 }
27757
27758 public Value input() {
27759 return operands().get(0);
27760 }
27761
27762 public java.util.Optional<Long> axis() {
27763 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
27764 return java.util.Optional.ofNullable(axis);
27765 }
27766
27767 }
27768
27769 public static Softmax Softmax(CodeType resultType, Value input, java.util.Optional<Long> axis) {
27770 return new Softmax(resultType, input, axis);
27771 }
27772
27773 @OpFactoryHelper.OpDeclaration(SoftmaxCrossEntropyLoss.NAME)
27774 public static final class SoftmaxCrossEntropyLoss extends OnnxOp {
27775 public static final String NAME = "SoftmaxCrossEntropyLoss";
27776
27777 public enum Attribute implements OnnxAttribute {
27778 ignore_index(Long.class, true, null),
27779 reduction(String.class, true, "mean"),
27780 ;
27781
27782 final Class<?> t;
27783 final boolean optional;
27784 final Object defaultValue;
27785
27786 Attribute(Class<?> type, boolean optional, Object defaultValue) {
27787 this.t = type;
27788 this.optional = optional;
27789 this.defaultValue = defaultValue;
27790 assert optional || defaultValue == null;
27791 }
27792
27793 public Class<?> type() {
27794 return t;
27795 }
27796
27797 public boolean isOptional() {
27798 return optional;
27799 }
27800
27801 public Object defaultValue() {
27802 return defaultValue;
27803 }
27804 }
27805
27806 public enum TypeConstraint implements OnnxTypeConstraint {
27807 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
27808 Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
27809 ;
27810
27811 final OnnxType.TypeVariable typeVariable;
27812
27813 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27814 assert typeVariable.name().equals(name());
27815 this.typeVariable = typeVariable;
27816 }
27817
27818 @Override
27819 public OnnxType.TypeVariable typeVariable() {
27820 return typeVariable;
27821 }
27822 }
27823
27824 public enum InputParameter implements OnnxParameter {
27825 scores(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27826 labels(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED),
27827 weights(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
27828 ;
27829
27830 final OnnxType type;
27831 final Quantifier quantifier;
27832
27833 InputParameter(OnnxType type, Quantifier quantifier) {
27834 this.type = type;
27835 this.quantifier = quantifier;
27836 }
27837
27838 @Override
27839 public OnnxType type() {
27840 return type;
27841 }
27842
27843 @Override
27844 public Quantifier quantifier() {
27845 return quantifier;
27846 }
27847 }
27848
27849 public enum OutputParameter implements OnnxParameter {
27850 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27851 log_prob(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL),
27852 ;
27853
27854 final OnnxType type;
27855 final Quantifier quantifier;
27856
27857 OutputParameter(OnnxType type, Quantifier quantifier) {
27858 this.type = type;
27859 this.quantifier = quantifier;
27860 }
27861
27862 @Override
27863 public OnnxType type() {
27864 return type;
27865 }
27866
27867 @Override
27868 public Quantifier quantifier() {
27869 return quantifier;
27870 }
27871 }
27872
27873 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
27874 NAME,
27875 List.of(Attribute.values()),
27876 List.of(TypeConstraint.values()),
27877 List.of(InputParameter.values()),
27878 List.of(OutputParameter.values())
27879 );
27880
27881 public SoftmaxCrossEntropyLoss(ExternalizedOp def) {
27882 super(SCHEMA, def);
27883 }
27884
27885 SoftmaxCrossEntropyLoss(SoftmaxCrossEntropyLoss that, CodeContext cc) {
27886 super(that, cc);
27887 }
27888
27889 @Override
27890 public SoftmaxCrossEntropyLoss transform(CodeContext cc, CodeTransformer ot) {
27891 return new SoftmaxCrossEntropyLoss(this, cc);
27892 }
27893
27894 SoftmaxCrossEntropyLoss(CodeType resultType, Set<OutputParameter> optionalOutputs, Value scores, Value labels, java.util.Optional<Value> weights, java.util.Optional<Long> ignore_index, java.util.Optional<String> reduction) {
27895 super(SCHEMA, resultType, optionalOutputs, List.of(scores, labels, weights), List.of(ignore_index, reduction));
27896 }
27897
27898 @Override
27899 public SequencedSet<OnnxParameter> onnxOutputs() {
27900 return onnxOutputs(SCHEMA);
27901 }
27902
27903 @Override
27904 public SequencedMap<OnnxParameter, Object> onnxInputs() {
27905 return onnxInputs(SCHEMA, List.of(scores(), labels(), weights()));
27906 }
27907
27908 public Value scores() {
27909 return operands().get(0);
27910 }
27911
27912 public Value labels() {
27913 return operands().get(1);
27914 }
27915
27916 public java.util.Optional<Value> weights() {
27917 int i = optionalInputArguments.indexOf(InputParameter.weights);
27918 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
27919 }
27920
27921 public java.util.Optional<Long> ignore_index() {
27922 Long ignore_index = Attribute.ignore_index.access(Long.class, onnxAttributes);
27923 return java.util.Optional.ofNullable(ignore_index);
27924 }
27925
27926 public java.util.Optional<String> reduction() {
27927 String reduction = Attribute.reduction.access(String.class, onnxAttributes);
27928 return java.util.Optional.ofNullable(reduction);
27929 }
27930
27931 }
27932
27933 public static SoftmaxCrossEntropyLoss SoftmaxCrossEntropyLoss(CodeType resultType, Set<SoftmaxCrossEntropyLoss.OutputParameter> optionalOutputs, Value scores, Value labels, java.util.Optional<Value> weights, java.util.Optional<Long> ignore_index, java.util.Optional<String> reduction) {
27934 return new SoftmaxCrossEntropyLoss(resultType, optionalOutputs, scores, labels, weights, ignore_index, reduction);
27935 }
27936
27937 @OpFactoryHelper.OpDeclaration(Softplus.NAME)
27938 public static final class Softplus extends OnnxOp {
27939 public static final String NAME = "Softplus";
27940
27941 public enum Attribute implements OnnxAttribute.None { }
27942
27943 public enum TypeConstraint implements OnnxTypeConstraint {
27944 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
27945 ;
27946
27947 final OnnxType.TypeVariable typeVariable;
27948
27949 TypeConstraint(OnnxType.TypeVariable typeVariable) {
27950 assert typeVariable.name().equals(name());
27951 this.typeVariable = typeVariable;
27952 }
27953
27954 @Override
27955 public OnnxType.TypeVariable typeVariable() {
27956 return typeVariable;
27957 }
27958 }
27959
27960 public enum InputParameter implements OnnxParameter {
27961 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27962 ;
27963
27964 final OnnxType type;
27965 final Quantifier quantifier;
27966
27967 InputParameter(OnnxType type, Quantifier quantifier) {
27968 this.type = type;
27969 this.quantifier = quantifier;
27970 }
27971
27972 @Override
27973 public OnnxType type() {
27974 return type;
27975 }
27976
27977 @Override
27978 public Quantifier quantifier() {
27979 return quantifier;
27980 }
27981 }
27982
27983 public enum OutputParameter implements OnnxParameter {
27984 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
27985 ;
27986
27987 final OnnxType type;
27988 final Quantifier quantifier;
27989
27990 OutputParameter(OnnxType type, Quantifier quantifier) {
27991 this.type = type;
27992 this.quantifier = quantifier;
27993 }
27994
27995 @Override
27996 public OnnxType type() {
27997 return type;
27998 }
27999
28000 @Override
28001 public Quantifier quantifier() {
28002 return quantifier;
28003 }
28004 }
28005
28006 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28007 NAME,
28008 List.of(Attribute.values()),
28009 List.of(TypeConstraint.values()),
28010 List.of(InputParameter.values()),
28011 List.of(OutputParameter.values())
28012 );
28013
28014 public Softplus(ExternalizedOp def) {
28015 super(SCHEMA, def);
28016 }
28017
28018 Softplus(Softplus that, CodeContext cc) {
28019 super(that, cc);
28020 }
28021
28022 @Override
28023 public Softplus transform(CodeContext cc, CodeTransformer ot) {
28024 return new Softplus(this, cc);
28025 }
28026
28027 Softplus(CodeType resultType, Value X) {
28028 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
28029 }
28030
28031 @Override
28032 public SequencedSet<OnnxParameter> onnxOutputs() {
28033 return onnxOutputs(SCHEMA);
28034 }
28035
28036 @Override
28037 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28038 return onnxInputs(SCHEMA, List.of(X()));
28039 }
28040
28041 public Value X() {
28042 return operands().get(0);
28043 }
28044
28045 }
28046
28047 public static Softplus Softplus(CodeType resultType, Value X) {
28048 return new Softplus(resultType, X);
28049 }
28050
28051 @OpFactoryHelper.OpDeclaration(Softsign.NAME)
28052 public static final class Softsign extends OnnxOp {
28053 public static final String NAME = "Softsign";
28054
28055 public enum Attribute implements OnnxAttribute.None { }
28056
28057 public enum TypeConstraint implements OnnxTypeConstraint {
28058 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
28059 ;
28060
28061 final OnnxType.TypeVariable typeVariable;
28062
28063 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28064 assert typeVariable.name().equals(name());
28065 this.typeVariable = typeVariable;
28066 }
28067
28068 @Override
28069 public OnnxType.TypeVariable typeVariable() {
28070 return typeVariable;
28071 }
28072 }
28073
28074 public enum InputParameter implements OnnxParameter {
28075 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28076 ;
28077
28078 final OnnxType type;
28079 final Quantifier quantifier;
28080
28081 InputParameter(OnnxType type, Quantifier quantifier) {
28082 this.type = type;
28083 this.quantifier = quantifier;
28084 }
28085
28086 @Override
28087 public OnnxType type() {
28088 return type;
28089 }
28090
28091 @Override
28092 public Quantifier quantifier() {
28093 return quantifier;
28094 }
28095 }
28096
28097 public enum OutputParameter implements OnnxParameter {
28098 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28099 ;
28100
28101 final OnnxType type;
28102 final Quantifier quantifier;
28103
28104 OutputParameter(OnnxType type, Quantifier quantifier) {
28105 this.type = type;
28106 this.quantifier = quantifier;
28107 }
28108
28109 @Override
28110 public OnnxType type() {
28111 return type;
28112 }
28113
28114 @Override
28115 public Quantifier quantifier() {
28116 return quantifier;
28117 }
28118 }
28119
28120 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28121 NAME,
28122 List.of(Attribute.values()),
28123 List.of(TypeConstraint.values()),
28124 List.of(InputParameter.values()),
28125 List.of(OutputParameter.values())
28126 );
28127
28128 public Softsign(ExternalizedOp def) {
28129 super(SCHEMA, def);
28130 }
28131
28132 Softsign(Softsign that, CodeContext cc) {
28133 super(that, cc);
28134 }
28135
28136 @Override
28137 public Softsign transform(CodeContext cc, CodeTransformer ot) {
28138 return new Softsign(this, cc);
28139 }
28140
28141 Softsign(CodeType resultType, Value input) {
28142 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
28143 }
28144
28145 @Override
28146 public SequencedSet<OnnxParameter> onnxOutputs() {
28147 return onnxOutputs(SCHEMA);
28148 }
28149
28150 @Override
28151 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28152 return onnxInputs(SCHEMA, List.of(input()));
28153 }
28154
28155 public Value input() {
28156 return operands().get(0);
28157 }
28158
28159 }
28160
28161 public static Softsign Softsign(CodeType resultType, Value input) {
28162 return new Softsign(resultType, input);
28163 }
28164
28165 @OpFactoryHelper.OpDeclaration(SpaceToDepth.NAME)
28166 public static final class SpaceToDepth extends OnnxOp {
28167 public static final String NAME = "SpaceToDepth";
28168
28169 public enum Attribute implements OnnxAttribute {
28170 blocksize(Long.class, false, null),
28171 ;
28172
28173 final Class<?> t;
28174 final boolean optional;
28175 final Object defaultValue;
28176
28177 Attribute(Class<?> type, boolean optional, Object defaultValue) {
28178 this.t = type;
28179 this.optional = optional;
28180 this.defaultValue = defaultValue;
28181 assert optional || defaultValue == null;
28182 }
28183
28184 public Class<?> type() {
28185 return t;
28186 }
28187
28188 public boolean isOptional() {
28189 return optional;
28190 }
28191
28192 public Object defaultValue() {
28193 return defaultValue;
28194 }
28195 }
28196
28197 public enum TypeConstraint implements OnnxTypeConstraint {
28198 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
28199 ;
28200
28201 final OnnxType.TypeVariable typeVariable;
28202
28203 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28204 assert typeVariable.name().equals(name());
28205 this.typeVariable = typeVariable;
28206 }
28207
28208 @Override
28209 public OnnxType.TypeVariable typeVariable() {
28210 return typeVariable;
28211 }
28212 }
28213
28214 public enum InputParameter implements OnnxParameter {
28215 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28216 ;
28217
28218 final OnnxType type;
28219 final Quantifier quantifier;
28220
28221 InputParameter(OnnxType type, Quantifier quantifier) {
28222 this.type = type;
28223 this.quantifier = quantifier;
28224 }
28225
28226 @Override
28227 public OnnxType type() {
28228 return type;
28229 }
28230
28231 @Override
28232 public Quantifier quantifier() {
28233 return quantifier;
28234 }
28235 }
28236
28237 public enum OutputParameter implements OnnxParameter {
28238 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28239 ;
28240
28241 final OnnxType type;
28242 final Quantifier quantifier;
28243
28244 OutputParameter(OnnxType type, Quantifier quantifier) {
28245 this.type = type;
28246 this.quantifier = quantifier;
28247 }
28248
28249 @Override
28250 public OnnxType type() {
28251 return type;
28252 }
28253
28254 @Override
28255 public Quantifier quantifier() {
28256 return quantifier;
28257 }
28258 }
28259
28260 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28261 NAME,
28262 List.of(Attribute.values()),
28263 List.of(TypeConstraint.values()),
28264 List.of(InputParameter.values()),
28265 List.of(OutputParameter.values())
28266 );
28267
28268 public SpaceToDepth(ExternalizedOp def) {
28269 super(SCHEMA, def);
28270 }
28271
28272 SpaceToDepth(SpaceToDepth that, CodeContext cc) {
28273 super(that, cc);
28274 }
28275
28276 @Override
28277 public SpaceToDepth transform(CodeContext cc, CodeTransformer ot) {
28278 return new SpaceToDepth(this, cc);
28279 }
28280
28281 SpaceToDepth(CodeType resultType, Value input, long blocksize) {
28282 super(SCHEMA, resultType, Set.of(), List.of(input), List.of(blocksize));
28283 }
28284
28285 @Override
28286 public SequencedSet<OnnxParameter> onnxOutputs() {
28287 return onnxOutputs(SCHEMA);
28288 }
28289
28290 @Override
28291 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28292 return onnxInputs(SCHEMA, List.of(input()));
28293 }
28294
28295 public Value input() {
28296 return operands().get(0);
28297 }
28298
28299 public long blocksize() {
28300 long blocksize = Attribute.blocksize.access(Long.class, onnxAttributes);
28301 return blocksize;
28302 }
28303
28304 }
28305
28306 public static SpaceToDepth SpaceToDepth(CodeType resultType, Value input, long blocksize) {
28307 return new SpaceToDepth(resultType, input, blocksize);
28308 }
28309
28310 @OpFactoryHelper.OpDeclaration(Split.NAME)
28311 public static final class Split extends OnnxOp {
28312 public static final String NAME = "Split";
28313
28314 public enum Attribute implements OnnxAttribute {
28315 num_outputs(Long.class, true, null),
28316 axis(Long.class, true, 0),
28317 ;
28318
28319 final Class<?> t;
28320 final boolean optional;
28321 final Object defaultValue;
28322
28323 Attribute(Class<?> type, boolean optional, Object defaultValue) {
28324 this.t = type;
28325 this.optional = optional;
28326 this.defaultValue = defaultValue;
28327 assert optional || defaultValue == null;
28328 }
28329
28330 public Class<?> type() {
28331 return t;
28332 }
28333
28334 public boolean isOptional() {
28335 return optional;
28336 }
28337
28338 public Object defaultValue() {
28339 return defaultValue;
28340 }
28341 }
28342
28343 public enum TypeConstraint implements OnnxTypeConstraint {
28344 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
28345 ;
28346
28347 final OnnxType.TypeVariable typeVariable;
28348
28349 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28350 assert typeVariable.name().equals(name());
28351 this.typeVariable = typeVariable;
28352 }
28353
28354 @Override
28355 public OnnxType.TypeVariable typeVariable() {
28356 return typeVariable;
28357 }
28358 }
28359
28360 public enum InputParameter implements OnnxParameter {
28361 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28362 split(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
28363 ;
28364
28365 final OnnxType type;
28366 final Quantifier quantifier;
28367
28368 InputParameter(OnnxType type, Quantifier quantifier) {
28369 this.type = type;
28370 this.quantifier = quantifier;
28371 }
28372
28373 @Override
28374 public OnnxType type() {
28375 return type;
28376 }
28377
28378 @Override
28379 public Quantifier quantifier() {
28380 return quantifier;
28381 }
28382 }
28383
28384 public enum OutputParameter implements OnnxParameter {
28385 outputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
28386 ;
28387
28388 final OnnxType type;
28389 final Quantifier quantifier;
28390
28391 OutputParameter(OnnxType type, Quantifier quantifier) {
28392 this.type = type;
28393 this.quantifier = quantifier;
28394 }
28395
28396 @Override
28397 public OnnxType type() {
28398 return type;
28399 }
28400
28401 @Override
28402 public Quantifier quantifier() {
28403 return quantifier;
28404 }
28405 }
28406
28407 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28408 NAME,
28409 List.of(Attribute.values()),
28410 List.of(TypeConstraint.values()),
28411 List.of(InputParameter.values()),
28412 List.of(OutputParameter.values())
28413 );
28414
28415 public Split(ExternalizedOp def) {
28416 super(SCHEMA, def);
28417 }
28418
28419 Split(Split that, CodeContext cc) {
28420 super(that, cc);
28421 }
28422
28423 @Override
28424 public Split transform(CodeContext cc, CodeTransformer ot) {
28425 return new Split(this, cc);
28426 }
28427
28428 Split(CodeType resultType, Value input, java.util.Optional<Value> split, java.util.Optional<Long> num_outputs, java.util.Optional<Long> axis) {
28429 super(SCHEMA, resultType, Set.of(), List.of(input, split), List.of(num_outputs, axis));
28430 }
28431
28432 @Override
28433 public SequencedSet<OnnxParameter> onnxOutputs() {
28434 return onnxOutputs(SCHEMA);
28435 }
28436
28437 @Override
28438 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28439 return onnxInputs(SCHEMA, List.of(input(), split()));
28440 }
28441
28442 public Value input() {
28443 return operands().get(0);
28444 }
28445
28446 public java.util.Optional<Value> split() {
28447 int i = optionalInputArguments.indexOf(InputParameter.split);
28448 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
28449 }
28450
28451 public java.util.Optional<Long> num_outputs() {
28452 Long num_outputs = Attribute.num_outputs.access(Long.class, onnxAttributes);
28453 return java.util.Optional.ofNullable(num_outputs);
28454 }
28455
28456 public java.util.Optional<Long> axis() {
28457 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
28458 return java.util.Optional.ofNullable(axis);
28459 }
28460
28461 }
28462
28463 public static Split Split(CodeType resultType, Value input, java.util.Optional<Value> split, java.util.Optional<Long> num_outputs, java.util.Optional<Long> axis) {
28464 return new Split(resultType, input, split, num_outputs, axis);
28465 }
28466
28467 @OpFactoryHelper.OpDeclaration(SplitToSequence.NAME)
28468 public static final class SplitToSequence extends OnnxOp {
28469 public static final String NAME = "SplitToSequence";
28470
28471 public enum Attribute implements OnnxAttribute {
28472 keepdims(Long.class, true, 1),
28473 axis(Long.class, true, 0),
28474 ;
28475
28476 final Class<?> t;
28477 final boolean optional;
28478 final Object defaultValue;
28479
28480 Attribute(Class<?> type, boolean optional, Object defaultValue) {
28481 this.t = type;
28482 this.optional = optional;
28483 this.defaultValue = defaultValue;
28484 assert optional || defaultValue == null;
28485 }
28486
28487 public Class<?> type() {
28488 return t;
28489 }
28490
28491 public boolean isOptional() {
28492 return optional;
28493 }
28494
28495 public Object defaultValue() {
28496 return defaultValue;
28497 }
28498 }
28499
28500 public enum TypeConstraint implements OnnxTypeConstraint {
28501 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
28502 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
28503 S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.bfloat16())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))),
28504 ;
28505
28506 final OnnxType.TypeVariable typeVariable;
28507
28508 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28509 assert typeVariable.name().equals(name());
28510 this.typeVariable = typeVariable;
28511 }
28512
28513 @Override
28514 public OnnxType.TypeVariable typeVariable() {
28515 return typeVariable;
28516 }
28517 }
28518
28519 public enum InputParameter implements OnnxParameter {
28520 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28521 split(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL),
28522 ;
28523
28524 final OnnxType type;
28525 final Quantifier quantifier;
28526
28527 InputParameter(OnnxType type, Quantifier quantifier) {
28528 this.type = type;
28529 this.quantifier = quantifier;
28530 }
28531
28532 @Override
28533 public OnnxType type() {
28534 return type;
28535 }
28536
28537 @Override
28538 public Quantifier quantifier() {
28539 return quantifier;
28540 }
28541 }
28542
28543 public enum OutputParameter implements OnnxParameter {
28544 output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED),
28545 ;
28546
28547 final OnnxType type;
28548 final Quantifier quantifier;
28549
28550 OutputParameter(OnnxType type, Quantifier quantifier) {
28551 this.type = type;
28552 this.quantifier = quantifier;
28553 }
28554
28555 @Override
28556 public OnnxType type() {
28557 return type;
28558 }
28559
28560 @Override
28561 public Quantifier quantifier() {
28562 return quantifier;
28563 }
28564 }
28565
28566 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28567 NAME,
28568 List.of(Attribute.values()),
28569 List.of(TypeConstraint.values()),
28570 List.of(InputParameter.values()),
28571 List.of(OutputParameter.values())
28572 );
28573
28574 public SplitToSequence(ExternalizedOp def) {
28575 super(SCHEMA, def);
28576 }
28577
28578 SplitToSequence(SplitToSequence that, CodeContext cc) {
28579 super(that, cc);
28580 }
28581
28582 @Override
28583 public SplitToSequence transform(CodeContext cc, CodeTransformer ot) {
28584 return new SplitToSequence(this, cc);
28585 }
28586
28587 SplitToSequence(CodeType resultType, Value input, java.util.Optional<Value> split, java.util.Optional<Long> keepdims, java.util.Optional<Long> axis) {
28588 super(SCHEMA, resultType, Set.of(), List.of(input, split), List.of(keepdims, axis));
28589 }
28590
28591 @Override
28592 public SequencedSet<OnnxParameter> onnxOutputs() {
28593 return onnxOutputs(SCHEMA);
28594 }
28595
28596 @Override
28597 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28598 return onnxInputs(SCHEMA, List.of(input(), split()));
28599 }
28600
28601 public Value input() {
28602 return operands().get(0);
28603 }
28604
28605 public java.util.Optional<Value> split() {
28606 int i = optionalInputArguments.indexOf(InputParameter.split);
28607 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
28608 }
28609
28610 public java.util.Optional<Long> keepdims() {
28611 Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes);
28612 return java.util.Optional.ofNullable(keepdims);
28613 }
28614
28615 public java.util.Optional<Long> axis() {
28616 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
28617 return java.util.Optional.ofNullable(axis);
28618 }
28619
28620 }
28621
28622 public static SplitToSequence SplitToSequence(CodeType resultType, Value input, java.util.Optional<Value> split, java.util.Optional<Long> keepdims, java.util.Optional<Long> axis) {
28623 return new SplitToSequence(resultType, input, split, keepdims, axis);
28624 }
28625
28626 @OpFactoryHelper.OpDeclaration(Sqrt.NAME)
28627 public static final class Sqrt extends OnnxOp {
28628 public static final String NAME = "Sqrt";
28629
28630 public enum Attribute implements OnnxAttribute.None { }
28631
28632 public enum TypeConstraint implements OnnxTypeConstraint {
28633 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
28634 ;
28635
28636 final OnnxType.TypeVariable typeVariable;
28637
28638 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28639 assert typeVariable.name().equals(name());
28640 this.typeVariable = typeVariable;
28641 }
28642
28643 @Override
28644 public OnnxType.TypeVariable typeVariable() {
28645 return typeVariable;
28646 }
28647 }
28648
28649 public enum InputParameter implements OnnxParameter {
28650 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28651 ;
28652
28653 final OnnxType type;
28654 final Quantifier quantifier;
28655
28656 InputParameter(OnnxType type, Quantifier quantifier) {
28657 this.type = type;
28658 this.quantifier = quantifier;
28659 }
28660
28661 @Override
28662 public OnnxType type() {
28663 return type;
28664 }
28665
28666 @Override
28667 public Quantifier quantifier() {
28668 return quantifier;
28669 }
28670 }
28671
28672 public enum OutputParameter implements OnnxParameter {
28673 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28674 ;
28675
28676 final OnnxType type;
28677 final Quantifier quantifier;
28678
28679 OutputParameter(OnnxType type, Quantifier quantifier) {
28680 this.type = type;
28681 this.quantifier = quantifier;
28682 }
28683
28684 @Override
28685 public OnnxType type() {
28686 return type;
28687 }
28688
28689 @Override
28690 public Quantifier quantifier() {
28691 return quantifier;
28692 }
28693 }
28694
28695 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28696 NAME,
28697 List.of(Attribute.values()),
28698 List.of(TypeConstraint.values()),
28699 List.of(InputParameter.values()),
28700 List.of(OutputParameter.values())
28701 );
28702
28703 public Sqrt(ExternalizedOp def) {
28704 super(SCHEMA, def);
28705 }
28706
28707 Sqrt(Sqrt that, CodeContext cc) {
28708 super(that, cc);
28709 }
28710
28711 @Override
28712 public Sqrt transform(CodeContext cc, CodeTransformer ot) {
28713 return new Sqrt(this, cc);
28714 }
28715
28716 Sqrt(CodeType resultType, Value X) {
28717 super(SCHEMA, resultType, Set.of(), List.of(X), List.of());
28718 }
28719
28720 @Override
28721 public SequencedSet<OnnxParameter> onnxOutputs() {
28722 return onnxOutputs(SCHEMA);
28723 }
28724
28725 @Override
28726 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28727 return onnxInputs(SCHEMA, List.of(X()));
28728 }
28729
28730 public Value X() {
28731 return operands().get(0);
28732 }
28733
28734 }
28735
28736 public static Sqrt Sqrt(CodeType resultType, Value X) {
28737 return new Sqrt(resultType, X);
28738 }
28739
28740 @OpFactoryHelper.OpDeclaration(Squeeze.NAME)
28741 public static final class Squeeze extends OnnxOp {
28742 public static final String NAME = "Squeeze";
28743
28744 public enum Attribute implements OnnxAttribute.None { }
28745
28746 public enum TypeConstraint implements OnnxTypeConstraint {
28747 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
28748 ;
28749
28750 final OnnxType.TypeVariable typeVariable;
28751
28752 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28753 assert typeVariable.name().equals(name());
28754 this.typeVariable = typeVariable;
28755 }
28756
28757 @Override
28758 public OnnxType.TypeVariable typeVariable() {
28759 return typeVariable;
28760 }
28761 }
28762
28763 public enum InputParameter implements OnnxParameter {
28764 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28765 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
28766 ;
28767
28768 final OnnxType type;
28769 final Quantifier quantifier;
28770
28771 InputParameter(OnnxType type, Quantifier quantifier) {
28772 this.type = type;
28773 this.quantifier = quantifier;
28774 }
28775
28776 @Override
28777 public OnnxType type() {
28778 return type;
28779 }
28780
28781 @Override
28782 public Quantifier quantifier() {
28783 return quantifier;
28784 }
28785 }
28786
28787 public enum OutputParameter implements OnnxParameter {
28788 squeezed(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28789 ;
28790
28791 final OnnxType type;
28792 final Quantifier quantifier;
28793
28794 OutputParameter(OnnxType type, Quantifier quantifier) {
28795 this.type = type;
28796 this.quantifier = quantifier;
28797 }
28798
28799 @Override
28800 public OnnxType type() {
28801 return type;
28802 }
28803
28804 @Override
28805 public Quantifier quantifier() {
28806 return quantifier;
28807 }
28808 }
28809
28810 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28811 NAME,
28812 List.of(Attribute.values()),
28813 List.of(TypeConstraint.values()),
28814 List.of(InputParameter.values()),
28815 List.of(OutputParameter.values())
28816 );
28817
28818 public Squeeze(ExternalizedOp def) {
28819 super(SCHEMA, def);
28820 }
28821
28822 Squeeze(Squeeze that, CodeContext cc) {
28823 super(that, cc);
28824 }
28825
28826 @Override
28827 public Squeeze transform(CodeContext cc, CodeTransformer ot) {
28828 return new Squeeze(this, cc);
28829 }
28830
28831 Squeeze(CodeType resultType, Value data, java.util.Optional<Value> axes) {
28832 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of());
28833 }
28834
28835 @Override
28836 public SequencedSet<OnnxParameter> onnxOutputs() {
28837 return onnxOutputs(SCHEMA);
28838 }
28839
28840 @Override
28841 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28842 return onnxInputs(SCHEMA, List.of(data(), axes()));
28843 }
28844
28845 public Value data() {
28846 return operands().get(0);
28847 }
28848
28849 public java.util.Optional<Value> axes() {
28850 int i = optionalInputArguments.indexOf(InputParameter.axes);
28851 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
28852 }
28853
28854 }
28855
28856 public static Squeeze Squeeze(CodeType resultType, Value data, java.util.Optional<Value> axes) {
28857 return new Squeeze(resultType, data, axes);
28858 }
28859
28860 @OpFactoryHelper.OpDeclaration(StringConcat.NAME)
28861 public static final class StringConcat extends OnnxOp {
28862 public static final String NAME = "StringConcat";
28863
28864 public enum Attribute implements OnnxAttribute.None { }
28865
28866 public enum TypeConstraint implements OnnxTypeConstraint {
28867 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.string())))),
28868 ;
28869
28870 final OnnxType.TypeVariable typeVariable;
28871
28872 TypeConstraint(OnnxType.TypeVariable typeVariable) {
28873 assert typeVariable.name().equals(name());
28874 this.typeVariable = typeVariable;
28875 }
28876
28877 @Override
28878 public OnnxType.TypeVariable typeVariable() {
28879 return typeVariable;
28880 }
28881 }
28882
28883 public enum InputParameter implements OnnxParameter {
28884 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28885 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28886 ;
28887
28888 final OnnxType type;
28889 final Quantifier quantifier;
28890
28891 InputParameter(OnnxType type, Quantifier quantifier) {
28892 this.type = type;
28893 this.quantifier = quantifier;
28894 }
28895
28896 @Override
28897 public OnnxType type() {
28898 return type;
28899 }
28900
28901 @Override
28902 public Quantifier quantifier() {
28903 return quantifier;
28904 }
28905 }
28906
28907 public enum OutputParameter implements OnnxParameter {
28908 Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
28909 ;
28910
28911 final OnnxType type;
28912 final Quantifier quantifier;
28913
28914 OutputParameter(OnnxType type, Quantifier quantifier) {
28915 this.type = type;
28916 this.quantifier = quantifier;
28917 }
28918
28919 @Override
28920 public OnnxType type() {
28921 return type;
28922 }
28923
28924 @Override
28925 public Quantifier quantifier() {
28926 return quantifier;
28927 }
28928 }
28929
28930 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
28931 NAME,
28932 List.of(Attribute.values()),
28933 List.of(TypeConstraint.values()),
28934 List.of(InputParameter.values()),
28935 List.of(OutputParameter.values())
28936 );
28937
28938 public StringConcat(ExternalizedOp def) {
28939 super(SCHEMA, def);
28940 }
28941
28942 StringConcat(StringConcat that, CodeContext cc) {
28943 super(that, cc);
28944 }
28945
28946 @Override
28947 public StringConcat transform(CodeContext cc, CodeTransformer ot) {
28948 return new StringConcat(this, cc);
28949 }
28950
28951 StringConcat(CodeType resultType, Value X, Value Y) {
28952 super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of());
28953 }
28954
28955 @Override
28956 public SequencedSet<OnnxParameter> onnxOutputs() {
28957 return onnxOutputs(SCHEMA);
28958 }
28959
28960 @Override
28961 public SequencedMap<OnnxParameter, Object> onnxInputs() {
28962 return onnxInputs(SCHEMA, List.of(X(), Y()));
28963 }
28964
28965 public Value X() {
28966 return operands().get(0);
28967 }
28968
28969 public Value Y() {
28970 return operands().get(1);
28971 }
28972
28973 }
28974
28975 public static StringConcat StringConcat(CodeType resultType, Value X, Value Y) {
28976 return new StringConcat(resultType, X, Y);
28977 }
28978
28979 @OpFactoryHelper.OpDeclaration(StringNormalizer.NAME)
28980 public static final class StringNormalizer extends OnnxOp {
28981 public static final String NAME = "StringNormalizer";
28982
28983 public enum Attribute implements OnnxAttribute {
28984 is_case_sensitive(Long.class, true, 0),
28985 locale(String.class, true, null),
28986 stopwords(String[].class, true, null),
28987 case_change_action(String.class, true, "NONE"),
28988 ;
28989
28990 final Class<?> t;
28991 final boolean optional;
28992 final Object defaultValue;
28993
28994 Attribute(Class<?> type, boolean optional, Object defaultValue) {
28995 this.t = type;
28996 this.optional = optional;
28997 this.defaultValue = defaultValue;
28998 assert optional || defaultValue == null;
28999 }
29000
29001 public Class<?> type() {
29002 return t;
29003 }
29004
29005 public boolean isOptional() {
29006 return optional;
29007 }
29008
29009 public Object defaultValue() {
29010 return defaultValue;
29011 }
29012 }
29013
29014 public enum TypeConstraint implements OnnxTypeConstraint.None { }
29015
29016 public enum InputParameter implements OnnxParameter {
29017 X(OnnxType.tensor(OnnxType.string()), Quantifier.REQUIRED),
29018 ;
29019
29020 final OnnxType type;
29021 final Quantifier quantifier;
29022
29023 InputParameter(OnnxType type, Quantifier quantifier) {
29024 this.type = type;
29025 this.quantifier = quantifier;
29026 }
29027
29028 @Override
29029 public OnnxType type() {
29030 return type;
29031 }
29032
29033 @Override
29034 public Quantifier quantifier() {
29035 return quantifier;
29036 }
29037 }
29038
29039 public enum OutputParameter implements OnnxParameter {
29040 Y(OnnxType.tensor(OnnxType.string()), Quantifier.REQUIRED),
29041 ;
29042
29043 final OnnxType type;
29044 final Quantifier quantifier;
29045
29046 OutputParameter(OnnxType type, Quantifier quantifier) {
29047 this.type = type;
29048 this.quantifier = quantifier;
29049 }
29050
29051 @Override
29052 public OnnxType type() {
29053 return type;
29054 }
29055
29056 @Override
29057 public Quantifier quantifier() {
29058 return quantifier;
29059 }
29060 }
29061
29062 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29063 NAME,
29064 List.of(Attribute.values()),
29065 List.of(TypeConstraint.values()),
29066 List.of(InputParameter.values()),
29067 List.of(OutputParameter.values())
29068 );
29069
29070 public StringNormalizer(ExternalizedOp def) {
29071 super(SCHEMA, def);
29072 }
29073
29074 StringNormalizer(StringNormalizer that, CodeContext cc) {
29075 super(that, cc);
29076 }
29077
29078 @Override
29079 public StringNormalizer transform(CodeContext cc, CodeTransformer ot) {
29080 return new StringNormalizer(this, cc);
29081 }
29082
29083 StringNormalizer(CodeType resultType, Value X, java.util.Optional<Long> is_case_sensitive, java.util.Optional<String> locale, java.util.Optional<String[]> stopwords, java.util.Optional<String> case_change_action) {
29084 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(is_case_sensitive, locale, stopwords, case_change_action));
29085 }
29086
29087 @Override
29088 public SequencedSet<OnnxParameter> onnxOutputs() {
29089 return onnxOutputs(SCHEMA);
29090 }
29091
29092 @Override
29093 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29094 return onnxInputs(SCHEMA, List.of(X()));
29095 }
29096
29097 public Value X() {
29098 return operands().get(0);
29099 }
29100
29101 public java.util.Optional<Long> is_case_sensitive() {
29102 Long is_case_sensitive = Attribute.is_case_sensitive.access(Long.class, onnxAttributes);
29103 return java.util.Optional.ofNullable(is_case_sensitive);
29104 }
29105
29106 public java.util.Optional<String> locale() {
29107 String locale = Attribute.locale.access(String.class, onnxAttributes);
29108 return java.util.Optional.ofNullable(locale);
29109 }
29110
29111 public java.util.Optional<String[]> stopwords() {
29112 String[] stopwords = Attribute.stopwords.access(String[].class, onnxAttributes);
29113 return java.util.Optional.ofNullable(stopwords).map(String[]::clone);
29114 }
29115
29116 public java.util.Optional<String> case_change_action() {
29117 String case_change_action = Attribute.case_change_action.access(String.class, onnxAttributes);
29118 return java.util.Optional.ofNullable(case_change_action);
29119 }
29120
29121 }
29122
29123 public static StringNormalizer StringNormalizer(CodeType resultType, Value X, java.util.Optional<Long> is_case_sensitive, java.util.Optional<String> locale, java.util.Optional<String[]> stopwords, java.util.Optional<String> case_change_action) {
29124 return new StringNormalizer(resultType, X, is_case_sensitive, locale, stopwords, case_change_action);
29125 }
29126
29127 @OpFactoryHelper.OpDeclaration(StringSplit.NAME)
29128 public static final class StringSplit extends OnnxOp {
29129 public static final String NAME = "StringSplit";
29130
29131 public enum Attribute implements OnnxAttribute {
29132 delimiter(String.class, true, null),
29133 maxsplit(Long.class, true, null),
29134 ;
29135
29136 final Class<?> t;
29137 final boolean optional;
29138 final Object defaultValue;
29139
29140 Attribute(Class<?> type, boolean optional, Object defaultValue) {
29141 this.t = type;
29142 this.optional = optional;
29143 this.defaultValue = defaultValue;
29144 assert optional || defaultValue == null;
29145 }
29146
29147 public Class<?> type() {
29148 return t;
29149 }
29150
29151 public boolean isOptional() {
29152 return optional;
29153 }
29154
29155 public Object defaultValue() {
29156 return defaultValue;
29157 }
29158 }
29159
29160 public enum TypeConstraint implements OnnxTypeConstraint {
29161 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string())))),
29162 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string())))),
29163 T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int64())))),
29164 ;
29165
29166 final OnnxType.TypeVariable typeVariable;
29167
29168 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29169 assert typeVariable.name().equals(name());
29170 this.typeVariable = typeVariable;
29171 }
29172
29173 @Override
29174 public OnnxType.TypeVariable typeVariable() {
29175 return typeVariable;
29176 }
29177 }
29178
29179 public enum InputParameter implements OnnxParameter {
29180 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
29181 ;
29182
29183 final OnnxType type;
29184 final Quantifier quantifier;
29185
29186 InputParameter(OnnxType type, Quantifier quantifier) {
29187 this.type = type;
29188 this.quantifier = quantifier;
29189 }
29190
29191 @Override
29192 public OnnxType type() {
29193 return type;
29194 }
29195
29196 @Override
29197 public Quantifier quantifier() {
29198 return quantifier;
29199 }
29200 }
29201
29202 public enum OutputParameter implements OnnxParameter {
29203 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
29204 Z(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED),
29205 ;
29206
29207 final OnnxType type;
29208 final Quantifier quantifier;
29209
29210 OutputParameter(OnnxType type, Quantifier quantifier) {
29211 this.type = type;
29212 this.quantifier = quantifier;
29213 }
29214
29215 @Override
29216 public OnnxType type() {
29217 return type;
29218 }
29219
29220 @Override
29221 public Quantifier quantifier() {
29222 return quantifier;
29223 }
29224 }
29225
29226 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29227 NAME,
29228 List.of(Attribute.values()),
29229 List.of(TypeConstraint.values()),
29230 List.of(InputParameter.values()),
29231 List.of(OutputParameter.values())
29232 );
29233
29234 public StringSplit(ExternalizedOp def) {
29235 super(SCHEMA, def);
29236 }
29237
29238 StringSplit(StringSplit that, CodeContext cc) {
29239 super(that, cc);
29240 }
29241
29242 @Override
29243 public StringSplit transform(CodeContext cc, CodeTransformer ot) {
29244 return new StringSplit(this, cc);
29245 }
29246
29247 StringSplit(CodeType resultType, Value X, java.util.Optional<String> delimiter, java.util.Optional<Long> maxsplit) {
29248 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(delimiter, maxsplit));
29249 }
29250
29251 @Override
29252 public SequencedSet<OnnxParameter> onnxOutputs() {
29253 return onnxOutputs(SCHEMA);
29254 }
29255
29256 @Override
29257 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29258 return onnxInputs(SCHEMA, List.of(X()));
29259 }
29260
29261 public Value X() {
29262 return operands().get(0);
29263 }
29264
29265 public java.util.Optional<String> delimiter() {
29266 String delimiter = Attribute.delimiter.access(String.class, onnxAttributes);
29267 return java.util.Optional.ofNullable(delimiter);
29268 }
29269
29270 public java.util.Optional<Long> maxsplit() {
29271 Long maxsplit = Attribute.maxsplit.access(Long.class, onnxAttributes);
29272 return java.util.Optional.ofNullable(maxsplit);
29273 }
29274
29275 }
29276
29277 public static StringSplit StringSplit(CodeType resultType, Value X, java.util.Optional<String> delimiter, java.util.Optional<Long> maxsplit) {
29278 return new StringSplit(resultType, X, delimiter, maxsplit);
29279 }
29280
29281 @OpFactoryHelper.OpDeclaration(Sub.NAME)
29282 public static final class Sub extends OnnxOp {
29283 public static final String NAME = "Sub";
29284
29285 public enum Attribute implements OnnxAttribute.None { }
29286
29287 public enum TypeConstraint implements OnnxTypeConstraint {
29288 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
29289 ;
29290
29291 final OnnxType.TypeVariable typeVariable;
29292
29293 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29294 assert typeVariable.name().equals(name());
29295 this.typeVariable = typeVariable;
29296 }
29297
29298 @Override
29299 public OnnxType.TypeVariable typeVariable() {
29300 return typeVariable;
29301 }
29302 }
29303
29304 public enum InputParameter implements OnnxParameter {
29305 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29306 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29307 ;
29308
29309 final OnnxType type;
29310 final Quantifier quantifier;
29311
29312 InputParameter(OnnxType type, Quantifier quantifier) {
29313 this.type = type;
29314 this.quantifier = quantifier;
29315 }
29316
29317 @Override
29318 public OnnxType type() {
29319 return type;
29320 }
29321
29322 @Override
29323 public Quantifier quantifier() {
29324 return quantifier;
29325 }
29326 }
29327
29328 public enum OutputParameter implements OnnxParameter {
29329 C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29330 ;
29331
29332 final OnnxType type;
29333 final Quantifier quantifier;
29334
29335 OutputParameter(OnnxType type, Quantifier quantifier) {
29336 this.type = type;
29337 this.quantifier = quantifier;
29338 }
29339
29340 @Override
29341 public OnnxType type() {
29342 return type;
29343 }
29344
29345 @Override
29346 public Quantifier quantifier() {
29347 return quantifier;
29348 }
29349 }
29350
29351 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29352 NAME,
29353 List.of(Attribute.values()),
29354 List.of(TypeConstraint.values()),
29355 List.of(InputParameter.values()),
29356 List.of(OutputParameter.values())
29357 );
29358
29359 public Sub(ExternalizedOp def) {
29360 super(SCHEMA, def);
29361 }
29362
29363 Sub(Sub that, CodeContext cc) {
29364 super(that, cc);
29365 }
29366
29367 @Override
29368 public Sub transform(CodeContext cc, CodeTransformer ot) {
29369 return new Sub(this, cc);
29370 }
29371
29372 Sub(CodeType resultType, Value A, Value B) {
29373 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
29374 }
29375
29376 @Override
29377 public SequencedSet<OnnxParameter> onnxOutputs() {
29378 return onnxOutputs(SCHEMA);
29379 }
29380
29381 @Override
29382 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29383 return onnxInputs(SCHEMA, List.of(A(), B()));
29384 }
29385
29386 public Value A() {
29387 return operands().get(0);
29388 }
29389
29390 public Value B() {
29391 return operands().get(1);
29392 }
29393
29394 }
29395
29396 public static Sub Sub(CodeType resultType, Value A, Value B) {
29397 return new Sub(resultType, A, B);
29398 }
29399
29400 @OpFactoryHelper.OpDeclaration(Sum.NAME)
29401 public static final class Sum extends OnnxOp {
29402 public static final String NAME = "Sum";
29403
29404 public enum Attribute implements OnnxAttribute.None { }
29405
29406 public enum TypeConstraint implements OnnxTypeConstraint {
29407 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
29408 ;
29409
29410 final OnnxType.TypeVariable typeVariable;
29411
29412 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29413 assert typeVariable.name().equals(name());
29414 this.typeVariable = typeVariable;
29415 }
29416
29417 @Override
29418 public OnnxType.TypeVariable typeVariable() {
29419 return typeVariable;
29420 }
29421 }
29422
29423 public enum InputParameter implements OnnxParameter {
29424 data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC),
29425 ;
29426
29427 final OnnxType type;
29428 final Quantifier quantifier;
29429
29430 InputParameter(OnnxType type, Quantifier quantifier) {
29431 this.type = type;
29432 this.quantifier = quantifier;
29433 }
29434
29435 @Override
29436 public OnnxType type() {
29437 return type;
29438 }
29439
29440 @Override
29441 public Quantifier quantifier() {
29442 return quantifier;
29443 }
29444 }
29445
29446 public enum OutputParameter implements OnnxParameter {
29447 sum(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29448 ;
29449
29450 final OnnxType type;
29451 final Quantifier quantifier;
29452
29453 OutputParameter(OnnxType type, Quantifier quantifier) {
29454 this.type = type;
29455 this.quantifier = quantifier;
29456 }
29457
29458 @Override
29459 public OnnxType type() {
29460 return type;
29461 }
29462
29463 @Override
29464 public Quantifier quantifier() {
29465 return quantifier;
29466 }
29467 }
29468
29469 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29470 NAME,
29471 List.of(Attribute.values()),
29472 List.of(TypeConstraint.values()),
29473 List.of(InputParameter.values()),
29474 List.of(OutputParameter.values())
29475 );
29476
29477 public Sum(ExternalizedOp def) {
29478 super(SCHEMA, def);
29479 }
29480
29481 Sum(Sum that, CodeContext cc) {
29482 super(that, cc);
29483 }
29484
29485 @Override
29486 public Sum transform(CodeContext cc, CodeTransformer ot) {
29487 return new Sum(this, cc);
29488 }
29489
29490 Sum(CodeType resultType, List<Value> data_0) {
29491 super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of());
29492 }
29493
29494 @Override
29495 public SequencedSet<OnnxParameter> onnxOutputs() {
29496 return onnxOutputs(SCHEMA);
29497 }
29498
29499 @Override
29500 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29501 return onnxInputs(SCHEMA, List.of(data_0()));
29502 }
29503
29504 public List<Value> data_0() {
29505 return operands();
29506 }
29507
29508 }
29509
29510 public static Sum Sum(CodeType resultType, List<Value> data_0) {
29511 return new Sum(resultType, data_0);
29512 }
29513
29514 @OpFactoryHelper.OpDeclaration(Swish.NAME)
29515 public static final class Swish extends OnnxOp {
29516 public static final String NAME = "Swish";
29517
29518 public enum Attribute implements OnnxAttribute {
29519 alpha(Float.class, true, 1.0f),
29520 ;
29521
29522 final Class<?> t;
29523 final boolean optional;
29524 final Object defaultValue;
29525
29526 Attribute(Class<?> type, boolean optional, Object defaultValue) {
29527 this.t = type;
29528 this.optional = optional;
29529 this.defaultValue = defaultValue;
29530 assert optional || defaultValue == null;
29531 }
29532
29533 public Class<?> type() {
29534 return t;
29535 }
29536
29537 public boolean isOptional() {
29538 return optional;
29539 }
29540
29541 public Object defaultValue() {
29542 return defaultValue;
29543 }
29544 }
29545
29546 public enum TypeConstraint implements OnnxTypeConstraint {
29547 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float64())))),
29548 ;
29549
29550 final OnnxType.TypeVariable typeVariable;
29551
29552 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29553 assert typeVariable.name().equals(name());
29554 this.typeVariable = typeVariable;
29555 }
29556
29557 @Override
29558 public OnnxType.TypeVariable typeVariable() {
29559 return typeVariable;
29560 }
29561 }
29562
29563 public enum InputParameter implements OnnxParameter {
29564 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29565 ;
29566
29567 final OnnxType type;
29568 final Quantifier quantifier;
29569
29570 InputParameter(OnnxType type, Quantifier quantifier) {
29571 this.type = type;
29572 this.quantifier = quantifier;
29573 }
29574
29575 @Override
29576 public OnnxType type() {
29577 return type;
29578 }
29579
29580 @Override
29581 public Quantifier quantifier() {
29582 return quantifier;
29583 }
29584 }
29585
29586 public enum OutputParameter implements OnnxParameter {
29587 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29588 ;
29589
29590 final OnnxType type;
29591 final Quantifier quantifier;
29592
29593 OutputParameter(OnnxType type, Quantifier quantifier) {
29594 this.type = type;
29595 this.quantifier = quantifier;
29596 }
29597
29598 @Override
29599 public OnnxType type() {
29600 return type;
29601 }
29602
29603 @Override
29604 public Quantifier quantifier() {
29605 return quantifier;
29606 }
29607 }
29608
29609 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29610 NAME,
29611 List.of(Attribute.values()),
29612 List.of(TypeConstraint.values()),
29613 List.of(InputParameter.values()),
29614 List.of(OutputParameter.values())
29615 );
29616
29617 public Swish(ExternalizedOp def) {
29618 super(SCHEMA, def);
29619 }
29620
29621 Swish(Swish that, CodeContext cc) {
29622 super(that, cc);
29623 }
29624
29625 @Override
29626 public Swish transform(CodeContext cc, CodeTransformer ot) {
29627 return new Swish(this, cc);
29628 }
29629
29630 Swish(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
29631 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha));
29632 }
29633
29634 @Override
29635 public SequencedSet<OnnxParameter> onnxOutputs() {
29636 return onnxOutputs(SCHEMA);
29637 }
29638
29639 @Override
29640 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29641 return onnxInputs(SCHEMA, List.of(X()));
29642 }
29643
29644 public Value X() {
29645 return operands().get(0);
29646 }
29647
29648 public java.util.Optional<Float> alpha() {
29649 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
29650 return java.util.Optional.ofNullable(alpha);
29651 }
29652
29653 }
29654
29655 public static Swish Swish(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
29656 return new Swish(resultType, X, alpha);
29657 }
29658
29659 @OpFactoryHelper.OpDeclaration(Tan.NAME)
29660 public static final class Tan extends OnnxOp {
29661 public static final String NAME = "Tan";
29662
29663 public enum Attribute implements OnnxAttribute.None { }
29664
29665 public enum TypeConstraint implements OnnxTypeConstraint {
29666 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
29667 ;
29668
29669 final OnnxType.TypeVariable typeVariable;
29670
29671 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29672 assert typeVariable.name().equals(name());
29673 this.typeVariable = typeVariable;
29674 }
29675
29676 @Override
29677 public OnnxType.TypeVariable typeVariable() {
29678 return typeVariable;
29679 }
29680 }
29681
29682 public enum InputParameter implements OnnxParameter {
29683 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29684 ;
29685
29686 final OnnxType type;
29687 final Quantifier quantifier;
29688
29689 InputParameter(OnnxType type, Quantifier quantifier) {
29690 this.type = type;
29691 this.quantifier = quantifier;
29692 }
29693
29694 @Override
29695 public OnnxType type() {
29696 return type;
29697 }
29698
29699 @Override
29700 public Quantifier quantifier() {
29701 return quantifier;
29702 }
29703 }
29704
29705 public enum OutputParameter implements OnnxParameter {
29706 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29707 ;
29708
29709 final OnnxType type;
29710 final Quantifier quantifier;
29711
29712 OutputParameter(OnnxType type, Quantifier quantifier) {
29713 this.type = type;
29714 this.quantifier = quantifier;
29715 }
29716
29717 @Override
29718 public OnnxType type() {
29719 return type;
29720 }
29721
29722 @Override
29723 public Quantifier quantifier() {
29724 return quantifier;
29725 }
29726 }
29727
29728 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29729 NAME,
29730 List.of(Attribute.values()),
29731 List.of(TypeConstraint.values()),
29732 List.of(InputParameter.values()),
29733 List.of(OutputParameter.values())
29734 );
29735
29736 public Tan(ExternalizedOp def) {
29737 super(SCHEMA, def);
29738 }
29739
29740 Tan(Tan that, CodeContext cc) {
29741 super(that, cc);
29742 }
29743
29744 @Override
29745 public Tan transform(CodeContext cc, CodeTransformer ot) {
29746 return new Tan(this, cc);
29747 }
29748
29749 Tan(CodeType resultType, Value input) {
29750 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
29751 }
29752
29753 @Override
29754 public SequencedSet<OnnxParameter> onnxOutputs() {
29755 return onnxOutputs(SCHEMA);
29756 }
29757
29758 @Override
29759 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29760 return onnxInputs(SCHEMA, List.of(input()));
29761 }
29762
29763 public Value input() {
29764 return operands().get(0);
29765 }
29766
29767 }
29768
29769 public static Tan Tan(CodeType resultType, Value input) {
29770 return new Tan(resultType, input);
29771 }
29772
29773 @OpFactoryHelper.OpDeclaration(Tanh.NAME)
29774 public static final class Tanh extends OnnxOp {
29775 public static final String NAME = "Tanh";
29776
29777 public enum Attribute implements OnnxAttribute.None { }
29778
29779 public enum TypeConstraint implements OnnxTypeConstraint {
29780 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
29781 ;
29782
29783 final OnnxType.TypeVariable typeVariable;
29784
29785 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29786 assert typeVariable.name().equals(name());
29787 this.typeVariable = typeVariable;
29788 }
29789
29790 @Override
29791 public OnnxType.TypeVariable typeVariable() {
29792 return typeVariable;
29793 }
29794 }
29795
29796 public enum InputParameter implements OnnxParameter {
29797 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29798 ;
29799
29800 final OnnxType type;
29801 final Quantifier quantifier;
29802
29803 InputParameter(OnnxType type, Quantifier quantifier) {
29804 this.type = type;
29805 this.quantifier = quantifier;
29806 }
29807
29808 @Override
29809 public OnnxType type() {
29810 return type;
29811 }
29812
29813 @Override
29814 public Quantifier quantifier() {
29815 return quantifier;
29816 }
29817 }
29818
29819 public enum OutputParameter implements OnnxParameter {
29820 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29821 ;
29822
29823 final OnnxType type;
29824 final Quantifier quantifier;
29825
29826 OutputParameter(OnnxType type, Quantifier quantifier) {
29827 this.type = type;
29828 this.quantifier = quantifier;
29829 }
29830
29831 @Override
29832 public OnnxType type() {
29833 return type;
29834 }
29835
29836 @Override
29837 public Quantifier quantifier() {
29838 return quantifier;
29839 }
29840 }
29841
29842 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29843 NAME,
29844 List.of(Attribute.values()),
29845 List.of(TypeConstraint.values()),
29846 List.of(InputParameter.values()),
29847 List.of(OutputParameter.values())
29848 );
29849
29850 public Tanh(ExternalizedOp def) {
29851 super(SCHEMA, def);
29852 }
29853
29854 Tanh(Tanh that, CodeContext cc) {
29855 super(that, cc);
29856 }
29857
29858 @Override
29859 public Tanh transform(CodeContext cc, CodeTransformer ot) {
29860 return new Tanh(this, cc);
29861 }
29862
29863 Tanh(CodeType resultType, Value input) {
29864 super(SCHEMA, resultType, Set.of(), List.of(input), List.of());
29865 }
29866
29867 @Override
29868 public SequencedSet<OnnxParameter> onnxOutputs() {
29869 return onnxOutputs(SCHEMA);
29870 }
29871
29872 @Override
29873 public SequencedMap<OnnxParameter, Object> onnxInputs() {
29874 return onnxInputs(SCHEMA, List.of(input()));
29875 }
29876
29877 public Value input() {
29878 return operands().get(0);
29879 }
29880
29881 }
29882
29883 public static Tanh Tanh(CodeType resultType, Value input) {
29884 return new Tanh(resultType, input);
29885 }
29886
29887 @OpFactoryHelper.OpDeclaration(TensorScatter.NAME)
29888 public static final class TensorScatter extends OnnxOp {
29889 public static final String NAME = "TensorScatter";
29890
29891 public enum Attribute implements OnnxAttribute {
29892 mode(String.class, true, "linear"),
29893 axis(Long.class, true, -2),
29894 ;
29895
29896 final Class<?> t;
29897 final boolean optional;
29898 final Object defaultValue;
29899
29900 Attribute(Class<?> type, boolean optional, Object defaultValue) {
29901 this.t = type;
29902 this.optional = optional;
29903 this.defaultValue = defaultValue;
29904 assert optional || defaultValue == null;
29905 }
29906
29907 public Class<?> type() {
29908 return t;
29909 }
29910
29911 public boolean isOptional() {
29912 return optional;
29913 }
29914
29915 public Object defaultValue() {
29916 return defaultValue;
29917 }
29918 }
29919
29920 public enum TypeConstraint implements OnnxTypeConstraint {
29921 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0())))),
29922 ;
29923
29924 final OnnxType.TypeVariable typeVariable;
29925
29926 TypeConstraint(OnnxType.TypeVariable typeVariable) {
29927 assert typeVariable.name().equals(name());
29928 this.typeVariable = typeVariable;
29929 }
29930
29931 @Override
29932 public OnnxType.TypeVariable typeVariable() {
29933 return typeVariable;
29934 }
29935 }
29936
29937 public enum InputParameter implements OnnxParameter {
29938 past_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29939 update(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29940 write_indices(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
29941 ;
29942
29943 final OnnxType type;
29944 final Quantifier quantifier;
29945
29946 InputParameter(OnnxType type, Quantifier quantifier) {
29947 this.type = type;
29948 this.quantifier = quantifier;
29949 }
29950
29951 @Override
29952 public OnnxType type() {
29953 return type;
29954 }
29955
29956 @Override
29957 public Quantifier quantifier() {
29958 return quantifier;
29959 }
29960 }
29961
29962 public enum OutputParameter implements OnnxParameter {
29963 present_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
29964 ;
29965
29966 final OnnxType type;
29967 final Quantifier quantifier;
29968
29969 OutputParameter(OnnxType type, Quantifier quantifier) {
29970 this.type = type;
29971 this.quantifier = quantifier;
29972 }
29973
29974 @Override
29975 public OnnxType type() {
29976 return type;
29977 }
29978
29979 @Override
29980 public Quantifier quantifier() {
29981 return quantifier;
29982 }
29983 }
29984
29985 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
29986 NAME,
29987 List.of(Attribute.values()),
29988 List.of(TypeConstraint.values()),
29989 List.of(InputParameter.values()),
29990 List.of(OutputParameter.values())
29991 );
29992
29993 public TensorScatter(ExternalizedOp def) {
29994 super(SCHEMA, def);
29995 }
29996
29997 TensorScatter(TensorScatter that, CodeContext cc) {
29998 super(that, cc);
29999 }
30000
30001 @Override
30002 public TensorScatter transform(CodeContext cc, CodeTransformer ot) {
30003 return new TensorScatter(this, cc);
30004 }
30005
30006 TensorScatter(CodeType resultType, Value past_cache, Value update, java.util.Optional<Value> write_indices, java.util.Optional<String> mode, java.util.Optional<Long> axis) {
30007 super(SCHEMA, resultType, Set.of(), List.of(past_cache, update, write_indices), List.of(mode, axis));
30008 }
30009
30010 @Override
30011 public SequencedSet<OnnxParameter> onnxOutputs() {
30012 return onnxOutputs(SCHEMA);
30013 }
30014
30015 @Override
30016 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30017 return onnxInputs(SCHEMA, List.of(past_cache(), update(), write_indices()));
30018 }
30019
30020 public Value past_cache() {
30021 return operands().get(0);
30022 }
30023
30024 public Value update() {
30025 return operands().get(1);
30026 }
30027
30028 public java.util.Optional<Value> write_indices() {
30029 int i = optionalInputArguments.indexOf(InputParameter.write_indices);
30030 return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty();
30031 }
30032
30033 public java.util.Optional<String> mode() {
30034 String mode = Attribute.mode.access(String.class, onnxAttributes);
30035 return java.util.Optional.ofNullable(mode);
30036 }
30037
30038 public java.util.Optional<Long> axis() {
30039 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
30040 return java.util.Optional.ofNullable(axis);
30041 }
30042
30043 }
30044
30045 public static TensorScatter TensorScatter(CodeType resultType, Value past_cache, Value update, java.util.Optional<Value> write_indices, java.util.Optional<String> mode, java.util.Optional<Long> axis) {
30046 return new TensorScatter(resultType, past_cache, update, write_indices, mode, axis);
30047 }
30048
30049 @OpFactoryHelper.OpDeclaration(TfIdfVectorizer.NAME)
30050 public static final class TfIdfVectorizer extends OnnxOp {
30051 public static final String NAME = "TfIdfVectorizer";
30052
30053 public enum Attribute implements OnnxAttribute {
30054 ngram_counts(long[].class, false, null),
30055 min_gram_length(Long.class, false, null),
30056 pool_strings(String[].class, true, null),
30057 mode(String.class, false, null),
30058 max_gram_length(Long.class, false, null),
30059 max_skip_count(Long.class, false, null),
30060 pool_int64s(long[].class, true, null),
30061 weights(float[].class, true, null),
30062 ngram_indexes(long[].class, false, null),
30063 ;
30064
30065 final Class<?> t;
30066 final boolean optional;
30067 final Object defaultValue;
30068
30069 Attribute(Class<?> type, boolean optional, Object defaultValue) {
30070 this.t = type;
30071 this.optional = optional;
30072 this.defaultValue = defaultValue;
30073 assert optional || defaultValue == null;
30074 }
30075
30076 public Class<?> type() {
30077 return t;
30078 }
30079
30080 public boolean isOptional() {
30081 return optional;
30082 }
30083
30084 public Object defaultValue() {
30085 return defaultValue;
30086 }
30087 }
30088
30089 public enum TypeConstraint implements OnnxTypeConstraint {
30090 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))),
30091 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32())))),
30092 ;
30093
30094 final OnnxType.TypeVariable typeVariable;
30095
30096 TypeConstraint(OnnxType.TypeVariable typeVariable) {
30097 assert typeVariable.name().equals(name());
30098 this.typeVariable = typeVariable;
30099 }
30100
30101 @Override
30102 public OnnxType.TypeVariable typeVariable() {
30103 return typeVariable;
30104 }
30105 }
30106
30107 public enum InputParameter implements OnnxParameter {
30108 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30109 ;
30110
30111 final OnnxType type;
30112 final Quantifier quantifier;
30113
30114 InputParameter(OnnxType type, Quantifier quantifier) {
30115 this.type = type;
30116 this.quantifier = quantifier;
30117 }
30118
30119 @Override
30120 public OnnxType type() {
30121 return type;
30122 }
30123
30124 @Override
30125 public Quantifier quantifier() {
30126 return quantifier;
30127 }
30128 }
30129
30130 public enum OutputParameter implements OnnxParameter {
30131 Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
30132 ;
30133
30134 final OnnxType type;
30135 final Quantifier quantifier;
30136
30137 OutputParameter(OnnxType type, Quantifier quantifier) {
30138 this.type = type;
30139 this.quantifier = quantifier;
30140 }
30141
30142 @Override
30143 public OnnxType type() {
30144 return type;
30145 }
30146
30147 @Override
30148 public Quantifier quantifier() {
30149 return quantifier;
30150 }
30151 }
30152
30153 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
30154 NAME,
30155 List.of(Attribute.values()),
30156 List.of(TypeConstraint.values()),
30157 List.of(InputParameter.values()),
30158 List.of(OutputParameter.values())
30159 );
30160
30161 public TfIdfVectorizer(ExternalizedOp def) {
30162 super(SCHEMA, def);
30163 }
30164
30165 TfIdfVectorizer(TfIdfVectorizer that, CodeContext cc) {
30166 super(that, cc);
30167 }
30168
30169 @Override
30170 public TfIdfVectorizer transform(CodeContext cc, CodeTransformer ot) {
30171 return new TfIdfVectorizer(this, cc);
30172 }
30173
30174 TfIdfVectorizer(CodeType resultType, Value X, long[] ngram_counts, long min_gram_length, java.util.Optional<String[]> pool_strings, String mode, long max_gram_length, long max_skip_count, java.util.Optional<long[]> pool_int64s, java.util.Optional<float[]> weights, long[] ngram_indexes) {
30175 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes));
30176 }
30177
30178 @Override
30179 public SequencedSet<OnnxParameter> onnxOutputs() {
30180 return onnxOutputs(SCHEMA);
30181 }
30182
30183 @Override
30184 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30185 return onnxInputs(SCHEMA, List.of(X()));
30186 }
30187
30188 public Value X() {
30189 return operands().get(0);
30190 }
30191
30192 public long[] ngram_counts() {
30193 long[] ngram_counts = Attribute.ngram_counts.access(long[].class, onnxAttributes);
30194 return ngram_counts.clone();
30195 }
30196
30197 public long min_gram_length() {
30198 long min_gram_length = Attribute.min_gram_length.access(Long.class, onnxAttributes);
30199 return min_gram_length;
30200 }
30201
30202 public java.util.Optional<String[]> pool_strings() {
30203 String[] pool_strings = Attribute.pool_strings.access(String[].class, onnxAttributes);
30204 return java.util.Optional.ofNullable(pool_strings).map(String[]::clone);
30205 }
30206
30207 public String mode() {
30208 String mode = Attribute.mode.access(String.class, onnxAttributes);
30209 return mode;
30210 }
30211
30212 public long max_gram_length() {
30213 long max_gram_length = Attribute.max_gram_length.access(Long.class, onnxAttributes);
30214 return max_gram_length;
30215 }
30216
30217 public long max_skip_count() {
30218 long max_skip_count = Attribute.max_skip_count.access(Long.class, onnxAttributes);
30219 return max_skip_count;
30220 }
30221
30222 public java.util.Optional<long[]> pool_int64s() {
30223 long[] pool_int64s = Attribute.pool_int64s.access(long[].class, onnxAttributes);
30224 return java.util.Optional.ofNullable(pool_int64s).map(long[]::clone);
30225 }
30226
30227 public java.util.Optional<float[]> weights() {
30228 float[] weights = Attribute.weights.access(float[].class, onnxAttributes);
30229 return java.util.Optional.ofNullable(weights).map(float[]::clone);
30230 }
30231
30232 public long[] ngram_indexes() {
30233 long[] ngram_indexes = Attribute.ngram_indexes.access(long[].class, onnxAttributes);
30234 return ngram_indexes.clone();
30235 }
30236
30237 }
30238
30239 public static TfIdfVectorizer TfIdfVectorizer(CodeType resultType, Value X, long[] ngram_counts, long min_gram_length, java.util.Optional<String[]> pool_strings, String mode, long max_gram_length, long max_skip_count, java.util.Optional<long[]> pool_int64s, java.util.Optional<float[]> weights, long[] ngram_indexes) {
30240 return new TfIdfVectorizer(resultType, X, ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes);
30241 }
30242
30243 @OpFactoryHelper.OpDeclaration(ThresholdedRelu.NAME)
30244 public static final class ThresholdedRelu extends OnnxOp {
30245 public static final String NAME = "ThresholdedRelu";
30246
30247 public enum Attribute implements OnnxAttribute {
30248 alpha(Float.class, true, 1.0f),
30249 ;
30250
30251 final Class<?> t;
30252 final boolean optional;
30253 final Object defaultValue;
30254
30255 Attribute(Class<?> type, boolean optional, Object defaultValue) {
30256 this.t = type;
30257 this.optional = optional;
30258 this.defaultValue = defaultValue;
30259 assert optional || defaultValue == null;
30260 }
30261
30262 public Class<?> type() {
30263 return t;
30264 }
30265
30266 public boolean isOptional() {
30267 return optional;
30268 }
30269
30270 public Object defaultValue() {
30271 return defaultValue;
30272 }
30273 }
30274
30275 public enum TypeConstraint implements OnnxTypeConstraint {
30276 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))),
30277 ;
30278
30279 final OnnxType.TypeVariable typeVariable;
30280
30281 TypeConstraint(OnnxType.TypeVariable typeVariable) {
30282 assert typeVariable.name().equals(name());
30283 this.typeVariable = typeVariable;
30284 }
30285
30286 @Override
30287 public OnnxType.TypeVariable typeVariable() {
30288 return typeVariable;
30289 }
30290 }
30291
30292 public enum InputParameter implements OnnxParameter {
30293 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30294 ;
30295
30296 final OnnxType type;
30297 final Quantifier quantifier;
30298
30299 InputParameter(OnnxType type, Quantifier quantifier) {
30300 this.type = type;
30301 this.quantifier = quantifier;
30302 }
30303
30304 @Override
30305 public OnnxType type() {
30306 return type;
30307 }
30308
30309 @Override
30310 public Quantifier quantifier() {
30311 return quantifier;
30312 }
30313 }
30314
30315 public enum OutputParameter implements OnnxParameter {
30316 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30317 ;
30318
30319 final OnnxType type;
30320 final Quantifier quantifier;
30321
30322 OutputParameter(OnnxType type, Quantifier quantifier) {
30323 this.type = type;
30324 this.quantifier = quantifier;
30325 }
30326
30327 @Override
30328 public OnnxType type() {
30329 return type;
30330 }
30331
30332 @Override
30333 public Quantifier quantifier() {
30334 return quantifier;
30335 }
30336 }
30337
30338 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
30339 NAME,
30340 List.of(Attribute.values()),
30341 List.of(TypeConstraint.values()),
30342 List.of(InputParameter.values()),
30343 List.of(OutputParameter.values())
30344 );
30345
30346 public ThresholdedRelu(ExternalizedOp def) {
30347 super(SCHEMA, def);
30348 }
30349
30350 ThresholdedRelu(ThresholdedRelu that, CodeContext cc) {
30351 super(that, cc);
30352 }
30353
30354 @Override
30355 public ThresholdedRelu transform(CodeContext cc, CodeTransformer ot) {
30356 return new ThresholdedRelu(this, cc);
30357 }
30358
30359 ThresholdedRelu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
30360 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha));
30361 }
30362
30363 @Override
30364 public SequencedSet<OnnxParameter> onnxOutputs() {
30365 return onnxOutputs(SCHEMA);
30366 }
30367
30368 @Override
30369 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30370 return onnxInputs(SCHEMA, List.of(X()));
30371 }
30372
30373 public Value X() {
30374 return operands().get(0);
30375 }
30376
30377 public java.util.Optional<Float> alpha() {
30378 Float alpha = Attribute.alpha.access(Float.class, onnxAttributes);
30379 return java.util.Optional.ofNullable(alpha);
30380 }
30381
30382 }
30383
30384 public static ThresholdedRelu ThresholdedRelu(CodeType resultType, Value X, java.util.Optional<Float> alpha) {
30385 return new ThresholdedRelu(resultType, X, alpha);
30386 }
30387
30388 @OpFactoryHelper.OpDeclaration(Tile.NAME)
30389 public static final class Tile extends OnnxOp {
30390 public static final String NAME = "Tile";
30391
30392 public enum Attribute implements OnnxAttribute.None { }
30393
30394 public enum TypeConstraint implements OnnxTypeConstraint {
30395 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
30396 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))),
30397 ;
30398
30399 final OnnxType.TypeVariable typeVariable;
30400
30401 TypeConstraint(OnnxType.TypeVariable typeVariable) {
30402 assert typeVariable.name().equals(name());
30403 this.typeVariable = typeVariable;
30404 }
30405
30406 @Override
30407 public OnnxType.TypeVariable typeVariable() {
30408 return typeVariable;
30409 }
30410 }
30411
30412 public enum InputParameter implements OnnxParameter {
30413 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30414 repeats(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
30415 ;
30416
30417 final OnnxType type;
30418 final Quantifier quantifier;
30419
30420 InputParameter(OnnxType type, Quantifier quantifier) {
30421 this.type = type;
30422 this.quantifier = quantifier;
30423 }
30424
30425 @Override
30426 public OnnxType type() {
30427 return type;
30428 }
30429
30430 @Override
30431 public Quantifier quantifier() {
30432 return quantifier;
30433 }
30434 }
30435
30436 public enum OutputParameter implements OnnxParameter {
30437 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30438 ;
30439
30440 final OnnxType type;
30441 final Quantifier quantifier;
30442
30443 OutputParameter(OnnxType type, Quantifier quantifier) {
30444 this.type = type;
30445 this.quantifier = quantifier;
30446 }
30447
30448 @Override
30449 public OnnxType type() {
30450 return type;
30451 }
30452
30453 @Override
30454 public Quantifier quantifier() {
30455 return quantifier;
30456 }
30457 }
30458
30459 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
30460 NAME,
30461 List.of(Attribute.values()),
30462 List.of(TypeConstraint.values()),
30463 List.of(InputParameter.values()),
30464 List.of(OutputParameter.values())
30465 );
30466
30467 public Tile(ExternalizedOp def) {
30468 super(SCHEMA, def);
30469 }
30470
30471 Tile(Tile that, CodeContext cc) {
30472 super(that, cc);
30473 }
30474
30475 @Override
30476 public Tile transform(CodeContext cc, CodeTransformer ot) {
30477 return new Tile(this, cc);
30478 }
30479
30480 Tile(CodeType resultType, Value input, Value repeats) {
30481 super(SCHEMA, resultType, Set.of(), List.of(input, repeats), List.of());
30482 }
30483
30484 @Override
30485 public SequencedSet<OnnxParameter> onnxOutputs() {
30486 return onnxOutputs(SCHEMA);
30487 }
30488
30489 @Override
30490 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30491 return onnxInputs(SCHEMA, List.of(input(), repeats()));
30492 }
30493
30494 public Value input() {
30495 return operands().get(0);
30496 }
30497
30498 public Value repeats() {
30499 return operands().get(1);
30500 }
30501
30502 }
30503
30504 public static Tile Tile(CodeType resultType, Value input, Value repeats) {
30505 return new Tile(resultType, input, repeats);
30506 }
30507
30508 @OpFactoryHelper.OpDeclaration(TopK.NAME)
30509 public static final class TopK extends OnnxOp {
30510 public static final String NAME = "TopK";
30511
30512 public enum Attribute implements OnnxAttribute {
30513 largest(Long.class, true, 1),
30514 sorted(Long.class, true, 1),
30515 axis(Long.class, true, -1),
30516 ;
30517
30518 final Class<?> t;
30519 final boolean optional;
30520 final Object defaultValue;
30521
30522 Attribute(Class<?> type, boolean optional, Object defaultValue) {
30523 this.t = type;
30524 this.optional = optional;
30525 this.defaultValue = defaultValue;
30526 assert optional || defaultValue == null;
30527 }
30528
30529 public Class<?> type() {
30530 return t;
30531 }
30532
30533 public boolean isOptional() {
30534 return optional;
30535 }
30536
30537 public Object defaultValue() {
30538 return defaultValue;
30539 }
30540 }
30541
30542 public enum TypeConstraint implements OnnxTypeConstraint {
30543 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))),
30544 I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int64())))),
30545 ;
30546
30547 final OnnxType.TypeVariable typeVariable;
30548
30549 TypeConstraint(OnnxType.TypeVariable typeVariable) {
30550 assert typeVariable.name().equals(name());
30551 this.typeVariable = typeVariable;
30552 }
30553
30554 @Override
30555 public OnnxType.TypeVariable typeVariable() {
30556 return typeVariable;
30557 }
30558 }
30559
30560 public enum InputParameter implements OnnxParameter {
30561 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30562 K(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
30563 ;
30564
30565 final OnnxType type;
30566 final Quantifier quantifier;
30567
30568 InputParameter(OnnxType type, Quantifier quantifier) {
30569 this.type = type;
30570 this.quantifier = quantifier;
30571 }
30572
30573 @Override
30574 public OnnxType type() {
30575 return type;
30576 }
30577
30578 @Override
30579 public Quantifier quantifier() {
30580 return quantifier;
30581 }
30582 }
30583
30584 public enum OutputParameter implements OnnxParameter {
30585 Values(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30586 Indices(TypeConstraint.I.typeVariable(), Quantifier.REQUIRED),
30587 ;
30588
30589 final OnnxType type;
30590 final Quantifier quantifier;
30591
30592 OutputParameter(OnnxType type, Quantifier quantifier) {
30593 this.type = type;
30594 this.quantifier = quantifier;
30595 }
30596
30597 @Override
30598 public OnnxType type() {
30599 return type;
30600 }
30601
30602 @Override
30603 public Quantifier quantifier() {
30604 return quantifier;
30605 }
30606 }
30607
30608 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
30609 NAME,
30610 List.of(Attribute.values()),
30611 List.of(TypeConstraint.values()),
30612 List.of(InputParameter.values()),
30613 List.of(OutputParameter.values())
30614 );
30615
30616 public TopK(ExternalizedOp def) {
30617 super(SCHEMA, def);
30618 }
30619
30620 TopK(TopK that, CodeContext cc) {
30621 super(that, cc);
30622 }
30623
30624 @Override
30625 public TopK transform(CodeContext cc, CodeTransformer ot) {
30626 return new TopK(this, cc);
30627 }
30628
30629 TopK(CodeType resultType, Value X, Value K, java.util.Optional<Long> largest, java.util.Optional<Long> sorted, java.util.Optional<Long> axis) {
30630 super(SCHEMA, resultType, Set.of(), List.of(X, K), List.of(largest, sorted, axis));
30631 }
30632
30633 @Override
30634 public SequencedSet<OnnxParameter> onnxOutputs() {
30635 return onnxOutputs(SCHEMA);
30636 }
30637
30638 @Override
30639 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30640 return onnxInputs(SCHEMA, List.of(X(), K()));
30641 }
30642
30643 public Value X() {
30644 return operands().get(0);
30645 }
30646
30647 public Value K() {
30648 return operands().get(1);
30649 }
30650
30651 public java.util.Optional<Long> largest() {
30652 Long largest = Attribute.largest.access(Long.class, onnxAttributes);
30653 return java.util.Optional.ofNullable(largest);
30654 }
30655
30656 public java.util.Optional<Long> sorted() {
30657 Long sorted = Attribute.sorted.access(Long.class, onnxAttributes);
30658 return java.util.Optional.ofNullable(sorted);
30659 }
30660
30661 public java.util.Optional<Long> axis() {
30662 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
30663 return java.util.Optional.ofNullable(axis);
30664 }
30665
30666 }
30667
30668 public static TopK TopK(CodeType resultType, Value X, Value K, java.util.Optional<Long> largest, java.util.Optional<Long> sorted, java.util.Optional<Long> axis) {
30669 return new TopK(resultType, X, K, largest, sorted, axis);
30670 }
30671
30672 @OpFactoryHelper.OpDeclaration(Transpose.NAME)
30673 public static final class Transpose extends OnnxOp {
30674 public static final String NAME = "Transpose";
30675
30676 public enum Attribute implements OnnxAttribute {
30677 perm(long[].class, true, null),
30678 ;
30679
30680 final Class<?> t;
30681 final boolean optional;
30682 final Object defaultValue;
30683
30684 Attribute(Class<?> type, boolean optional, Object defaultValue) {
30685 this.t = type;
30686 this.optional = optional;
30687 this.defaultValue = defaultValue;
30688 assert optional || defaultValue == null;
30689 }
30690
30691 public Class<?> type() {
30692 return t;
30693 }
30694
30695 public boolean isOptional() {
30696 return optional;
30697 }
30698
30699 public Object defaultValue() {
30700 return defaultValue;
30701 }
30702 }
30703
30704 public enum TypeConstraint implements OnnxTypeConstraint {
30705 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
30706 ;
30707
30708 final OnnxType.TypeVariable typeVariable;
30709
30710 TypeConstraint(OnnxType.TypeVariable typeVariable) {
30711 assert typeVariable.name().equals(name());
30712 this.typeVariable = typeVariable;
30713 }
30714
30715 @Override
30716 public OnnxType.TypeVariable typeVariable() {
30717 return typeVariable;
30718 }
30719 }
30720
30721 public enum InputParameter implements OnnxParameter {
30722 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30723 ;
30724
30725 final OnnxType type;
30726 final Quantifier quantifier;
30727
30728 InputParameter(OnnxType type, Quantifier quantifier) {
30729 this.type = type;
30730 this.quantifier = quantifier;
30731 }
30732
30733 @Override
30734 public OnnxType type() {
30735 return type;
30736 }
30737
30738 @Override
30739 public Quantifier quantifier() {
30740 return quantifier;
30741 }
30742 }
30743
30744 public enum OutputParameter implements OnnxParameter {
30745 transposed(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30746 ;
30747
30748 final OnnxType type;
30749 final Quantifier quantifier;
30750
30751 OutputParameter(OnnxType type, Quantifier quantifier) {
30752 this.type = type;
30753 this.quantifier = quantifier;
30754 }
30755
30756 @Override
30757 public OnnxType type() {
30758 return type;
30759 }
30760
30761 @Override
30762 public Quantifier quantifier() {
30763 return quantifier;
30764 }
30765 }
30766
30767 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
30768 NAME,
30769 List.of(Attribute.values()),
30770 List.of(TypeConstraint.values()),
30771 List.of(InputParameter.values()),
30772 List.of(OutputParameter.values())
30773 );
30774
30775 public Transpose(ExternalizedOp def) {
30776 super(SCHEMA, def);
30777 }
30778
30779 Transpose(Transpose that, CodeContext cc) {
30780 super(that, cc);
30781 }
30782
30783 @Override
30784 public Transpose transform(CodeContext cc, CodeTransformer ot) {
30785 return new Transpose(this, cc);
30786 }
30787
30788 Transpose(CodeType resultType, Value data, java.util.Optional<long[]> perm) {
30789 super(SCHEMA, resultType, Set.of(), List.of(data), List.of(perm));
30790 }
30791
30792 @Override
30793 public SequencedSet<OnnxParameter> onnxOutputs() {
30794 return onnxOutputs(SCHEMA);
30795 }
30796
30797 @Override
30798 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30799 return onnxInputs(SCHEMA, List.of(data()));
30800 }
30801
30802 public Value data() {
30803 return operands().get(0);
30804 }
30805
30806 public java.util.Optional<long[]> perm() {
30807 long[] perm = Attribute.perm.access(long[].class, onnxAttributes);
30808 return java.util.Optional.ofNullable(perm).map(long[]::clone);
30809 }
30810
30811 }
30812
30813 public static Transpose Transpose(CodeType resultType, Value data, java.util.Optional<long[]> perm) {
30814 return new Transpose(resultType, data, perm);
30815 }
30816
30817 @OpFactoryHelper.OpDeclaration(TreeEnsemble.NAME)
30818 public static final class TreeEnsemble extends OnnxOp {
30819 public static final String NAME = "TreeEnsemble";
30820
30821 public enum Attribute implements OnnxAttribute {
30822 aggregate_function(Long.class, true, 1),
30823 nodes_hitrates(Tensor.class, true, null),
30824 nodes_featureids(long[].class, false, null),
30825 nodes_falseleafs(long[].class, false, null),
30826 post_transform(Long.class, true, 0),
30827 nodes_trueleafs(long[].class, false, null),
30828 nodes_modes(Tensor.class, false, null),
30829 nodes_falsenodeids(long[].class, false, null),
30830 nodes_truenodeids(long[].class, false, null),
30831 leaf_weights(Tensor.class, false, null),
30832 leaf_targetids(long[].class, false, null),
30833 tree_roots(long[].class, false, null),
30834 n_targets(Long.class, true, null),
30835 nodes_missing_value_tracks_true(long[].class, true, null),
30836 membership_values(Tensor.class, true, null),
30837 nodes_splits(Tensor.class, false, null),
30838 ;
30839
30840 final Class<?> t;
30841 final boolean optional;
30842 final Object defaultValue;
30843
30844 Attribute(Class<?> type, boolean optional, Object defaultValue) {
30845 this.t = type;
30846 this.optional = optional;
30847 this.defaultValue = defaultValue;
30848 assert optional || defaultValue == null;
30849 }
30850
30851 public Class<?> type() {
30852 return t;
30853 }
30854
30855 public boolean isOptional() {
30856 return optional;
30857 }
30858
30859 public Object defaultValue() {
30860 return defaultValue;
30861 }
30862 }
30863
30864 public enum TypeConstraint implements OnnxTypeConstraint {
30865 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float16())))),
30866 ;
30867
30868 final OnnxType.TypeVariable typeVariable;
30869
30870 TypeConstraint(OnnxType.TypeVariable typeVariable) {
30871 assert typeVariable.name().equals(name());
30872 this.typeVariable = typeVariable;
30873 }
30874
30875 @Override
30876 public OnnxType.TypeVariable typeVariable() {
30877 return typeVariable;
30878 }
30879 }
30880
30881 public enum InputParameter implements OnnxParameter {
30882 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30883 ;
30884
30885 final OnnxType type;
30886 final Quantifier quantifier;
30887
30888 InputParameter(OnnxType type, Quantifier quantifier) {
30889 this.type = type;
30890 this.quantifier = quantifier;
30891 }
30892
30893 @Override
30894 public OnnxType type() {
30895 return type;
30896 }
30897
30898 @Override
30899 public Quantifier quantifier() {
30900 return quantifier;
30901 }
30902 }
30903
30904 public enum OutputParameter implements OnnxParameter {
30905 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
30906 ;
30907
30908 final OnnxType type;
30909 final Quantifier quantifier;
30910
30911 OutputParameter(OnnxType type, Quantifier quantifier) {
30912 this.type = type;
30913 this.quantifier = quantifier;
30914 }
30915
30916 @Override
30917 public OnnxType type() {
30918 return type;
30919 }
30920
30921 @Override
30922 public Quantifier quantifier() {
30923 return quantifier;
30924 }
30925 }
30926
30927 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
30928 NAME,
30929 List.of(Attribute.values()),
30930 List.of(TypeConstraint.values()),
30931 List.of(InputParameter.values()),
30932 List.of(OutputParameter.values())
30933 );
30934
30935 public TreeEnsemble(ExternalizedOp def) {
30936 super(SCHEMA, def);
30937 }
30938
30939 TreeEnsemble(TreeEnsemble that, CodeContext cc) {
30940 super(that, cc);
30941 }
30942
30943 @Override
30944 public TreeEnsemble transform(CodeContext cc, CodeTransformer ot) {
30945 return new TreeEnsemble(this, cc);
30946 }
30947
30948 TreeEnsemble(CodeType resultType, Value X, java.util.Optional<Long> aggregate_function, java.util.Optional<Tensor> nodes_hitrates, long[] nodes_featureids, long[] nodes_falseleafs, java.util.Optional<Long> post_transform, long[] nodes_trueleafs, Tensor nodes_modes, long[] nodes_falsenodeids, long[] nodes_truenodeids, Tensor leaf_weights, long[] leaf_targetids, long[] tree_roots, java.util.Optional<Long> n_targets, java.util.Optional<long[]> nodes_missing_value_tracks_true, java.util.Optional<Tensor> membership_values, Tensor nodes_splits) {
30949 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits));
30950 }
30951
30952 @Override
30953 public SequencedSet<OnnxParameter> onnxOutputs() {
30954 return onnxOutputs(SCHEMA);
30955 }
30956
30957 @Override
30958 public SequencedMap<OnnxParameter, Object> onnxInputs() {
30959 return onnxInputs(SCHEMA, List.of(X()));
30960 }
30961
30962 public Value X() {
30963 return operands().get(0);
30964 }
30965
30966 public java.util.Optional<Long> aggregate_function() {
30967 Long aggregate_function = Attribute.aggregate_function.access(Long.class, onnxAttributes);
30968 return java.util.Optional.ofNullable(aggregate_function);
30969 }
30970
30971 public java.util.Optional<Tensor> nodes_hitrates() {
30972 Tensor nodes_hitrates = Attribute.nodes_hitrates.access(Tensor.class, onnxAttributes);
30973 return java.util.Optional.ofNullable(nodes_hitrates);
30974 }
30975
30976 public long[] nodes_featureids() {
30977 long[] nodes_featureids = Attribute.nodes_featureids.access(long[].class, onnxAttributes);
30978 return nodes_featureids.clone();
30979 }
30980
30981 public long[] nodes_falseleafs() {
30982 long[] nodes_falseleafs = Attribute.nodes_falseleafs.access(long[].class, onnxAttributes);
30983 return nodes_falseleafs.clone();
30984 }
30985
30986 public java.util.Optional<Long> post_transform() {
30987 Long post_transform = Attribute.post_transform.access(Long.class, onnxAttributes);
30988 return java.util.Optional.ofNullable(post_transform);
30989 }
30990
30991 public long[] nodes_trueleafs() {
30992 long[] nodes_trueleafs = Attribute.nodes_trueleafs.access(long[].class, onnxAttributes);
30993 return nodes_trueleafs.clone();
30994 }
30995
30996 public Tensor nodes_modes() {
30997 Tensor nodes_modes = Attribute.nodes_modes.access(Tensor.class, onnxAttributes);
30998 return nodes_modes;
30999 }
31000
31001 public long[] nodes_falsenodeids() {
31002 long[] nodes_falsenodeids = Attribute.nodes_falsenodeids.access(long[].class, onnxAttributes);
31003 return nodes_falsenodeids.clone();
31004 }
31005
31006 public long[] nodes_truenodeids() {
31007 long[] nodes_truenodeids = Attribute.nodes_truenodeids.access(long[].class, onnxAttributes);
31008 return nodes_truenodeids.clone();
31009 }
31010
31011 public Tensor leaf_weights() {
31012 Tensor leaf_weights = Attribute.leaf_weights.access(Tensor.class, onnxAttributes);
31013 return leaf_weights;
31014 }
31015
31016 public long[] leaf_targetids() {
31017 long[] leaf_targetids = Attribute.leaf_targetids.access(long[].class, onnxAttributes);
31018 return leaf_targetids.clone();
31019 }
31020
31021 public long[] tree_roots() {
31022 long[] tree_roots = Attribute.tree_roots.access(long[].class, onnxAttributes);
31023 return tree_roots.clone();
31024 }
31025
31026 public java.util.Optional<Long> n_targets() {
31027 Long n_targets = Attribute.n_targets.access(Long.class, onnxAttributes);
31028 return java.util.Optional.ofNullable(n_targets);
31029 }
31030
31031 public java.util.Optional<long[]> nodes_missing_value_tracks_true() {
31032 long[] nodes_missing_value_tracks_true = Attribute.nodes_missing_value_tracks_true.access(long[].class, onnxAttributes);
31033 return java.util.Optional.ofNullable(nodes_missing_value_tracks_true).map(long[]::clone);
31034 }
31035
31036 public java.util.Optional<Tensor> membership_values() {
31037 Tensor membership_values = Attribute.membership_values.access(Tensor.class, onnxAttributes);
31038 return java.util.Optional.ofNullable(membership_values);
31039 }
31040
31041 public Tensor nodes_splits() {
31042 Tensor nodes_splits = Attribute.nodes_splits.access(Tensor.class, onnxAttributes);
31043 return nodes_splits;
31044 }
31045
31046 }
31047
31048 public static TreeEnsemble TreeEnsemble(CodeType resultType, Value X, java.util.Optional<Long> aggregate_function, java.util.Optional<Tensor> nodes_hitrates, long[] nodes_featureids, long[] nodes_falseleafs, java.util.Optional<Long> post_transform, long[] nodes_trueleafs, Tensor nodes_modes, long[] nodes_falsenodeids, long[] nodes_truenodeids, Tensor leaf_weights, long[] leaf_targetids, long[] tree_roots, java.util.Optional<Long> n_targets, java.util.Optional<long[]> nodes_missing_value_tracks_true, java.util.Optional<Tensor> membership_values, Tensor nodes_splits) {
31049 return new TreeEnsemble(resultType, X, aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits);
31050 }
31051
31052 @OpFactoryHelper.OpDeclaration(TreeEnsembleClassifier.NAME)
31053 public static final class TreeEnsembleClassifier extends OnnxOp {
31054 public static final String NAME = "TreeEnsembleClassifier";
31055
31056 public enum Attribute implements OnnxAttribute {
31057 classlabels_int64s(long[].class, true, null),
31058 class_ids(long[].class, true, null),
31059 nodes_hitrates(float[].class, true, null),
31060 nodes_featureids(long[].class, true, null),
31061 nodes_treeids(long[].class, true, null),
31062 class_weights_as_tensor(Tensor.class, true, null),
31063 post_transform(String.class, true, "NONE"),
31064 nodes_modes(String[].class, true, null),
31065 nodes_falsenodeids(long[].class, true, null),
31066 classlabels_strings(String[].class, true, null),
31067 nodes_truenodeids(long[].class, true, null),
31068 nodes_nodeids(long[].class, true, null),
31069 nodes_hitrates_as_tensor(Tensor.class, true, null),
31070 class_weights(float[].class, true, null),
31071 base_values_as_tensor(Tensor.class, true, null),
31072 nodes_missing_value_tracks_true(long[].class, true, null),
31073 class_nodeids(long[].class, true, null),
31074 class_treeids(long[].class, true, null),
31075 base_values(float[].class, true, null),
31076 nodes_values(float[].class, true, null),
31077 nodes_values_as_tensor(Tensor.class, true, null),
31078 ;
31079
31080 final Class<?> t;
31081 final boolean optional;
31082 final Object defaultValue;
31083
31084 Attribute(Class<?> type, boolean optional, Object defaultValue) {
31085 this.t = type;
31086 this.optional = optional;
31087 this.defaultValue = defaultValue;
31088 assert optional || defaultValue == null;
31089 }
31090
31091 public Class<?> type() {
31092 return t;
31093 }
31094
31095 public boolean isOptional() {
31096 return optional;
31097 }
31098
31099 public Object defaultValue() {
31100 return defaultValue;
31101 }
31102 }
31103
31104 public enum TypeConstraint implements OnnxTypeConstraint {
31105 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
31106 T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))),
31107 ;
31108
31109 final OnnxType.TypeVariable typeVariable;
31110
31111 TypeConstraint(OnnxType.TypeVariable typeVariable) {
31112 assert typeVariable.name().equals(name());
31113 this.typeVariable = typeVariable;
31114 }
31115
31116 @Override
31117 public OnnxType.TypeVariable typeVariable() {
31118 return typeVariable;
31119 }
31120 }
31121
31122 public enum InputParameter implements OnnxParameter {
31123 X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
31124 ;
31125
31126 final OnnxType type;
31127 final Quantifier quantifier;
31128
31129 InputParameter(OnnxType type, Quantifier quantifier) {
31130 this.type = type;
31131 this.quantifier = quantifier;
31132 }
31133
31134 @Override
31135 public OnnxType type() {
31136 return type;
31137 }
31138
31139 @Override
31140 public Quantifier quantifier() {
31141 return quantifier;
31142 }
31143 }
31144
31145 public enum OutputParameter implements OnnxParameter {
31146 Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED),
31147 Z(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
31148 ;
31149
31150 final OnnxType type;
31151 final Quantifier quantifier;
31152
31153 OutputParameter(OnnxType type, Quantifier quantifier) {
31154 this.type = type;
31155 this.quantifier = quantifier;
31156 }
31157
31158 @Override
31159 public OnnxType type() {
31160 return type;
31161 }
31162
31163 @Override
31164 public Quantifier quantifier() {
31165 return quantifier;
31166 }
31167 }
31168
31169 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
31170 NAME,
31171 List.of(Attribute.values()),
31172 List.of(TypeConstraint.values()),
31173 List.of(InputParameter.values()),
31174 List.of(OutputParameter.values())
31175 );
31176
31177 public TreeEnsembleClassifier(ExternalizedOp def) {
31178 super(SCHEMA, def);
31179 }
31180
31181 TreeEnsembleClassifier(TreeEnsembleClassifier that, CodeContext cc) {
31182 super(that, cc);
31183 }
31184
31185 @Override
31186 public TreeEnsembleClassifier transform(CodeContext cc, CodeTransformer ot) {
31187 return new TreeEnsembleClassifier(this, cc);
31188 }
31189
31190 TreeEnsembleClassifier(CodeType resultType, Value X, java.util.Optional<long[]> classlabels_int64s, java.util.Optional<long[]> class_ids, java.util.Optional<float[]> nodes_hitrates, java.util.Optional<long[]> nodes_featureids, java.util.Optional<long[]> nodes_treeids, java.util.Optional<Tensor> class_weights_as_tensor, java.util.Optional<String> post_transform, java.util.Optional<String[]> nodes_modes, java.util.Optional<long[]> nodes_falsenodeids, java.util.Optional<String[]> classlabels_strings, java.util.Optional<long[]> nodes_truenodeids, java.util.Optional<long[]> nodes_nodeids, java.util.Optional<Tensor> nodes_hitrates_as_tensor, java.util.Optional<float[]> class_weights, java.util.Optional<Tensor> base_values_as_tensor, java.util.Optional<long[]> nodes_missing_value_tracks_true, java.util.Optional<long[]> class_nodeids, java.util.Optional<long[]> class_treeids, java.util.Optional<float[]> base_values, java.util.Optional<float[]> nodes_values, java.util.Optional<Tensor> nodes_values_as_tensor) {
31191 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(classlabels_int64s, class_ids, nodes_hitrates, nodes_featureids, nodes_treeids, class_weights_as_tensor, post_transform, nodes_modes, nodes_falsenodeids, classlabels_strings, nodes_truenodeids, nodes_nodeids, nodes_hitrates_as_tensor, class_weights, base_values_as_tensor, nodes_missing_value_tracks_true, class_nodeids, class_treeids, base_values, nodes_values, nodes_values_as_tensor));
31192 }
31193
31194 @Override
31195 public SequencedSet<OnnxParameter> onnxOutputs() {
31196 return onnxOutputs(SCHEMA);
31197 }
31198
31199 @Override
31200 public SequencedMap<OnnxParameter, Object> onnxInputs() {
31201 return onnxInputs(SCHEMA, List.of(X()));
31202 }
31203
31204 public Value X() {
31205 return operands().get(0);
31206 }
31207
31208 public java.util.Optional<long[]> classlabels_int64s() {
31209 long[] classlabels_int64s = Attribute.classlabels_int64s.access(long[].class, onnxAttributes);
31210 return java.util.Optional.ofNullable(classlabels_int64s).map(long[]::clone);
31211 }
31212
31213 public java.util.Optional<long[]> class_ids() {
31214 long[] class_ids = Attribute.class_ids.access(long[].class, onnxAttributes);
31215 return java.util.Optional.ofNullable(class_ids).map(long[]::clone);
31216 }
31217
31218 public java.util.Optional<float[]> nodes_hitrates() {
31219 float[] nodes_hitrates = Attribute.nodes_hitrates.access(float[].class, onnxAttributes);
31220 return java.util.Optional.ofNullable(nodes_hitrates).map(float[]::clone);
31221 }
31222
31223 public java.util.Optional<long[]> nodes_featureids() {
31224 long[] nodes_featureids = Attribute.nodes_featureids.access(long[].class, onnxAttributes);
31225 return java.util.Optional.ofNullable(nodes_featureids).map(long[]::clone);
31226 }
31227
31228 public java.util.Optional<long[]> nodes_treeids() {
31229 long[] nodes_treeids = Attribute.nodes_treeids.access(long[].class, onnxAttributes);
31230 return java.util.Optional.ofNullable(nodes_treeids).map(long[]::clone);
31231 }
31232
31233 public java.util.Optional<Tensor> class_weights_as_tensor() {
31234 Tensor class_weights_as_tensor = Attribute.class_weights_as_tensor.access(Tensor.class, onnxAttributes);
31235 return java.util.Optional.ofNullable(class_weights_as_tensor);
31236 }
31237
31238 public java.util.Optional<String> post_transform() {
31239 String post_transform = Attribute.post_transform.access(String.class, onnxAttributes);
31240 return java.util.Optional.ofNullable(post_transform);
31241 }
31242
31243 public java.util.Optional<String[]> nodes_modes() {
31244 String[] nodes_modes = Attribute.nodes_modes.access(String[].class, onnxAttributes);
31245 return java.util.Optional.ofNullable(nodes_modes).map(String[]::clone);
31246 }
31247
31248 public java.util.Optional<long[]> nodes_falsenodeids() {
31249 long[] nodes_falsenodeids = Attribute.nodes_falsenodeids.access(long[].class, onnxAttributes);
31250 return java.util.Optional.ofNullable(nodes_falsenodeids).map(long[]::clone);
31251 }
31252
31253 public java.util.Optional<String[]> classlabels_strings() {
31254 String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes);
31255 return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone);
31256 }
31257
31258 public java.util.Optional<long[]> nodes_truenodeids() {
31259 long[] nodes_truenodeids = Attribute.nodes_truenodeids.access(long[].class, onnxAttributes);
31260 return java.util.Optional.ofNullable(nodes_truenodeids).map(long[]::clone);
31261 }
31262
31263 public java.util.Optional<long[]> nodes_nodeids() {
31264 long[] nodes_nodeids = Attribute.nodes_nodeids.access(long[].class, onnxAttributes);
31265 return java.util.Optional.ofNullable(nodes_nodeids).map(long[]::clone);
31266 }
31267
31268 public java.util.Optional<Tensor> nodes_hitrates_as_tensor() {
31269 Tensor nodes_hitrates_as_tensor = Attribute.nodes_hitrates_as_tensor.access(Tensor.class, onnxAttributes);
31270 return java.util.Optional.ofNullable(nodes_hitrates_as_tensor);
31271 }
31272
31273 public java.util.Optional<float[]> class_weights() {
31274 float[] class_weights = Attribute.class_weights.access(float[].class, onnxAttributes);
31275 return java.util.Optional.ofNullable(class_weights).map(float[]::clone);
31276 }
31277
31278 public java.util.Optional<Tensor> base_values_as_tensor() {
31279 Tensor base_values_as_tensor = Attribute.base_values_as_tensor.access(Tensor.class, onnxAttributes);
31280 return java.util.Optional.ofNullable(base_values_as_tensor);
31281 }
31282
31283 public java.util.Optional<long[]> nodes_missing_value_tracks_true() {
31284 long[] nodes_missing_value_tracks_true = Attribute.nodes_missing_value_tracks_true.access(long[].class, onnxAttributes);
31285 return java.util.Optional.ofNullable(nodes_missing_value_tracks_true).map(long[]::clone);
31286 }
31287
31288 public java.util.Optional<long[]> class_nodeids() {
31289 long[] class_nodeids = Attribute.class_nodeids.access(long[].class, onnxAttributes);
31290 return java.util.Optional.ofNullable(class_nodeids).map(long[]::clone);
31291 }
31292
31293 public java.util.Optional<long[]> class_treeids() {
31294 long[] class_treeids = Attribute.class_treeids.access(long[].class, onnxAttributes);
31295 return java.util.Optional.ofNullable(class_treeids).map(long[]::clone);
31296 }
31297
31298 public java.util.Optional<float[]> base_values() {
31299 float[] base_values = Attribute.base_values.access(float[].class, onnxAttributes);
31300 return java.util.Optional.ofNullable(base_values).map(float[]::clone);
31301 }
31302
31303 public java.util.Optional<float[]> nodes_values() {
31304 float[] nodes_values = Attribute.nodes_values.access(float[].class, onnxAttributes);
31305 return java.util.Optional.ofNullable(nodes_values).map(float[]::clone);
31306 }
31307
31308 public java.util.Optional<Tensor> nodes_values_as_tensor() {
31309 Tensor nodes_values_as_tensor = Attribute.nodes_values_as_tensor.access(Tensor.class, onnxAttributes);
31310 return java.util.Optional.ofNullable(nodes_values_as_tensor);
31311 }
31312
31313 }
31314
31315 public static TreeEnsembleClassifier TreeEnsembleClassifier(CodeType resultType, Value X, java.util.Optional<long[]> classlabels_int64s, java.util.Optional<long[]> class_ids, java.util.Optional<float[]> nodes_hitrates, java.util.Optional<long[]> nodes_featureids, java.util.Optional<long[]> nodes_treeids, java.util.Optional<Tensor> class_weights_as_tensor, java.util.Optional<String> post_transform, java.util.Optional<String[]> nodes_modes, java.util.Optional<long[]> nodes_falsenodeids, java.util.Optional<String[]> classlabels_strings, java.util.Optional<long[]> nodes_truenodeids, java.util.Optional<long[]> nodes_nodeids, java.util.Optional<Tensor> nodes_hitrates_as_tensor, java.util.Optional<float[]> class_weights, java.util.Optional<Tensor> base_values_as_tensor, java.util.Optional<long[]> nodes_missing_value_tracks_true, java.util.Optional<long[]> class_nodeids, java.util.Optional<long[]> class_treeids, java.util.Optional<float[]> base_values, java.util.Optional<float[]> nodes_values, java.util.Optional<Tensor> nodes_values_as_tensor) {
31316 return new TreeEnsembleClassifier(resultType, X, classlabels_int64s, class_ids, nodes_hitrates, nodes_featureids, nodes_treeids, class_weights_as_tensor, post_transform, nodes_modes, nodes_falsenodeids, classlabels_strings, nodes_truenodeids, nodes_nodeids, nodes_hitrates_as_tensor, class_weights, base_values_as_tensor, nodes_missing_value_tracks_true, class_nodeids, class_treeids, base_values, nodes_values, nodes_values_as_tensor);
31317 }
31318
31319 @OpFactoryHelper.OpDeclaration(TreeEnsembleRegressor.NAME)
31320 public static final class TreeEnsembleRegressor extends OnnxOp {
31321 public static final String NAME = "TreeEnsembleRegressor";
31322
31323 public enum Attribute implements OnnxAttribute {
31324 aggregate_function(String.class, true, "SUM"),
31325 nodes_hitrates(float[].class, true, null),
31326 target_weights_as_tensor(Tensor.class, true, null),
31327 nodes_featureids(long[].class, true, null),
31328 target_treeids(long[].class, true, null),
31329 nodes_treeids(long[].class, true, null),
31330 post_transform(String.class, true, "NONE"),
31331 nodes_modes(String[].class, true, null),
31332 target_weights(float[].class, true, null),
31333 nodes_falsenodeids(long[].class, true, null),
31334 target_ids(long[].class, true, null),
31335 nodes_truenodeids(long[].class, true, null),
31336 target_nodeids(long[].class, true, null),
31337 nodes_nodeids(long[].class, true, null),
31338 nodes_hitrates_as_tensor(Tensor.class, true, null),
31339 base_values_as_tensor(Tensor.class, true, null),
31340 n_targets(Long.class, true, null),
31341 nodes_missing_value_tracks_true(long[].class, true, null),
31342 base_values(float[].class, true, null),
31343 nodes_values(float[].class, true, null),
31344 nodes_values_as_tensor(Tensor.class, true, null),
31345 ;
31346
31347 final Class<?> t;
31348 final boolean optional;
31349 final Object defaultValue;
31350
31351 Attribute(Class<?> type, boolean optional, Object defaultValue) {
31352 this.t = type;
31353 this.optional = optional;
31354 this.defaultValue = defaultValue;
31355 assert optional || defaultValue == null;
31356 }
31357
31358 public Class<?> type() {
31359 return t;
31360 }
31361
31362 public boolean isOptional() {
31363 return optional;
31364 }
31365
31366 public Object defaultValue() {
31367 return defaultValue;
31368 }
31369 }
31370
31371 public enum TypeConstraint implements OnnxTypeConstraint {
31372 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))),
31373 ;
31374
31375 final OnnxType.TypeVariable typeVariable;
31376
31377 TypeConstraint(OnnxType.TypeVariable typeVariable) {
31378 assert typeVariable.name().equals(name());
31379 this.typeVariable = typeVariable;
31380 }
31381
31382 @Override
31383 public OnnxType.TypeVariable typeVariable() {
31384 return typeVariable;
31385 }
31386 }
31387
31388 public enum InputParameter implements OnnxParameter {
31389 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31390 ;
31391
31392 final OnnxType type;
31393 final Quantifier quantifier;
31394
31395 InputParameter(OnnxType type, Quantifier quantifier) {
31396 this.type = type;
31397 this.quantifier = quantifier;
31398 }
31399
31400 @Override
31401 public OnnxType type() {
31402 return type;
31403 }
31404
31405 @Override
31406 public Quantifier quantifier() {
31407 return quantifier;
31408 }
31409 }
31410
31411 public enum OutputParameter implements OnnxParameter {
31412 Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
31413 ;
31414
31415 final OnnxType type;
31416 final Quantifier quantifier;
31417
31418 OutputParameter(OnnxType type, Quantifier quantifier) {
31419 this.type = type;
31420 this.quantifier = quantifier;
31421 }
31422
31423 @Override
31424 public OnnxType type() {
31425 return type;
31426 }
31427
31428 @Override
31429 public Quantifier quantifier() {
31430 return quantifier;
31431 }
31432 }
31433
31434 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
31435 NAME,
31436 List.of(Attribute.values()),
31437 List.of(TypeConstraint.values()),
31438 List.of(InputParameter.values()),
31439 List.of(OutputParameter.values())
31440 );
31441
31442 public TreeEnsembleRegressor(ExternalizedOp def) {
31443 super(SCHEMA, def);
31444 }
31445
31446 TreeEnsembleRegressor(TreeEnsembleRegressor that, CodeContext cc) {
31447 super(that, cc);
31448 }
31449
31450 @Override
31451 public TreeEnsembleRegressor transform(CodeContext cc, CodeTransformer ot) {
31452 return new TreeEnsembleRegressor(this, cc);
31453 }
31454
31455 TreeEnsembleRegressor(CodeType resultType, Value X, java.util.Optional<String> aggregate_function, java.util.Optional<float[]> nodes_hitrates, java.util.Optional<Tensor> target_weights_as_tensor, java.util.Optional<long[]> nodes_featureids, java.util.Optional<long[]> target_treeids, java.util.Optional<long[]> nodes_treeids, java.util.Optional<String> post_transform, java.util.Optional<String[]> nodes_modes, java.util.Optional<float[]> target_weights, java.util.Optional<long[]> nodes_falsenodeids, java.util.Optional<long[]> target_ids, java.util.Optional<long[]> nodes_truenodeids, java.util.Optional<long[]> target_nodeids, java.util.Optional<long[]> nodes_nodeids, java.util.Optional<Tensor> nodes_hitrates_as_tensor, java.util.Optional<Tensor> base_values_as_tensor, java.util.Optional<Long> n_targets, java.util.Optional<long[]> nodes_missing_value_tracks_true, java.util.Optional<float[]> base_values, java.util.Optional<float[]> nodes_values, java.util.Optional<Tensor> nodes_values_as_tensor) {
31456 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(aggregate_function, nodes_hitrates, target_weights_as_tensor, nodes_featureids, target_treeids, nodes_treeids, post_transform, nodes_modes, target_weights, nodes_falsenodeids, target_ids, nodes_truenodeids, target_nodeids, nodes_nodeids, nodes_hitrates_as_tensor, base_values_as_tensor, n_targets, nodes_missing_value_tracks_true, base_values, nodes_values, nodes_values_as_tensor));
31457 }
31458
31459 @Override
31460 public SequencedSet<OnnxParameter> onnxOutputs() {
31461 return onnxOutputs(SCHEMA);
31462 }
31463
31464 @Override
31465 public SequencedMap<OnnxParameter, Object> onnxInputs() {
31466 return onnxInputs(SCHEMA, List.of(X()));
31467 }
31468
31469 public Value X() {
31470 return operands().get(0);
31471 }
31472
31473 public java.util.Optional<String> aggregate_function() {
31474 String aggregate_function = Attribute.aggregate_function.access(String.class, onnxAttributes);
31475 return java.util.Optional.ofNullable(aggregate_function);
31476 }
31477
31478 public java.util.Optional<float[]> nodes_hitrates() {
31479 float[] nodes_hitrates = Attribute.nodes_hitrates.access(float[].class, onnxAttributes);
31480 return java.util.Optional.ofNullable(nodes_hitrates).map(float[]::clone);
31481 }
31482
31483 public java.util.Optional<Tensor> target_weights_as_tensor() {
31484 Tensor target_weights_as_tensor = Attribute.target_weights_as_tensor.access(Tensor.class, onnxAttributes);
31485 return java.util.Optional.ofNullable(target_weights_as_tensor);
31486 }
31487
31488 public java.util.Optional<long[]> nodes_featureids() {
31489 long[] nodes_featureids = Attribute.nodes_featureids.access(long[].class, onnxAttributes);
31490 return java.util.Optional.ofNullable(nodes_featureids).map(long[]::clone);
31491 }
31492
31493 public java.util.Optional<long[]> target_treeids() {
31494 long[] target_treeids = Attribute.target_treeids.access(long[].class, onnxAttributes);
31495 return java.util.Optional.ofNullable(target_treeids).map(long[]::clone);
31496 }
31497
31498 public java.util.Optional<long[]> nodes_treeids() {
31499 long[] nodes_treeids = Attribute.nodes_treeids.access(long[].class, onnxAttributes);
31500 return java.util.Optional.ofNullable(nodes_treeids).map(long[]::clone);
31501 }
31502
31503 public java.util.Optional<String> post_transform() {
31504 String post_transform = Attribute.post_transform.access(String.class, onnxAttributes);
31505 return java.util.Optional.ofNullable(post_transform);
31506 }
31507
31508 public java.util.Optional<String[]> nodes_modes() {
31509 String[] nodes_modes = Attribute.nodes_modes.access(String[].class, onnxAttributes);
31510 return java.util.Optional.ofNullable(nodes_modes).map(String[]::clone);
31511 }
31512
31513 public java.util.Optional<float[]> target_weights() {
31514 float[] target_weights = Attribute.target_weights.access(float[].class, onnxAttributes);
31515 return java.util.Optional.ofNullable(target_weights).map(float[]::clone);
31516 }
31517
31518 public java.util.Optional<long[]> nodes_falsenodeids() {
31519 long[] nodes_falsenodeids = Attribute.nodes_falsenodeids.access(long[].class, onnxAttributes);
31520 return java.util.Optional.ofNullable(nodes_falsenodeids).map(long[]::clone);
31521 }
31522
31523 public java.util.Optional<long[]> target_ids() {
31524 long[] target_ids = Attribute.target_ids.access(long[].class, onnxAttributes);
31525 return java.util.Optional.ofNullable(target_ids).map(long[]::clone);
31526 }
31527
31528 public java.util.Optional<long[]> nodes_truenodeids() {
31529 long[] nodes_truenodeids = Attribute.nodes_truenodeids.access(long[].class, onnxAttributes);
31530 return java.util.Optional.ofNullable(nodes_truenodeids).map(long[]::clone);
31531 }
31532
31533 public java.util.Optional<long[]> target_nodeids() {
31534 long[] target_nodeids = Attribute.target_nodeids.access(long[].class, onnxAttributes);
31535 return java.util.Optional.ofNullable(target_nodeids).map(long[]::clone);
31536 }
31537
31538 public java.util.Optional<long[]> nodes_nodeids() {
31539 long[] nodes_nodeids = Attribute.nodes_nodeids.access(long[].class, onnxAttributes);
31540 return java.util.Optional.ofNullable(nodes_nodeids).map(long[]::clone);
31541 }
31542
31543 public java.util.Optional<Tensor> nodes_hitrates_as_tensor() {
31544 Tensor nodes_hitrates_as_tensor = Attribute.nodes_hitrates_as_tensor.access(Tensor.class, onnxAttributes);
31545 return java.util.Optional.ofNullable(nodes_hitrates_as_tensor);
31546 }
31547
31548 public java.util.Optional<Tensor> base_values_as_tensor() {
31549 Tensor base_values_as_tensor = Attribute.base_values_as_tensor.access(Tensor.class, onnxAttributes);
31550 return java.util.Optional.ofNullable(base_values_as_tensor);
31551 }
31552
31553 public java.util.Optional<Long> n_targets() {
31554 Long n_targets = Attribute.n_targets.access(Long.class, onnxAttributes);
31555 return java.util.Optional.ofNullable(n_targets);
31556 }
31557
31558 public java.util.Optional<long[]> nodes_missing_value_tracks_true() {
31559 long[] nodes_missing_value_tracks_true = Attribute.nodes_missing_value_tracks_true.access(long[].class, onnxAttributes);
31560 return java.util.Optional.ofNullable(nodes_missing_value_tracks_true).map(long[]::clone);
31561 }
31562
31563 public java.util.Optional<float[]> base_values() {
31564 float[] base_values = Attribute.base_values.access(float[].class, onnxAttributes);
31565 return java.util.Optional.ofNullable(base_values).map(float[]::clone);
31566 }
31567
31568 public java.util.Optional<float[]> nodes_values() {
31569 float[] nodes_values = Attribute.nodes_values.access(float[].class, onnxAttributes);
31570 return java.util.Optional.ofNullable(nodes_values).map(float[]::clone);
31571 }
31572
31573 public java.util.Optional<Tensor> nodes_values_as_tensor() {
31574 Tensor nodes_values_as_tensor = Attribute.nodes_values_as_tensor.access(Tensor.class, onnxAttributes);
31575 return java.util.Optional.ofNullable(nodes_values_as_tensor);
31576 }
31577
31578 }
31579
31580 public static TreeEnsembleRegressor TreeEnsembleRegressor(CodeType resultType, Value X, java.util.Optional<String> aggregate_function, java.util.Optional<float[]> nodes_hitrates, java.util.Optional<Tensor> target_weights_as_tensor, java.util.Optional<long[]> nodes_featureids, java.util.Optional<long[]> target_treeids, java.util.Optional<long[]> nodes_treeids, java.util.Optional<String> post_transform, java.util.Optional<String[]> nodes_modes, java.util.Optional<float[]> target_weights, java.util.Optional<long[]> nodes_falsenodeids, java.util.Optional<long[]> target_ids, java.util.Optional<long[]> nodes_truenodeids, java.util.Optional<long[]> target_nodeids, java.util.Optional<long[]> nodes_nodeids, java.util.Optional<Tensor> nodes_hitrates_as_tensor, java.util.Optional<Tensor> base_values_as_tensor, java.util.Optional<Long> n_targets, java.util.Optional<long[]> nodes_missing_value_tracks_true, java.util.Optional<float[]> base_values, java.util.Optional<float[]> nodes_values, java.util.Optional<Tensor> nodes_values_as_tensor) {
31581 return new TreeEnsembleRegressor(resultType, X, aggregate_function, nodes_hitrates, target_weights_as_tensor, nodes_featureids, target_treeids, nodes_treeids, post_transform, nodes_modes, target_weights, nodes_falsenodeids, target_ids, nodes_truenodeids, target_nodeids, nodes_nodeids, nodes_hitrates_as_tensor, base_values_as_tensor, n_targets, nodes_missing_value_tracks_true, base_values, nodes_values, nodes_values_as_tensor);
31582 }
31583
31584 @OpFactoryHelper.OpDeclaration(Trilu.NAME)
31585 public static final class Trilu extends OnnxOp {
31586 public static final String NAME = "Trilu";
31587
31588 public enum Attribute implements OnnxAttribute {
31589 upper(Long.class, true, 1),
31590 ;
31591
31592 final Class<?> t;
31593 final boolean optional;
31594 final Object defaultValue;
31595
31596 Attribute(Class<?> type, boolean optional, Object defaultValue) {
31597 this.t = type;
31598 this.optional = optional;
31599 this.defaultValue = defaultValue;
31600 assert optional || defaultValue == null;
31601 }
31602
31603 public Class<?> type() {
31604 return t;
31605 }
31606
31607 public boolean isOptional() {
31608 return optional;
31609 }
31610
31611 public Object defaultValue() {
31612 return defaultValue;
31613 }
31614 }
31615
31616 public enum TypeConstraint implements OnnxTypeConstraint {
31617 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
31618 ;
31619
31620 final OnnxType.TypeVariable typeVariable;
31621
31622 TypeConstraint(OnnxType.TypeVariable typeVariable) {
31623 assert typeVariable.name().equals(name());
31624 this.typeVariable = typeVariable;
31625 }
31626
31627 @Override
31628 public OnnxType.TypeVariable typeVariable() {
31629 return typeVariable;
31630 }
31631 }
31632
31633 public enum InputParameter implements OnnxParameter {
31634 input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31635 k(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
31636 ;
31637
31638 final OnnxType type;
31639 final Quantifier quantifier;
31640
31641 InputParameter(OnnxType type, Quantifier quantifier) {
31642 this.type = type;
31643 this.quantifier = quantifier;
31644 }
31645
31646 @Override
31647 public OnnxType type() {
31648 return type;
31649 }
31650
31651 @Override
31652 public Quantifier quantifier() {
31653 return quantifier;
31654 }
31655 }
31656
31657 public enum OutputParameter implements OnnxParameter {
31658 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31659 ;
31660
31661 final OnnxType type;
31662 final Quantifier quantifier;
31663
31664 OutputParameter(OnnxType type, Quantifier quantifier) {
31665 this.type = type;
31666 this.quantifier = quantifier;
31667 }
31668
31669 @Override
31670 public OnnxType type() {
31671 return type;
31672 }
31673
31674 @Override
31675 public Quantifier quantifier() {
31676 return quantifier;
31677 }
31678 }
31679
31680 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
31681 NAME,
31682 List.of(Attribute.values()),
31683 List.of(TypeConstraint.values()),
31684 List.of(InputParameter.values()),
31685 List.of(OutputParameter.values())
31686 );
31687
31688 public Trilu(ExternalizedOp def) {
31689 super(SCHEMA, def);
31690 }
31691
31692 Trilu(Trilu that, CodeContext cc) {
31693 super(that, cc);
31694 }
31695
31696 @Override
31697 public Trilu transform(CodeContext cc, CodeTransformer ot) {
31698 return new Trilu(this, cc);
31699 }
31700
31701 Trilu(CodeType resultType, Value input, java.util.Optional<Value> k, java.util.Optional<Long> upper) {
31702 super(SCHEMA, resultType, Set.of(), List.of(input, k), List.of(upper));
31703 }
31704
31705 @Override
31706 public SequencedSet<OnnxParameter> onnxOutputs() {
31707 return onnxOutputs(SCHEMA);
31708 }
31709
31710 @Override
31711 public SequencedMap<OnnxParameter, Object> onnxInputs() {
31712 return onnxInputs(SCHEMA, List.of(input(), k()));
31713 }
31714
31715 public Value input() {
31716 return operands().get(0);
31717 }
31718
31719 public java.util.Optional<Value> k() {
31720 int i = optionalInputArguments.indexOf(InputParameter.k);
31721 return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty();
31722 }
31723
31724 public java.util.Optional<Long> upper() {
31725 Long upper = Attribute.upper.access(Long.class, onnxAttributes);
31726 return java.util.Optional.ofNullable(upper);
31727 }
31728
31729 }
31730
31731 public static Trilu Trilu(CodeType resultType, Value input, java.util.Optional<Value> k, java.util.Optional<Long> upper) {
31732 return new Trilu(resultType, input, k, upper);
31733 }
31734
31735 @OpFactoryHelper.OpDeclaration(Unique.NAME)
31736 public static final class Unique extends OnnxOp {
31737 public static final String NAME = "Unique";
31738
31739 public enum Attribute implements OnnxAttribute {
31740 sorted(Long.class, true, 1),
31741 axis(Long.class, true, null),
31742 ;
31743
31744 final Class<?> t;
31745 final boolean optional;
31746 final Object defaultValue;
31747
31748 Attribute(Class<?> type, boolean optional, Object defaultValue) {
31749 this.t = type;
31750 this.optional = optional;
31751 this.defaultValue = defaultValue;
31752 assert optional || defaultValue == null;
31753 }
31754
31755 public Class<?> type() {
31756 return t;
31757 }
31758
31759 public boolean isOptional() {
31760 return optional;
31761 }
31762
31763 public Object defaultValue() {
31764 return defaultValue;
31765 }
31766 }
31767
31768 public enum TypeConstraint implements OnnxTypeConstraint {
31769 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
31770 ;
31771
31772 final OnnxType.TypeVariable typeVariable;
31773
31774 TypeConstraint(OnnxType.TypeVariable typeVariable) {
31775 assert typeVariable.name().equals(name());
31776 this.typeVariable = typeVariable;
31777 }
31778
31779 @Override
31780 public OnnxType.TypeVariable typeVariable() {
31781 return typeVariable;
31782 }
31783 }
31784
31785 public enum InputParameter implements OnnxParameter {
31786 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31787 ;
31788
31789 final OnnxType type;
31790 final Quantifier quantifier;
31791
31792 InputParameter(OnnxType type, Quantifier quantifier) {
31793 this.type = type;
31794 this.quantifier = quantifier;
31795 }
31796
31797 @Override
31798 public OnnxType type() {
31799 return type;
31800 }
31801
31802 @Override
31803 public Quantifier quantifier() {
31804 return quantifier;
31805 }
31806 }
31807
31808 public enum OutputParameter implements OnnxParameter {
31809 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31810 indices(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
31811 inverse_indices(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
31812 counts(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL),
31813 ;
31814
31815 final OnnxType type;
31816 final Quantifier quantifier;
31817
31818 OutputParameter(OnnxType type, Quantifier quantifier) {
31819 this.type = type;
31820 this.quantifier = quantifier;
31821 }
31822
31823 @Override
31824 public OnnxType type() {
31825 return type;
31826 }
31827
31828 @Override
31829 public Quantifier quantifier() {
31830 return quantifier;
31831 }
31832 }
31833
31834 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
31835 NAME,
31836 List.of(Attribute.values()),
31837 List.of(TypeConstraint.values()),
31838 List.of(InputParameter.values()),
31839 List.of(OutputParameter.values())
31840 );
31841
31842 public Unique(ExternalizedOp def) {
31843 super(SCHEMA, def);
31844 }
31845
31846 Unique(Unique that, CodeContext cc) {
31847 super(that, cc);
31848 }
31849
31850 @Override
31851 public Unique transform(CodeContext cc, CodeTransformer ot) {
31852 return new Unique(this, cc);
31853 }
31854
31855 Unique(CodeType resultType, Set<OutputParameter> optionalOutputs, Value X, java.util.Optional<Long> sorted, java.util.Optional<Long> axis) {
31856 super(SCHEMA, resultType, optionalOutputs, List.of(X), List.of(sorted, axis));
31857 }
31858
31859 @Override
31860 public SequencedSet<OnnxParameter> onnxOutputs() {
31861 return onnxOutputs(SCHEMA);
31862 }
31863
31864 @Override
31865 public SequencedMap<OnnxParameter, Object> onnxInputs() {
31866 return onnxInputs(SCHEMA, List.of(X()));
31867 }
31868
31869 public Value X() {
31870 return operands().get(0);
31871 }
31872
31873 public java.util.Optional<Long> sorted() {
31874 Long sorted = Attribute.sorted.access(Long.class, onnxAttributes);
31875 return java.util.Optional.ofNullable(sorted);
31876 }
31877
31878 public java.util.Optional<Long> axis() {
31879 Long axis = Attribute.axis.access(Long.class, onnxAttributes);
31880 return java.util.Optional.ofNullable(axis);
31881 }
31882
31883 }
31884
31885 public static Unique Unique(CodeType resultType, Set<Unique.OutputParameter> optionalOutputs, Value X, java.util.Optional<Long> sorted, java.util.Optional<Long> axis) {
31886 return new Unique(resultType, optionalOutputs, X, sorted, axis);
31887 }
31888
31889 @OpFactoryHelper.OpDeclaration(Unsqueeze.NAME)
31890 public static final class Unsqueeze extends OnnxOp {
31891 public static final String NAME = "Unsqueeze";
31892
31893 public enum Attribute implements OnnxAttribute.None { }
31894
31895 public enum TypeConstraint implements OnnxTypeConstraint {
31896 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))),
31897 ;
31898
31899 final OnnxType.TypeVariable typeVariable;
31900
31901 TypeConstraint(OnnxType.TypeVariable typeVariable) {
31902 assert typeVariable.name().equals(name());
31903 this.typeVariable = typeVariable;
31904 }
31905
31906 @Override
31907 public OnnxType.TypeVariable typeVariable() {
31908 return typeVariable;
31909 }
31910 }
31911
31912 public enum InputParameter implements OnnxParameter {
31913 data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31914 axes(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED),
31915 ;
31916
31917 final OnnxType type;
31918 final Quantifier quantifier;
31919
31920 InputParameter(OnnxType type, Quantifier quantifier) {
31921 this.type = type;
31922 this.quantifier = quantifier;
31923 }
31924
31925 @Override
31926 public OnnxType type() {
31927 return type;
31928 }
31929
31930 @Override
31931 public Quantifier quantifier() {
31932 return quantifier;
31933 }
31934 }
31935
31936 public enum OutputParameter implements OnnxParameter {
31937 expanded(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
31938 ;
31939
31940 final OnnxType type;
31941 final Quantifier quantifier;
31942
31943 OutputParameter(OnnxType type, Quantifier quantifier) {
31944 this.type = type;
31945 this.quantifier = quantifier;
31946 }
31947
31948 @Override
31949 public OnnxType type() {
31950 return type;
31951 }
31952
31953 @Override
31954 public Quantifier quantifier() {
31955 return quantifier;
31956 }
31957 }
31958
31959 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
31960 NAME,
31961 List.of(Attribute.values()),
31962 List.of(TypeConstraint.values()),
31963 List.of(InputParameter.values()),
31964 List.of(OutputParameter.values())
31965 );
31966
31967 public Unsqueeze(ExternalizedOp def) {
31968 super(SCHEMA, def);
31969 }
31970
31971 Unsqueeze(Unsqueeze that, CodeContext cc) {
31972 super(that, cc);
31973 }
31974
31975 @Override
31976 public Unsqueeze transform(CodeContext cc, CodeTransformer ot) {
31977 return new Unsqueeze(this, cc);
31978 }
31979
31980 Unsqueeze(CodeType resultType, Value data, Value axes) {
31981 super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of());
31982 }
31983
31984 @Override
31985 public SequencedSet<OnnxParameter> onnxOutputs() {
31986 return onnxOutputs(SCHEMA);
31987 }
31988
31989 @Override
31990 public SequencedMap<OnnxParameter, Object> onnxInputs() {
31991 return onnxInputs(SCHEMA, List.of(data(), axes()));
31992 }
31993
31994 public Value data() {
31995 return operands().get(0);
31996 }
31997
31998 public Value axes() {
31999 return operands().get(1);
32000 }
32001
32002 }
32003
32004 public static Unsqueeze Unsqueeze(CodeType resultType, Value data, Value axes) {
32005 return new Unsqueeze(resultType, data, axes);
32006 }
32007
32008 @OpFactoryHelper.OpDeclaration(Upsample.NAME)
32009 public static final class Upsample extends OnnxOp {
32010 public static final String NAME = "Upsample";
32011
32012 public enum Attribute implements OnnxAttribute {
32013 mode(String.class, true, "nearest"),
32014 ;
32015
32016 final Class<?> t;
32017 final boolean optional;
32018 final Object defaultValue;
32019
32020 Attribute(Class<?> type, boolean optional, Object defaultValue) {
32021 this.t = type;
32022 this.optional = optional;
32023 this.defaultValue = defaultValue;
32024 assert optional || defaultValue == null;
32025 }
32026
32027 public Class<?> type() {
32028 return t;
32029 }
32030
32031 public boolean isOptional() {
32032 return optional;
32033 }
32034
32035 public Object defaultValue() {
32036 return defaultValue;
32037 }
32038 }
32039
32040 public enum TypeConstraint implements OnnxTypeConstraint {
32041 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
32042 ;
32043
32044 final OnnxType.TypeVariable typeVariable;
32045
32046 TypeConstraint(OnnxType.TypeVariable typeVariable) {
32047 assert typeVariable.name().equals(name());
32048 this.typeVariable = typeVariable;
32049 }
32050
32051 @Override
32052 public OnnxType.TypeVariable typeVariable() {
32053 return typeVariable;
32054 }
32055 }
32056
32057 public enum InputParameter implements OnnxParameter {
32058 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32059 scales(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
32060 ;
32061
32062 final OnnxType type;
32063 final Quantifier quantifier;
32064
32065 InputParameter(OnnxType type, Quantifier quantifier) {
32066 this.type = type;
32067 this.quantifier = quantifier;
32068 }
32069
32070 @Override
32071 public OnnxType type() {
32072 return type;
32073 }
32074
32075 @Override
32076 public Quantifier quantifier() {
32077 return quantifier;
32078 }
32079 }
32080
32081 public enum OutputParameter implements OnnxParameter {
32082 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32083 ;
32084
32085 final OnnxType type;
32086 final Quantifier quantifier;
32087
32088 OutputParameter(OnnxType type, Quantifier quantifier) {
32089 this.type = type;
32090 this.quantifier = quantifier;
32091 }
32092
32093 @Override
32094 public OnnxType type() {
32095 return type;
32096 }
32097
32098 @Override
32099 public Quantifier quantifier() {
32100 return quantifier;
32101 }
32102 }
32103
32104 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
32105 NAME,
32106 List.of(Attribute.values()),
32107 List.of(TypeConstraint.values()),
32108 List.of(InputParameter.values()),
32109 List.of(OutputParameter.values())
32110 );
32111
32112 public Upsample(ExternalizedOp def) {
32113 super(SCHEMA, def);
32114 }
32115
32116 Upsample(Upsample that, CodeContext cc) {
32117 super(that, cc);
32118 }
32119
32120 @Override
32121 public Upsample transform(CodeContext cc, CodeTransformer ot) {
32122 return new Upsample(this, cc);
32123 }
32124
32125 Upsample(CodeType resultType, Value X, Value scales, java.util.Optional<String> mode) {
32126 super(SCHEMA, resultType, Set.of(), List.of(X, scales), List.of(mode));
32127 }
32128
32129 @Override
32130 public SequencedSet<OnnxParameter> onnxOutputs() {
32131 return onnxOutputs(SCHEMA);
32132 }
32133
32134 @Override
32135 public SequencedMap<OnnxParameter, Object> onnxInputs() {
32136 return onnxInputs(SCHEMA, List.of(X(), scales()));
32137 }
32138
32139 public Value X() {
32140 return operands().get(0);
32141 }
32142
32143 public Value scales() {
32144 return operands().get(1);
32145 }
32146
32147 public java.util.Optional<String> mode() {
32148 String mode = Attribute.mode.access(String.class, onnxAttributes);
32149 return java.util.Optional.ofNullable(mode);
32150 }
32151
32152 }
32153
32154 public static Upsample Upsample(CodeType resultType, Value X, Value scales, java.util.Optional<String> mode) {
32155 return new Upsample(resultType, X, scales, mode);
32156 }
32157
32158 @OpFactoryHelper.OpDeclaration(Where.NAME)
32159 public static final class Where extends OnnxOp {
32160 public static final String NAME = "Where";
32161
32162 public enum Attribute implements OnnxAttribute.None { }
32163
32164 public enum TypeConstraint implements OnnxTypeConstraint {
32165 B(new OnnxType.TypeVariable("B", List.of(OnnxType.tensor(OnnxType.bool())))),
32166 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))),
32167 ;
32168
32169 final OnnxType.TypeVariable typeVariable;
32170
32171 TypeConstraint(OnnxType.TypeVariable typeVariable) {
32172 assert typeVariable.name().equals(name());
32173 this.typeVariable = typeVariable;
32174 }
32175
32176 @Override
32177 public OnnxType.TypeVariable typeVariable() {
32178 return typeVariable;
32179 }
32180 }
32181
32182 public enum InputParameter implements OnnxParameter {
32183 condition(TypeConstraint.B.typeVariable(), Quantifier.REQUIRED),
32184 X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32185 Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32186 ;
32187
32188 final OnnxType type;
32189 final Quantifier quantifier;
32190
32191 InputParameter(OnnxType type, Quantifier quantifier) {
32192 this.type = type;
32193 this.quantifier = quantifier;
32194 }
32195
32196 @Override
32197 public OnnxType type() {
32198 return type;
32199 }
32200
32201 @Override
32202 public Quantifier quantifier() {
32203 return quantifier;
32204 }
32205 }
32206
32207 public enum OutputParameter implements OnnxParameter {
32208 output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32209 ;
32210
32211 final OnnxType type;
32212 final Quantifier quantifier;
32213
32214 OutputParameter(OnnxType type, Quantifier quantifier) {
32215 this.type = type;
32216 this.quantifier = quantifier;
32217 }
32218
32219 @Override
32220 public OnnxType type() {
32221 return type;
32222 }
32223
32224 @Override
32225 public Quantifier quantifier() {
32226 return quantifier;
32227 }
32228 }
32229
32230 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
32231 NAME,
32232 List.of(Attribute.values()),
32233 List.of(TypeConstraint.values()),
32234 List.of(InputParameter.values()),
32235 List.of(OutputParameter.values())
32236 );
32237
32238 public Where(ExternalizedOp def) {
32239 super(SCHEMA, def);
32240 }
32241
32242 Where(Where that, CodeContext cc) {
32243 super(that, cc);
32244 }
32245
32246 @Override
32247 public Where transform(CodeContext cc, CodeTransformer ot) {
32248 return new Where(this, cc);
32249 }
32250
32251 Where(CodeType resultType, Value condition, Value X, Value Y) {
32252 super(SCHEMA, resultType, Set.of(), List.of(condition, X, Y), List.of());
32253 }
32254
32255 @Override
32256 public SequencedSet<OnnxParameter> onnxOutputs() {
32257 return onnxOutputs(SCHEMA);
32258 }
32259
32260 @Override
32261 public SequencedMap<OnnxParameter, Object> onnxInputs() {
32262 return onnxInputs(SCHEMA, List.of(condition(), X(), Y()));
32263 }
32264
32265 public Value condition() {
32266 return operands().get(0);
32267 }
32268
32269 public Value X() {
32270 return operands().get(1);
32271 }
32272
32273 public Value Y() {
32274 return operands().get(2);
32275 }
32276
32277 }
32278
32279 public static Where Where(CodeType resultType, Value condition, Value X, Value Y) {
32280 return new Where(resultType, condition, X, Y);
32281 }
32282
32283 @OpFactoryHelper.OpDeclaration(Xor.NAME)
32284 public static final class Xor extends OnnxOp {
32285 public static final String NAME = "Xor";
32286
32287 public enum Attribute implements OnnxAttribute.None { }
32288
32289 public enum TypeConstraint implements OnnxTypeConstraint {
32290 T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))),
32291 T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))),
32292 ;
32293
32294 final OnnxType.TypeVariable typeVariable;
32295
32296 TypeConstraint(OnnxType.TypeVariable typeVariable) {
32297 assert typeVariable.name().equals(name());
32298 this.typeVariable = typeVariable;
32299 }
32300
32301 @Override
32302 public OnnxType.TypeVariable typeVariable() {
32303 return typeVariable;
32304 }
32305 }
32306
32307 public enum InputParameter implements OnnxParameter {
32308 A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32309 B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32310 ;
32311
32312 final OnnxType type;
32313 final Quantifier quantifier;
32314
32315 InputParameter(OnnxType type, Quantifier quantifier) {
32316 this.type = type;
32317 this.quantifier = quantifier;
32318 }
32319
32320 @Override
32321 public OnnxType type() {
32322 return type;
32323 }
32324
32325 @Override
32326 public Quantifier quantifier() {
32327 return quantifier;
32328 }
32329 }
32330
32331 public enum OutputParameter implements OnnxParameter {
32332 C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED),
32333 ;
32334
32335 final OnnxType type;
32336 final Quantifier quantifier;
32337
32338 OutputParameter(OnnxType type, Quantifier quantifier) {
32339 this.type = type;
32340 this.quantifier = quantifier;
32341 }
32342
32343 @Override
32344 public OnnxType type() {
32345 return type;
32346 }
32347
32348 @Override
32349 public Quantifier quantifier() {
32350 return quantifier;
32351 }
32352 }
32353
32354 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
32355 NAME,
32356 List.of(Attribute.values()),
32357 List.of(TypeConstraint.values()),
32358 List.of(InputParameter.values()),
32359 List.of(OutputParameter.values())
32360 );
32361
32362 public Xor(ExternalizedOp def) {
32363 super(SCHEMA, def);
32364 }
32365
32366 Xor(Xor that, CodeContext cc) {
32367 super(that, cc);
32368 }
32369
32370 @Override
32371 public Xor transform(CodeContext cc, CodeTransformer ot) {
32372 return new Xor(this, cc);
32373 }
32374
32375 Xor(CodeType resultType, Value A, Value B) {
32376 super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of());
32377 }
32378
32379 @Override
32380 public SequencedSet<OnnxParameter> onnxOutputs() {
32381 return onnxOutputs(SCHEMA);
32382 }
32383
32384 @Override
32385 public SequencedMap<OnnxParameter, Object> onnxInputs() {
32386 return onnxInputs(SCHEMA, List.of(A(), B()));
32387 }
32388
32389 public Value A() {
32390 return operands().get(0);
32391 }
32392
32393 public Value B() {
32394 return operands().get(1);
32395 }
32396
32397 }
32398
32399 public static Xor Xor(CodeType resultType, Value A, Value B) {
32400 return new Xor(resultType, A, B);
32401 }
32402
32403 @OpFactoryHelper.OpDeclaration(ZipMap.NAME)
32404 public static final class ZipMap extends OnnxOp {
32405 public static final String NAME = "ZipMap";
32406
32407 public enum Attribute implements OnnxAttribute {
32408 classlabels_int64s(long[].class, true, null),
32409 classlabels_strings(String[].class, true, null),
32410 ;
32411
32412 final Class<?> t;
32413 final boolean optional;
32414 final Object defaultValue;
32415
32416 Attribute(Class<?> type, boolean optional, Object defaultValue) {
32417 this.t = type;
32418 this.optional = optional;
32419 this.defaultValue = defaultValue;
32420 assert optional || defaultValue == null;
32421 }
32422
32423 public Class<?> type() {
32424 return t;
32425 }
32426
32427 public boolean isOptional() {
32428 return optional;
32429 }
32430
32431 public Object defaultValue() {
32432 return defaultValue;
32433 }
32434 }
32435
32436 public enum TypeConstraint implements OnnxTypeConstraint {
32437 T(new OnnxType.TypeVariable("T", List.of(OnnxType.seq(OnnxType.map(OnnxType.string(), OnnxType.float32())), OnnxType.seq(OnnxType.map(OnnxType.int64(), OnnxType.float32()))))),
32438 ;
32439
32440 final OnnxType.TypeVariable typeVariable;
32441
32442 TypeConstraint(OnnxType.TypeVariable typeVariable) {
32443 assert typeVariable.name().equals(name());
32444 this.typeVariable = typeVariable;
32445 }
32446
32447 @Override
32448 public OnnxType.TypeVariable typeVariable() {
32449 return typeVariable;
32450 }
32451 }
32452
32453 public enum InputParameter implements OnnxParameter {
32454 X(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED),
32455 ;
32456
32457 final OnnxType type;
32458 final Quantifier quantifier;
32459
32460 InputParameter(OnnxType type, Quantifier quantifier) {
32461 this.type = type;
32462 this.quantifier = quantifier;
32463 }
32464
32465 @Override
32466 public OnnxType type() {
32467 return type;
32468 }
32469
32470 @Override
32471 public Quantifier quantifier() {
32472 return quantifier;
32473 }
32474 }
32475
32476 public enum OutputParameter implements OnnxParameter {
32477 Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED),
32478 ;
32479
32480 final OnnxType type;
32481 final Quantifier quantifier;
32482
32483 OutputParameter(OnnxType type, Quantifier quantifier) {
32484 this.type = type;
32485 this.quantifier = quantifier;
32486 }
32487
32488 @Override
32489 public OnnxType type() {
32490 return type;
32491 }
32492
32493 @Override
32494 public Quantifier quantifier() {
32495 return quantifier;
32496 }
32497 }
32498
32499 public static final OnnxSchema SCHEMA = new OnnxSchemaRecord(
32500 NAME,
32501 List.of(Attribute.values()),
32502 List.of(TypeConstraint.values()),
32503 List.of(InputParameter.values()),
32504 List.of(OutputParameter.values())
32505 );
32506
32507 public ZipMap(ExternalizedOp def) {
32508 super(SCHEMA, def);
32509 }
32510
32511 ZipMap(ZipMap that, CodeContext cc) {
32512 super(that, cc);
32513 }
32514
32515 @Override
32516 public ZipMap transform(CodeContext cc, CodeTransformer ot) {
32517 return new ZipMap(this, cc);
32518 }
32519
32520 ZipMap(CodeType resultType, Value X, java.util.Optional<long[]> classlabels_int64s, java.util.Optional<String[]> classlabels_strings) {
32521 super(SCHEMA, resultType, Set.of(), List.of(X), List.of(classlabels_int64s, classlabels_strings));
32522 }
32523
32524 @Override
32525 public SequencedSet<OnnxParameter> onnxOutputs() {
32526 return onnxOutputs(SCHEMA);
32527 }
32528
32529 @Override
32530 public SequencedMap<OnnxParameter, Object> onnxInputs() {
32531 return onnxInputs(SCHEMA, List.of(X()));
32532 }
32533
32534 public Value X() {
32535 return operands().get(0);
32536 }
32537
32538 public java.util.Optional<long[]> classlabels_int64s() {
32539 long[] classlabels_int64s = Attribute.classlabels_int64s.access(long[].class, onnxAttributes);
32540 return java.util.Optional.ofNullable(classlabels_int64s).map(long[]::clone);
32541 }
32542
32543 public java.util.Optional<String[]> classlabels_strings() {
32544 String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes);
32545 return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone);
32546 }
32547
32548 }
32549
32550 public static ZipMap ZipMap(CodeType resultType, Value X, java.util.Optional<long[]> classlabels_int64s, java.util.Optional<String[]> classlabels_strings) {
32551 return new ZipMap(resultType, X, classlabels_int64s, classlabels_strings);
32552 }
32553
32554 }