Skip to content

Commit f2f5f93

Browse files
authored
Add a non-normative table of operators by category (#868)
With contributions from Ningxin and Dwayne.
1 parent 64c51d1 commit f2f5f93

File tree

1 file changed

+182
-0
lines changed

1 file changed

+182
-0
lines changed

index.bs

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,188 @@ Depending on the underlying platform, the user agent <span class=allow-2119>may<
736736

737737
For a history and rationale of this design, please see the <a href="https://github.com/webmachinelearning/webnn/blob/master/device-selection-explainer.md">device selection explainer</a>.
738738

739+
## Operators ## {#programming-model-operators}
740+
741+
*This section is non-normative.*
742+
743+
The WebNN API defines a set of operators required by well-known CNN and RNN, transformer and generative models that address key [[#usecases-application]]. The details of each operator are defined in the normative sections of this specification, in alphabetical order by the operator name. These operators are grouped into categories based on their functionality in the following non-normative table to give a functional overview of the API surface.
744+
745+
Note: Some operators belong to multiple categories. For example, {{MLGraphBuilder/clamp()}} is both a math function and also used as an activation.
746+
747+
<table id='operators-table' class='data'>
748+
<caption>Operators by category</caption>
749+
<thead>
750+
<tr>
751+
<th>Category</th>
752+
<th>Operators​</th>
753+
</tr>
754+
</thead>
755+
<tbody>
756+
<tr>
757+
<td>Tensor creation</td>
758+
<td>
759+
{{MLGraphBuilder/input()}},
760+
{{MLGraphBuilder/constant(tensor)|constant()}}
761+
</td>
762+
</tr>
763+
<tr>
764+
<td>Tensor manipulation</td>
765+
<td>
766+
{{MLGraphBuilder/concat()}},
767+
{{MLGraphBuilder/expand()}},
768+
{{MLGraphBuilder/gather()}},
769+
{{MLGraphBuilder/gatherElements()}},
770+
{{MLGraphBuilder/scatterElements()}},
771+
{{MLGraphBuilder/gatherND()}},
772+
{{MLGraphBuilder/scatterND()}},
773+
{{MLGraphBuilder/where()}},
774+
{{MLGraphBuilder/pad()}},
775+
{{MLGraphBuilder/reshape()}},
776+
{{MLGraphBuilder/slice()}},
777+
{{MLGraphBuilder/split()}},
778+
{{MLGraphBuilder/transpose()}},
779+
{{MLGraphBuilder/resample2d()}},
780+
{{MLGraphBuilder/reverse()}},
781+
{{MLGraphBuilder/tile()}},
782+
{{MLGraphBuilder/triangular()}}
783+
</td>
784+
</tr>
785+
<tr>
786+
<td>Tensor quantization</td>
787+
<td>
788+
{{MLGraphBuilder/quantizeLinear()}},
789+
{{MLGraphBuilder/dequantizeLinear()}}
790+
</td>
791+
</tr>
792+
<tr>
793+
<td>Tensor casting</td>
794+
<td>
795+
{{MLGraphBuilder/cast()}}
796+
</td>
797+
</tr>
798+
<tr>
799+
<td>Mathematics</td>
800+
<td>
801+
{{MLGraphBuilder/add()}},
802+
{{MLGraphBuilder/sub()}},
803+
{{MLGraphBuilder/mul()}},
804+
{{MLGraphBuilder/div()}},
805+
{{MLGraphBuilder/max()}},
806+
{{MLGraphBuilder/min()}},
807+
{{MLGraphBuilder/clamp()}},
808+
{{MLGraphBuilder/pow()}},
809+
{{MLGraphBuilder/abs()}},
810+
{{MLGraphBuilder/ceil()}},
811+
{{MLGraphBuilder/cos()}},
812+
{{MLGraphBuilder/erf()}},
813+
{{MLGraphBuilder/exp()}},
814+
{{MLGraphBuilder/floor()}},
815+
{{MLGraphBuilder/identity()}},
816+
{{MLGraphBuilder/log()}},
817+
{{MLGraphBuilder/neg()}},
818+
{{MLGraphBuilder/reciprocal()}},
819+
{{MLGraphBuilder/sin()}},
820+
{{MLGraphBuilder/sqrt()}},
821+
{{MLGraphBuilder/tan()}},
822+
{{MLGraphBuilder/tanh()}},
823+
{{MLGraphBuilder/sign()}},
824+
{{MLGraphBuilder/clamp()}}
825+
</td>
826+
</tr>
827+
<tr>
828+
<td>Logical</td>
829+
<td>
830+
{{MLGraphBuilder/equal()}},
831+
{{MLGraphBuilder/notEqual()}},
832+
{{MLGraphBuilder/greater()}},
833+
{{MLGraphBuilder/greaterOrEqual()}},
834+
{{MLGraphBuilder/lesser()}},
835+
{{MLGraphBuilder/lesserOrEqual()}},
836+
{{MLGraphBuilder/logicalNot()}},
837+
{{MLGraphBuilder/logicalAnd()}},
838+
{{MLGraphBuilder/logicalOr()}},
839+
{{MLGraphBuilder/logicalXor()}}
840+
</td>
841+
</tr>
842+
<tr>
843+
<td>Matrix multiplication</td>
844+
<td>
845+
{{MLGraphBuilder/matmul()}},
846+
{{MLGraphBuilder/gemm()}}
847+
</td>
848+
</tr>
849+
<tr>
850+
<td>Convolution</td>
851+
<td>
852+
{{MLGraphBuilder/conv2d()}},
853+
{{MLGraphBuilder/convTranspose2d()}}
854+
</td>
855+
</tr>
856+
<tr>
857+
<td>Pooling</td>
858+
<td>
859+
{{MLGraphBuilder/averagePool2d()}},
860+
{{MLGraphBuilder/l2Pool2d()}},
861+
{{MLGraphBuilder/maxPool2d()}}
862+
</td>
863+
</tr>
864+
<tr>
865+
<td>Activation</td>
866+
<td>
867+
{{MLGraphBuilder/clamp()}},
868+
{{MLGraphBuilder/elu()}},
869+
{{MLGraphBuilder/gelu()}},
870+
{{MLGraphBuilder/hardSigmoid()}},
871+
{{MLGraphBuilder/hardSwish()}},
872+
{{MLGraphBuilder/leakyRelu()}},
873+
{{MLGraphBuilder/linear()}},
874+
{{MLGraphBuilder/prelu()}},
875+
{{MLGraphBuilder/relu()}},
876+
{{MLGraphBuilder/sigmoid()}},
877+
{{MLGraphBuilder/softmax()}},
878+
{{MLGraphBuilder/softplus()}},
879+
{{MLGraphBuilder/softsign()}},
880+
{{MLGraphBuilder/tanh()}}
881+
</td>
882+
</tr>
883+
<tr>
884+
<td>Normalization</td>
885+
<td>
886+
{{MLGraphBuilder/batchNormalization()}},
887+
{{MLGraphBuilder/instanceNormalization()}},
888+
{{MLGraphBuilder/layerNormalization()}}
889+
</td>
890+
</tr>
891+
<tr>
892+
<td>Reduction</td>
893+
<td>
894+
{{MLGraphBuilder/argMin()}},
895+
{{MLGraphBuilder/argMax()}},
896+
{{MLGraphBuilder/reduceL1()}},
897+
{{MLGraphBuilder/reduceL2()}},
898+
{{MLGraphBuilder/reduceLogSum()}},
899+
{{MLGraphBuilder/reduceLogSumExp()}},
900+
{{MLGraphBuilder/reduceMax()}},
901+
{{MLGraphBuilder/reduceMean()}},
902+
{{MLGraphBuilder/reduceMin()}},
903+
{{MLGraphBuilder/reduceProduct()}},
904+
{{MLGraphBuilder/reduceSum()}},
905+
{{MLGraphBuilder/reduceSumSquare()}},
906+
{{MLGraphBuilder/cumulativeSum()}}
907+
</td>
908+
</tr>
909+
<tr>
910+
<td>Recurrent Neural Networks</td>
911+
<td>
912+
{{MLGraphBuilder/gruCell()}},
913+
{{MLGraphBuilder/gru()}},
914+
{{MLGraphBuilder/lstmCell()}},
915+
{{MLGraphBuilder/lstm()}}
916+
</td>
917+
</tr>
918+
</tbody>
919+
</table>
920+
739921
## Task Source ## {#programming-model-task-source}
740922

741923
The <dfn>ML task source</dfn> is a [=task source=] to be used for all [=tasks=] related to asynchronous compilation and execution of {{MLGraph}}s and creation of {{MLContext}}s.

0 commit comments

Comments
 (0)