WebNN

Web Neural Network API

Module: w3c.WebNN Support: Experimental Docs: w3c Docs

Type Aliases

  • MLNamedTensors
  • MLNamedOperands
  • MLDataTypeList
  • MLNumber

Enum MLPowerPreference

Power preference hint for context creation.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
default
high-performance
low-power

Enum MLInputOperandLayout

Layout format for input operands in layout-dependent operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
nchw
nhwc

Enum MLOperandDataType

ValueDescription
float32
float16
int32
uint32
int64
uint64
int8
uint8

Enum MLConv2dFilterOperandLayout

Filter layout for conv2d operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
oihw
hwio
ohwi
ihwo

Enum MLConvTranspose2dFilterOperandLayout

Filter layout for convTranspose2d operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
iohw
hwoi
ohwi

Enum MLGruWeightLayout

Weight layout for GRU operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
zrn
rzn

Enum MLRecurrentNetworkActivation

Activation function for recurrent network operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
relu
sigmoid
tanh

Enum MLRecurrentNetworkDirection

Direction for recurrent network operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
forward
backward
both

Enum MLLstmWeightLayout

Weight layout for LSTM operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
iofg
ifgo

Enum MLPaddingMode

Padding mode for pad operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
constant
edge
reflection

Enum MLRoundingType

Rounding type for pooling output shape computation.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
floor
ceil

Enum MLInterpolationMode

Interpolation mode for resample2d operations.

Since: 1.1.0 Docs: w3c Docs
ValueDescription
nearest-neighbor
linear

Dictionary MLContextOptions

Options for creating an MLContext.

Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Properties

⚪ powerPreference
Options for creating an MLContext.
⚪ accelerated
Options for creating an MLContext.

---

Dictionary MLContextLostInfo

Information about a context lost event.

Since: 1.1.0 Docs: w3c Docs

1 members: 1 undocumented

Properties

⚪ message
Information about a context lost event.

---

Dictionary MLTensorDescriptor

Describes tensor properties including readability and writability.

Extends: w3c.MLOperandDescriptor Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Properties

⚪ readable
Describes tensor properties including readability and writability.
⚪ writable
Describes tensor properties including readability and writability.

---

Dictionary MLOperatorOptions

Base options dictionary for all operators, providing a label for debugging.

Since: 1.1.0 Docs: w3c Docs

1 members: 1 undocumented

Properties

⚪ label
Base options dictionary for all operators, providing a label for debugging.

---

Dictionary MLRankRange

Minimum and maximum supported rank range.

Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Properties

⚪ min
Minimum and maximum supported rank range.
⚪ max
Minimum and maximum supported rank range.

---

Dictionary MLTensorLimits

Support limits for tensor operands (data types and rank range).

Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Properties

⚪ dataTypes
Support limits for tensor operands (data types and rank range).
⚪ rankRange
Support limits for tensor operands (data types and rank range).

---

Dictionary MLBinarySupportLimits

Support limits for binary operations.

Since: 1.1.0 Docs: w3c Docs

3 members: 3 undocumented

Properties

⚪ a
Support limits for binary operations.
⚪ b
Support limits for binary operations.
⚪ output
→ MLTensorLimits

---

Dictionary MLSingleInputSupportLimits

Support limits for single-input operations.

Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ output
→ MLTensorLimits

---

Dictionary MLLogicalNotSupportLimits

Support limits for logicalNot and isNaN/isInfinite operations.

Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Properties

⚪ a
Support limits for binary operations.
⚪ output
→ MLTensorLimits

---

Dictionary MLOpSupportLimits

Comprehensive support limits for all operations on an MLContext.

Since: 1.1.0 Docs: w3c Docs

100 members: 100 undocumented

Properties

⚪ preferredInputLayout
Comprehensive support limits for all operations on an MLContext.
⚪ maxTensorByteLength
→ u64
⚪ input
Support limits for single-input operations.
⚪ constant
Padding mode for pad operations.
⚪ output
→ MLTensorLimits
⚪ argMin
→ MLSingleInputSupportLimits
⚪ argMax
→ MLSingleInputSupportLimits
⚪ batchNormalization
→ MLBatchNormalizationSupportLimits
⚪ cast
→ MLSingleInputSupportLimits
⚪ clamp
→ MLSingleInputSupportLimits
⚪ concat
→ MLConcatSupportLimits
⚪ conv2d
→ MLConv2dSupportLimits
⚪ convTranspose2d
→ MLConv2dSupportLimits
⚪ cumulativeSum
→ MLSingleInputSupportLimits
⚪ add
→ MLBinarySupportLimits
⚪ sub
→ MLBinarySupportLimits
⚪ mul
→ MLBinarySupportLimits
⚪ div
→ MLBinarySupportLimits
⚪ max
Minimum and maximum supported rank range.
⚪ min
Minimum and maximum supported rank range.
⚪ pow
→ MLBinarySupportLimits
⚪ equal
→ MLBinarySupportLimits
⚪ notEqual
→ MLBinarySupportLimits
⚪ greater
→ MLBinarySupportLimits
⚪ greaterOrEqual
→ MLBinarySupportLimits
⚪ lesser
→ MLBinarySupportLimits
⚪ lesserOrEqual
→ MLBinarySupportLimits
⚪ logicalNot
→ MLLogicalNotSupportLimits
⚪ logicalAnd
→ MLBinarySupportLimits
⚪ logicalOr
→ MLBinarySupportLimits
⚪ logicalXor
→ MLBinarySupportLimits
⚪ isNaN
→ MLLogicalNotSupportLimits
⚪ isInfinite
→ MLLogicalNotSupportLimits
⚪ abs
→ MLSingleInputSupportLimits
⚪ ceil
Rounding type for pooling output shape computation.
⚪ cos
→ MLSingleInputSupportLimits
⚪ erf
→ MLSingleInputSupportLimits
⚪ exp
→ MLSingleInputSupportLimits
⚪ floor
Rounding type for pooling output shape computation.
⚪ identity
→ MLSingleInputSupportLimits
⚪ log
→ MLSingleInputSupportLimits
⚪ neg
→ MLSingleInputSupportLimits
⚪ reciprocal
→ MLSingleInputSupportLimits
⚪ roundEven
→ MLSingleInputSupportLimits
⚪ sin
→ MLSingleInputSupportLimits
⚪ sign
→ MLSingleInputSupportLimits
⚪ sqrt
→ MLSingleInputSupportLimits
⚪ tan
→ MLSingleInputSupportLimits
⚪ dequantizeLinear
→ MLQuantizeDequantizeLinearSupportLimits
⚪ quantizeLinear
Quantize an input using scale and zero point.
⚪ elu
→ MLSingleInputSupportLimits
⚪ expand
→ MLSingleInputSupportLimits
⚪ gather
→ MLGatherSupportLimits
⚪ gatherElements
→ MLGatherSupportLimits
⚪ gatherND
→ MLGatherSupportLimits
⚪ gelu
→ MLSingleInputSupportLimits
⚪ gemm
→ MLGemmSupportLimits
⚪ gru
→ MLGruSupportLimits
⚪ gruCell
→ MLGruCellSupportLimits
⚪ hardSigmoid
→ MLSingleInputSupportLimits
⚪ hardSwish
→ MLSingleInputSupportLimits
⚪ instanceNormalization
→ MLNormalizationSupportLimits
⚪ layerNormalization
→ MLNormalizationSupportLimits
⚪ leakyRelu
→ MLSingleInputSupportLimits
⚪ linear
Interpolation mode for resample2d operations.
⚪ lstm
→ MLLstmSupportLimits
⚪ lstmCell
→ MLLstmCellSupportLimits
⚪ matmul
→ MLBinarySupportLimits
⚪ pad
→ MLSingleInputSupportLimits
⚪ averagePool2d
→ MLSingleInputSupportLimits
⚪ l2Pool2d
→ MLSingleInputSupportLimits
⚪ maxPool2d
→ MLSingleInputSupportLimits
⚪ prelu
→ MLPreluSupportLimits
⚪ reduceL1
→ MLSingleInputSupportLimits
⚪ reduceL2
→ MLSingleInputSupportLimits
⚪ reduceLogSum
→ MLSingleInputSupportLimits
⚪ reduceLogSumExp
→ MLSingleInputSupportLimits
⚪ reduceMax
→ MLSingleInputSupportLimits
⚪ reduceMean
→ MLSingleInputSupportLimits
⚪ reduceMin
→ MLSingleInputSupportLimits
⚪ reduceProduct
→ MLSingleInputSupportLimits
⚪ reduceSum
→ MLSingleInputSupportLimits
⚪ reduceSumSquare
→ MLSingleInputSupportLimits
⚪ relu
Activation function for recurrent network operations.
⚪ resample2d
→ MLSingleInputSupportLimits
⚪ reshape
→ MLSingleInputSupportLimits
⚪ reverse
→ MLSingleInputSupportLimits
⚪ scatterElements
→ MLScatterSupportLimits
⚪ scatterND
→ MLScatterSupportLimits
⚪ sigmoid
Activation function for recurrent network operations.
⚪ slice
→ MLSingleInputSupportLimits
⚪ softmax
→ MLSingleInputSupportLimits
⚪ softplus
→ MLSingleInputSupportLimits
⚪ softsign
→ MLSingleInputSupportLimits
⚪ split
→ MLSplitSupportLimits
⚪ tanh
→ MLSingleInputSupportLimits
⚪ tile
→ MLSingleInputSupportLimits
⚪ transpose
→ MLSingleInputSupportLimits
⚪ triangular
→ MLSingleInputSupportLimits
⚪ where
→ MLWhereSupportLimits

---

Dictionary MLBatchNormalizationSupportLimits

6 members: 6 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ mean
→ MLTensorLimits
⚪ variance
→ MLTensorLimits
⚪ scale
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLConcatSupportLimits

2 members: 2 undocumented

Properties

⚪ inputs
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLConv2dSupportLimits

4 members: 4 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ filter
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLQuantizeDequantizeLinearSupportLimits

4 members: 4 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ scale
→ MLTensorLimits
⚪ zeroPoint
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLGatherSupportLimits

3 members: 3 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ indices
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLGemmSupportLimits

4 members: 4 undocumented

Properties

⚪ a
Support limits for binary operations.
⚪ b
Support limits for binary operations.
⚪ c
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLGruSupportLimits

8 members: 8 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ weight
→ MLTensorLimits
⚪ recurrentWeight
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ recurrentBias
→ MLTensorLimits
⚪ initialHiddenState
→ MLTensorLimits
⚪ output0
→ MLTensorLimits
⚪ output1
→ MLTensorLimits

---

Dictionary MLGruCellSupportLimits

7 members: 7 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ weight
→ MLTensorLimits
⚪ recurrentWeight
→ MLTensorLimits
⚪ hiddenState
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ recurrentBias
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLNormalizationSupportLimits

4 members: 4 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ scale
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLLstmSupportLimits

11 members: 11 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ weight
→ MLTensorLimits
⚪ recurrentWeight
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ recurrentBias
→ MLTensorLimits
⚪ peepholeWeight
→ MLTensorLimits
⚪ initialHiddenState
→ MLTensorLimits
⚪ initialCellState
→ MLTensorLimits
⚪ output0
→ MLTensorLimits
⚪ output1
→ MLTensorLimits
⚪ output2
→ MLTensorLimits

---

Dictionary MLLstmCellSupportLimits

10 members: 10 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ weight
→ MLTensorLimits
⚪ recurrentWeight
→ MLTensorLimits
⚪ hiddenState
→ MLTensorLimits
⚪ cellState
→ MLTensorLimits
⚪ bias
→ MLTensorLimits
⚪ recurrentBias
→ MLTensorLimits
⚪ peepholeWeight
→ MLTensorLimits
⚪ output0
→ MLTensorLimits
⚪ output1
→ MLTensorLimits

---

Dictionary MLPreluSupportLimits

3 members: 3 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ slope
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLScatterSupportLimits

4 members: 4 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ indices
→ MLTensorLimits
⚪ updates
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLSplitSupportLimits

2 members: 2 undocumented

Properties

⚪ input
Support limits for single-input operations.
⚪ outputs
→ MLTensorLimits

---

Dictionary MLWhereSupportLimits

4 members: 4 undocumented

Properties

⚪ condition
→ MLTensorLimits
⚪ trueValue
→ MLTensorLimits
⚪ falseValue
→ MLTensorLimits
⚪ output
→ MLTensorLimits

---

Dictionary MLArgMinMaxOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ keepDimensions
→ boolean
⚪ outputDataType
→ MLOperandDataType

---

Dictionary MLBatchNormalizationOptions

Extends: MLOperatorOptions

4 members: 4 undocumented

Properties

⚪ scale
→ MLOperand
⚪ bias
→ MLOperand
⚪ axis
→ u32
⚪ epsilon
→ f64

---

Dictionary MLClampOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ minValue
→ MLNumber
⚪ maxValue
→ MLNumber

---

Dictionary MLCumulativeSumOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ exclusive
→ boolean
⚪ reversed
→ boolean

---

Dictionary MLEluOptions

Extends: MLOperatorOptions

1 members: 1 undocumented

Properties

⚪ alpha
→ f64

---

Dictionary MLGatherOptions

Extends: MLOperatorOptions

1 members: 1 undocumented

Properties

⚪ axis
→ u32

---

Dictionary MLGemmOptions

Extends: MLOperatorOptions

5 members: 5 undocumented

Properties

⚪ c
→ MLOperand
⚪ alpha
→ f64
⚪ beta
→ f64
⚪ aTranspose
→ boolean
⚪ bTranspose
→ boolean

---

Dictionary MLGruOptions

Extends: MLOperatorOptions

8 members: 8 undocumented

Properties

⚪ bias
→ MLOperand
⚪ recurrentBias
→ MLOperand
⚪ initialHiddenState
→ MLOperand
⚪ resetAfter
→ boolean
⚪ returnSequence
→ boolean
⚪ direction
→ MLRecurrentNetworkDirection
⚪ layout
→ MLGruWeightLayout
⚪ activations
→ sequence

---

Dictionary MLGruCellOptions

Extends: MLOperatorOptions

5 members: 5 undocumented

Properties

⚪ bias
→ MLOperand
⚪ recurrentBias
→ MLOperand
⚪ resetAfter
→ boolean
⚪ layout
→ MLGruWeightLayout
⚪ activations
→ sequence

---

Dictionary MLHardSigmoidOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ alpha
→ f64
⚪ beta
→ f64

---

Dictionary MLInstanceNormalizationOptions

Extends: MLOperatorOptions

4 members: 4 undocumented

Properties

⚪ scale
→ MLOperand
⚪ bias
→ MLOperand
⚪ epsilon
→ f64
⚪ layout
→ MLInputOperandLayout

---

Dictionary MLLeakyReluOptions

Extends: MLOperatorOptions

1 members: 1 undocumented

Properties

⚪ alpha
→ f64

---

Dictionary MLLinearOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ alpha
→ f64
⚪ beta
→ f64

---

Dictionary MLLstmOptions

Extends: MLOperatorOptions

9 members: 9 undocumented

Properties

⚪ bias
→ MLOperand
⚪ recurrentBias
→ MLOperand
⚪ peepholeWeight
→ MLOperand
⚪ initialHiddenState
→ MLOperand
⚪ initialCellState
→ MLOperand
⚪ returnSequence
→ boolean
⚪ direction
→ MLRecurrentNetworkDirection
⚪ layout
→ MLLstmWeightLayout
⚪ activations
→ sequence

---

Dictionary MLLstmCellOptions

Extends: MLOperatorOptions

5 members: 5 undocumented

Properties

⚪ bias
→ MLOperand
⚪ recurrentBias
→ MLOperand
⚪ peepholeWeight
→ MLOperand
⚪ layout
→ MLLstmWeightLayout
⚪ activations
→ sequence

---

Dictionary MLPadOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ mode
→ MLPaddingMode
⚪ value
→ MLNumber

---

Dictionary MLScatterOptions

Extends: MLOperatorOptions

1 members: 1 undocumented

Properties

⚪ axis
→ u32

---

Dictionary MLSplitOptions

Extends: MLOperatorOptions

1 members: 1 undocumented

Properties

⚪ axis
→ u32

---

Dictionary MLTriangularOptions

Extends: MLOperatorOptions

2 members: 2 undocumented

Properties

⚪ upper
→ boolean
⚪ diagonal
→ i32

---

Mixin NavigatorML

Exposes the ML interface on Navigator and WorkerNavigator.

Since: 1.1.0 Docs: w3c Docs

Properties

🟢 ml
Exposes the ML interface on Navigator and WorkerNavigator.

---

Interface ML

Exposes the ML interface on Navigator and WorkerNavigator.

Since: 1.1.0 Docs: w3c Docs

2 members: 2 undocumented

Methods

⚪ createContext(options)
Create a context with the given options or from a GPUDevice.
⚪ createContext(gpuDevice)
Create a context with the given options or from a GPUDevice.

---

Interface MLContext

Create a context with the given options or from a GPUDevice.

10 members: 10 undocumented

Methods

⚪ dispatch(graph, inputs, outputs)
Dispatch a compiled graph with the given input and output tensors.
⚪ createTensor(descriptor)
Create a tensor with the given descriptor.
⚪ createConstantTensor(descriptor, inputData)
Create a constant tensor from the given data.
⚪ readTensor(tensor)
Read tensor data into a new ArrayBuffer.
⚪ readTensor(tensor, outputData)
Read tensor data into a new ArrayBuffer.
⚪ writeTensor(tensor, inputData)
Write data to a tensor.
⚪ opSupportLimits()
Query the support limits for operations on this context.
⚪ destroy()
Release all resources associated with this context.

Properties

⚪ accelerated
Options for creating an MLContext.
⚪ lost
Whether this context uses an accelerated backend.

---

Interface MLGraph

Dispatch a compiled graph with the given input and output tensors.

1 members: 1 undocumented

Methods

⚪ destroy()
Release all resources associated with this context.

---

Interface MLOperand

2 members: 2 undocumented

Properties

⚪ dataType
Describes the data type and shape of an operand.
⚪ shape
Describes the data type and shape of an operand.

---

Interface MLTensor

6 members: 6 undocumented

Methods

⚪ destroy()
Release all resources associated with this context.

Properties

⚪ dataType
Describes the data type and shape of an operand.
⚪ shape
Describes the data type and shape of an operand.
⚪ readable
Describes tensor properties including readability and writability.
⚪ writable
Describes tensor properties including readability and writability.
⚪ constant
Padding mode for pad operations.

---