-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathwebnn.idl
947 lines (781 loc) · 26 KB
/
webnn.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Web Neural Network API (https://webmachinelearning.github.io/webnn/)
interface mixin NavigatorML {
[SecureContext, SameObject] readonly attribute ML ml;
};
Navigator includes NavigatorML;
WorkerNavigator includes NavigatorML;
enum MLPowerPreference {
"default",
"high-performance",
"low-power"
};
dictionary MLContextOptions {
MLPowerPreference powerPreference = "default";
};
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface ML {
Promise<MLContext> createContext(optional MLContextOptions options = {});
Promise<MLContext> createContext(GPUDevice gpuDevice);
};
typedef record<USVString, MLTensor> MLNamedTensors;
dictionary MLContextLostInfo {
DOMString message;
};
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLContext {
undefined dispatch(MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);
Promise<MLTensor> createTensor(MLTensorDescriptor descriptor);
Promise<ArrayBuffer> readTensor(MLTensor tensor);
Promise<undefined> readTensor(MLTensor tensor, AllowSharedBufferSource outputData);
undefined writeTensor(MLTensor tensor, AllowSharedBufferSource inputData);
MLOpSupportLimits opSupportLimits();
undefined destroy();
readonly attribute Promise<MLContextLostInfo> lost;
};
dictionary MLOpSupportLimits {
MLInputOperandLayout preferredInputLayout;
MLSupportLimits input;
MLSupportLimits constant;
MLSupportLimits output;
};
dictionary MLSupportLimits {
sequence<MLOperandDataType> dataTypes;
};
dictionary MLBinarySupportLimits {
MLSupportLimits a;
MLSupportLimits b;
MLSupportLimits output;
};
dictionary MLSingleInputSupportLimits {
MLSupportLimits input;
MLSupportLimits output;
};
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLGraph {
undefined destroy();
};
enum MLInputOperandLayout {
"nchw",
"nhwc"
};
enum MLOperandDataType {
"float32",
"float16",
"int32",
"uint32",
"int64",
"uint64",
"int8",
"uint8"
};
dictionary MLOperandDescriptor {
required MLOperandDataType dataType;
required sequence<[EnforceRange] unsigned long> shape;
};
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLOperand {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
};
dictionary MLOperatorOptions {
USVString label = "";
};
typedef (bigint or unrestricted double) MLNumber;
dictionary MLTensorDescriptor : MLOperandDescriptor {
boolean readable = false;
boolean writable = false;
};
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLTensor {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
readonly attribute boolean readable;
readonly attribute boolean writable;
undefined destroy();
};
typedef record<USVString, MLOperand> MLNamedOperands;
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLGraphBuilder {
// Construct the graph builder from the context.
constructor(MLContext context);
// Create an operand for a graph input.
MLOperand input(USVString name, MLOperandDescriptor descriptor);
// Create an operand for a graph constant.
MLOperand constant(MLOperandDescriptor descriptor,
AllowSharedBufferSource buffer);
// Create a scalar operand from the specified number of the specified type.
MLOperand constant(MLOperandDataType type, MLNumber value);
// Compile the graph up to the specified output operands asynchronously.
Promise<MLGraph> build(MLNamedOperands outputs);
};
dictionary MLArgMinMaxOptions : MLOperatorOptions {
boolean keepDimensions = false;
MLOperandDataType outputDataType = "int32";
};
partial interface MLGraphBuilder {
MLOperand argMin(MLOperand input, [EnforceRange] unsigned long axis,
optional MLArgMinMaxOptions options = {});
MLOperand argMax(MLOperand input, [EnforceRange] unsigned long axis,
optional MLArgMinMaxOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits argMin;
MLSingleInputSupportLimits argMax;
};
dictionary MLBatchNormalizationOptions : MLOperatorOptions {
MLOperand scale;
MLOperand bias;
[EnforceRange] unsigned long axis = 1;
double epsilon = 1e-5;
};
partial interface MLGraphBuilder {
MLOperand batchNormalization(MLOperand input, MLOperand mean, MLOperand variance,
optional MLBatchNormalizationOptions options = {});
};
dictionary MLBatchNormalizationSupportLimits {
MLSupportLimits input;
MLSupportLimits mean;
MLSupportLimits variance;
MLSupportLimits scale;
MLSupportLimits bias;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLBatchNormalizationSupportLimits batchNormalization;
};
partial interface MLGraphBuilder {
MLOperand cast(MLOperand input,
MLOperandDataType type,
optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits cast;
};
dictionary MLClampOptions : MLOperatorOptions {
MLNumber minValue;
MLNumber maxValue;
};
partial interface MLGraphBuilder {
MLOperand clamp(MLOperand input, optional MLClampOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits clamp;
};
partial interface MLGraphBuilder {
MLOperand concat(sequence<MLOperand> inputs,
[EnforceRange] unsigned long axis,
optional MLOperatorOptions options = {});
};
dictionary MLConcatSupportLimits {
MLSupportLimits inputs;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLConcatSupportLimits concat;
};
enum MLConv2dFilterOperandLayout {
"oihw",
"hwio",
"ohwi",
"ihwo"
};
dictionary MLConv2dOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> padding;
sequence<[EnforceRange] unsigned long> strides;
sequence<[EnforceRange] unsigned long> dilations;
[EnforceRange] unsigned long groups = 1;
MLInputOperandLayout inputLayout = "nchw";
MLConv2dFilterOperandLayout filterLayout = "oihw";
MLOperand bias;
};
partial interface MLGraphBuilder {
MLOperand conv2d(MLOperand input,
MLOperand filter,
optional MLConv2dOptions options = {});
};
dictionary MLConv2dSupportLimits {
MLSupportLimits input;
MLSupportLimits filter;
MLSupportLimits bias;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLConv2dSupportLimits conv2d;
};
enum MLConvTranspose2dFilterOperandLayout {
"iohw",
"hwoi",
"ohwi"
};
dictionary MLConvTranspose2dOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> padding;
sequence<[EnforceRange] unsigned long> strides;
sequence<[EnforceRange] unsigned long> dilations;
sequence<[EnforceRange] unsigned long> outputPadding;
sequence<[EnforceRange] unsigned long> outputSizes;
[EnforceRange] unsigned long groups = 1;
MLInputOperandLayout inputLayout = "nchw";
MLConvTranspose2dFilterOperandLayout filterLayout = "iohw";
MLOperand bias;
};
partial interface MLGraphBuilder {
MLOperand convTranspose2d(MLOperand input, MLOperand filter,
optional MLConvTranspose2dOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLConv2dSupportLimits convTranspose2d;
};
partial interface MLGraphBuilder {
MLOperand add(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
MLOperand sub(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
MLOperand mul(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
MLOperand div(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
MLOperand max(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
MLOperand min(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
MLOperand pow(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLBinarySupportLimits add;
MLBinarySupportLimits sub;
MLBinarySupportLimits mul;
MLBinarySupportLimits div;
MLBinarySupportLimits max;
MLBinarySupportLimits min;
MLBinarySupportLimits pow;
};
partial interface MLGraphBuilder {
MLOperand equal(MLOperand a,
MLOperand b,
optional MLOperatorOptions options = {});
MLOperand greater(MLOperand a,
MLOperand b,
optional MLOperatorOptions options = {});
MLOperand greaterOrEqual(MLOperand a,
MLOperand b,
optional MLOperatorOptions options = {});
MLOperand lesser(MLOperand a,
MLOperand b,
optional MLOperatorOptions options = {});
MLOperand lesserOrEqual(MLOperand a,
MLOperand b,
optional MLOperatorOptions options = {});
MLOperand logicalNot(MLOperand a, optional MLOperatorOptions options = {});
};
dictionary MLLogicalNotSupportLimits {
MLSupportLimits a;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLBinarySupportLimits equal;
MLBinarySupportLimits greater;
MLBinarySupportLimits greaterOrEqual;
MLBinarySupportLimits lesser;
MLBinarySupportLimits lesserOrEqual;
MLLogicalNotSupportLimits logicalNot;
};
partial interface MLGraphBuilder {
MLOperand abs(MLOperand input, optional MLOperatorOptions options = {});
MLOperand ceil(MLOperand input, optional MLOperatorOptions options = {});
MLOperand cos(MLOperand input, optional MLOperatorOptions options = {});
MLOperand erf(MLOperand input, optional MLOperatorOptions options = {});
MLOperand exp(MLOperand input, optional MLOperatorOptions options = {});
MLOperand floor(MLOperand input, optional MLOperatorOptions options = {});
MLOperand identity(MLOperand input, optional MLOperatorOptions options = {});
MLOperand log(MLOperand input, optional MLOperatorOptions options = {});
MLOperand neg(MLOperand input, optional MLOperatorOptions options = {});
MLOperand reciprocal(MLOperand input, optional MLOperatorOptions options = {});
MLOperand sin(MLOperand input, optional MLOperatorOptions options = {});
MLOperand sqrt(MLOperand input, optional MLOperatorOptions options = {});
MLOperand tan(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits abs;
MLSingleInputSupportLimits ceil;
MLSingleInputSupportLimits cos;
MLSingleInputSupportLimits erf;
MLSingleInputSupportLimits exp;
MLSingleInputSupportLimits floor;
MLSingleInputSupportLimits identity;
MLSingleInputSupportLimits log;
MLSingleInputSupportLimits neg;
MLSingleInputSupportLimits reciprocal;
MLSingleInputSupportLimits sin;
MLSingleInputSupportLimits sqrt;
MLSingleInputSupportLimits tan;
};
dictionary MLEluOptions : MLOperatorOptions {
double alpha = 1;
};
partial interface MLGraphBuilder {
MLOperand elu(MLOperand input, optional MLEluOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits elu;
};
partial interface MLGraphBuilder {
MLOperand expand(MLOperand input,
sequence<[EnforceRange] unsigned long> newShape,
optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits expand;
};
dictionary MLGatherOptions : MLOperatorOptions {
[EnforceRange] unsigned long axis = 0;
};
partial interface MLGraphBuilder {
MLOperand gather(MLOperand input,
MLOperand indices,
optional MLGatherOptions options = {});
};
dictionary MLGatherSupportLimits {
MLSupportLimits input;
MLSupportLimits indices;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLGatherSupportLimits gather;
};
partial interface MLGraphBuilder {
MLOperand gelu(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits gelu;
};
dictionary MLGemmOptions : MLOperatorOptions {
MLOperand c;
double alpha = 1.0;
double beta = 1.0;
boolean aTranspose = false;
boolean bTranspose = false;
};
partial interface MLGraphBuilder {
MLOperand gemm(MLOperand a, MLOperand b, optional MLGemmOptions options = {});
};
dictionary MLGemmSupportLimits {
MLSupportLimits a;
MLSupportLimits b;
MLSupportLimits c;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLGemmSupportLimits gemm;
};
enum MLGruWeightLayout {
"zrn", // update-reset-new gate ordering
"rzn" // reset-update-new gate ordering
};
enum MLRecurrentNetworkActivation {
"relu",
"sigmoid",
"tanh"
};
enum MLRecurrentNetworkDirection {
"forward",
"backward",
"both"
};
dictionary MLGruOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
MLOperand initialHiddenState;
boolean resetAfter = true;
boolean returnSequence = false;
MLRecurrentNetworkDirection direction = "forward";
MLGruWeightLayout layout = "zrn";
sequence<MLRecurrentNetworkActivation> activations;
};
partial interface MLGraphBuilder {
sequence<MLOperand> gru(MLOperand input,
MLOperand weight,
MLOperand recurrentWeight,
[EnforceRange] unsigned long steps,
[EnforceRange] unsigned long hiddenSize,
optional MLGruOptions options = {});
};
dictionary MLGruSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits initialHiddenState;
MLSupportLimits outputs;
};
partial dictionary MLOpSupportLimits {
MLGruSupportLimits gru;
};
dictionary MLGruCellOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
boolean resetAfter = true;
MLGruWeightLayout layout = "zrn";
sequence<MLRecurrentNetworkActivation> activations;
};
partial interface MLGraphBuilder {
MLOperand gruCell(MLOperand input,
MLOperand weight,
MLOperand recurrentWeight,
MLOperand hiddenState,
[EnforceRange] unsigned long hiddenSize,
optional MLGruCellOptions options = {});
};
dictionary MLGruCellSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits hiddenState;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLGruCellSupportLimits gruCell;
};
dictionary MLHardSigmoidOptions : MLOperatorOptions {
double alpha = 0.2;
double beta = 0.5;
};
partial interface MLGraphBuilder {
MLOperand hardSigmoid(MLOperand input, optional MLHardSigmoidOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits hardSigmoid;
};
partial interface MLGraphBuilder {
MLOperand hardSwish(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits hardSwish;
};
dictionary MLInstanceNormalizationOptions : MLOperatorOptions {
MLOperand scale;
MLOperand bias;
double epsilon = 1e-5;
MLInputOperandLayout layout = "nchw";
};
partial interface MLGraphBuilder {
MLOperand instanceNormalization(MLOperand input,
optional MLInstanceNormalizationOptions options = {});
};
dictionary MLNormalizationSupportLimits {
MLSupportLimits input;
MLSupportLimits scale;
MLSupportLimits bias;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLNormalizationSupportLimits instanceNormalization;
};
dictionary MLLayerNormalizationOptions : MLOperatorOptions {
MLOperand scale;
MLOperand bias;
sequence<[EnforceRange] unsigned long> axes;
double epsilon = 1e-5;
};
partial interface MLGraphBuilder {
MLOperand layerNormalization(MLOperand input,
optional MLLayerNormalizationOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLNormalizationSupportLimits layerNormalization;
};
dictionary MLLeakyReluOptions : MLOperatorOptions {
double alpha = 0.01;
};
partial interface MLGraphBuilder {
MLOperand leakyRelu(MLOperand input, optional MLLeakyReluOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits leakyRelu;
};
dictionary MLLinearOptions : MLOperatorOptions {
double alpha = 1;
double beta = 0;
};
partial interface MLGraphBuilder {
MLOperand linear(MLOperand input, optional MLLinearOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits linear;
};
enum MLLstmWeightLayout {
"iofg", // input-output-forget-cell gate ordering
"ifgo" // input-forget-cell-output gate ordering
};
dictionary MLLstmOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
MLOperand peepholeWeight;
MLOperand initialHiddenState;
MLOperand initialCellState;
boolean returnSequence = false;
MLRecurrentNetworkDirection direction = "forward";
MLLstmWeightLayout layout = "iofg";
sequence<MLRecurrentNetworkActivation> activations;
};
partial interface MLGraphBuilder {
sequence<MLOperand> lstm(MLOperand input,
MLOperand weight,
MLOperand recurrentWeight,
[EnforceRange] unsigned long steps,
[EnforceRange] unsigned long hiddenSize,
optional MLLstmOptions options = {});
};
dictionary MLLstmSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits peepholeWeight;
MLSupportLimits initialHiddenState;
MLSupportLimits initialCellState;
MLSupportLimits outputs;
};
partial dictionary MLOpSupportLimits {
MLLstmSupportLimits lstm;
};
dictionary MLLstmCellOptions : MLOperatorOptions {
MLOperand bias;
MLOperand recurrentBias;
MLOperand peepholeWeight;
MLLstmWeightLayout layout = "iofg";
sequence<MLRecurrentNetworkActivation> activations;
};
partial interface MLGraphBuilder {
sequence<MLOperand> lstmCell(MLOperand input,
MLOperand weight,
MLOperand recurrentWeight,
MLOperand hiddenState,
MLOperand cellState,
[EnforceRange] unsigned long hiddenSize,
optional MLLstmCellOptions options = {});
};
dictionary MLLstmCellSupportLimits {
MLSupportLimits input;
MLSupportLimits weight;
MLSupportLimits recurrentWeight;
MLSupportLimits hiddenState;
MLSupportLimits cellState;
MLSupportLimits bias;
MLSupportLimits recurrentBias;
MLSupportLimits peepholeWeight;
MLSupportLimits outputs;
};
partial dictionary MLOpSupportLimits {
MLLstmCellSupportLimits lstmCell;
};
partial interface MLGraphBuilder {
MLOperand matmul(MLOperand a, MLOperand b, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLBinarySupportLimits matmul;
};
enum MLPaddingMode {
"constant",
"edge",
"reflection",
"symmetric"
};
dictionary MLPadOptions : MLOperatorOptions {
MLPaddingMode mode = "constant";
MLNumber value = 0;
};
partial interface MLGraphBuilder {
MLOperand pad(MLOperand input,
sequence<[EnforceRange] unsigned long> beginningPadding,
sequence<[EnforceRange] unsigned long> endingPadding,
optional MLPadOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits pad;
};
enum MLRoundingType {
"floor",
"ceil"
};
dictionary MLPool2dOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> windowDimensions;
sequence<[EnforceRange] unsigned long> padding;
sequence<[EnforceRange] unsigned long> strides;
sequence<[EnforceRange] unsigned long> dilations;
MLInputOperandLayout layout = "nchw";
MLRoundingType roundingType = "floor";
sequence<[EnforceRange] unsigned long> outputSizes;
};
partial interface MLGraphBuilder {
MLOperand averagePool2d(MLOperand input, optional MLPool2dOptions options = {});
MLOperand l2Pool2d(MLOperand input, optional MLPool2dOptions options = {});
MLOperand maxPool2d(MLOperand input, optional MLPool2dOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits averagePool2d;
MLSingleInputSupportLimits l2Pool2d;
MLSingleInputSupportLimits maxPool2d;
};
partial interface MLGraphBuilder {
MLOperand prelu(MLOperand input,
MLOperand slope,
optional MLOperatorOptions options = {});
};
dictionary MLPreluSupportLimits {
MLSupportLimits input;
MLSupportLimits slope;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLPreluSupportLimits prelu;
};
dictionary MLReduceOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> axes;
boolean keepDimensions = false;
};
partial interface MLGraphBuilder {
MLOperand reduceL1(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceL2(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceLogSum(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceLogSumExp(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceMax(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceMean(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceMin(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceProduct(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceSum(MLOperand input, optional MLReduceOptions options = {});
MLOperand reduceSumSquare(MLOperand input, optional MLReduceOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits reduceL1;
MLSingleInputSupportLimits reduceL2;
MLSingleInputSupportLimits reduceLogSum;
MLSingleInputSupportLimits reduceLogSumExp;
MLSingleInputSupportLimits reduceMax;
MLSingleInputSupportLimits reduceMean;
MLSingleInputSupportLimits reduceMin;
MLSingleInputSupportLimits reduceProduct;
MLSingleInputSupportLimits reduceSum;
MLSingleInputSupportLimits reduceSumSquare;
};
partial interface MLGraphBuilder {
MLOperand relu(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits relu;
};
enum MLInterpolationMode {
"nearest-neighbor",
"linear"
};
dictionary MLResample2dOptions : MLOperatorOptions {
MLInterpolationMode mode = "nearest-neighbor";
sequence<float> scales;
sequence<[EnforceRange] unsigned long> sizes;
sequence<[EnforceRange] unsigned long> axes;
};
partial interface MLGraphBuilder {
MLOperand resample2d(MLOperand input, optional MLResample2dOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits resample2d;
};
partial interface MLGraphBuilder {
MLOperand reshape(MLOperand input,
sequence<[EnforceRange] unsigned long> newShape,
optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits reshape;
};
partial interface MLGraphBuilder {
MLOperand sigmoid(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits sigmoid;
};
partial interface MLGraphBuilder {
MLOperand slice(MLOperand input,
sequence<[EnforceRange] unsigned long> starts,
sequence<[EnforceRange] unsigned long> sizes,
optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits slice;
};
partial interface MLGraphBuilder {
MLOperand softmax(MLOperand input,
[EnforceRange] unsigned long axis,
optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits softmax;
};
partial interface MLGraphBuilder {
MLOperand softplus(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits softplus;
};
partial interface MLGraphBuilder {
MLOperand softsign(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits softsign;
};
dictionary MLSplitOptions : MLOperatorOptions {
[EnforceRange] unsigned long axis = 0;
};
partial interface MLGraphBuilder {
sequence<MLOperand> split(
MLOperand input,
([EnforceRange] unsigned long or sequence<[EnforceRange] unsigned long>) splits,
optional MLSplitOptions options = {});
};
dictionary MLSplitSupportLimits {
MLSupportLimits input;
MLSupportLimits outputs;
};
partial dictionary MLOpSupportLimits {
MLSplitSupportLimits split;
};
partial interface MLGraphBuilder {
MLOperand tanh(MLOperand input, optional MLOperatorOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits tanh;
};
dictionary MLTransposeOptions : MLOperatorOptions {
sequence<[EnforceRange] unsigned long> permutation;
};
partial interface MLGraphBuilder {
MLOperand transpose(MLOperand input, optional MLTransposeOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits transpose;
};
dictionary MLTriangularOptions : MLOperatorOptions {
boolean upper = true;
[EnforceRange] long diagonal = 0;
};
partial interface MLGraphBuilder {
MLOperand triangular(MLOperand input, optional MLTriangularOptions options = {});
};
partial dictionary MLOpSupportLimits {
MLSingleInputSupportLimits triangular;
};
partial interface MLGraphBuilder {
MLOperand where(MLOperand condition,
MLOperand trueValue,
MLOperand falseValue,
optional MLOperatorOptions options = {});
};
dictionary MLWhereSupportLimits {
MLSupportLimits condition;
MLSupportLimits trueValue;
MLSupportLimits falseValue;
MLSupportLimits output;
};
partial dictionary MLOpSupportLimits {
MLWhereSupportLimits where;
};