summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/interfaces/webnn.idl
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/interfaces/webnn.idl')
-rw-r--r--testing/web-platform/tests/interfaces/webnn.idl134
1 files changed, 36 insertions, 98 deletions
diff --git a/testing/web-platform/tests/interfaces/webnn.idl b/testing/web-platform/tests/interfaces/webnn.idl
index 721ee788bd..50ee64b185 100644
--- a/testing/web-platform/tests/interfaces/webnn.idl
+++ b/testing/web-platform/tests/interfaces/webnn.idl
@@ -29,74 +29,60 @@ dictionary MLContextOptions {
interface ML {
Promise<MLContext> createContext(optional MLContextOptions options = {});
Promise<MLContext> createContext(GPUDevice gpuDevice);
-
- [Exposed=(DedicatedWorker)]
- MLContext createContextSync(optional MLContextOptions options = {});
- [Exposed=(DedicatedWorker)]
- MLContext createContextSync(GPUDevice gpuDevice);
-};
-
-[SecureContext, Exposed=(Window, DedicatedWorker)]
-interface MLActivation {
};
-typedef (GPUBuffer or GPUTexture) MLGPUResource;
-
-typedef record<DOMString, MLGPUResource> MLNamedGPUResources;
-
-[SecureContext, Exposed=(Window, DedicatedWorker)]
-interface MLCommandEncoder {};
-
-partial interface MLCommandEncoder {
- undefined initializeGraph(MLGraph graph);
-};
+typedef record<DOMString, ArrayBufferView> MLNamedArrayBufferViews;
-partial interface MLCommandEncoder {
- undefined dispatch(MLGraph graph, MLNamedGPUResources inputs, MLNamedGPUResources outputs);
+dictionary MLComputeResult {
+ MLNamedArrayBufferViews inputs;
+ MLNamedArrayBufferViews outputs;
};
-partial interface MLCommandEncoder {
- GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {});
+[SecureContext, Exposed=(Window, DedicatedWorker)]
+interface MLContext {
+ Promise<MLComputeResult> compute(
+ MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
};
-typedef record<DOMString, ArrayBufferView> MLNamedArrayBufferViews;
-
[SecureContext, Exposed=(Window, DedicatedWorker)]
-interface MLContext {};
+interface MLGraph {};
-partial interface MLContext {
- [Exposed=(DedicatedWorker)]
- undefined computeSync(
- MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
+enum MLInputOperandLayout {
+ "nchw",
+ "nhwc"
};
-dictionary MLComputeResult {
- MLNamedArrayBufferViews inputs;
- MLNamedArrayBufferViews outputs;
+enum MLOperandDataType {
+ "float32",
+ "float16",
+ "int32",
+ "uint32",
+ "int64",
+ "uint64",
+ "int8",
+ "uint8"
};
-partial interface MLContext {
- Promise<MLComputeResult> compute(
- MLGraph graph, MLNamedArrayBufferViews inputs, MLNamedArrayBufferViews outputs);
+dictionary MLOperandDescriptor {
+ // The operand type.
+ required MLOperandDataType dataType;
+
+ // The dimensions field is empty for scalar operands,
+ // and non-empty for tensor operands.
+ sequence<unsigned long> dimensions = [];
};
-partial interface MLContext {
- MLCommandEncoder createCommandEncoder();
+[SecureContext, Exposed=(Window, DedicatedWorker)]
+interface MLOperand {
+ MLOperandDataType dataType();
+ sequence<unsigned long> shape();
};
[SecureContext, Exposed=(Window, DedicatedWorker)]
-interface MLGraph {};
+interface MLActivation {};
typedef record<DOMString, MLOperand> MLNamedOperands;
-dictionary MLBufferResourceView {
- required GPUBuffer resource;
- unsigned long long offset = 0;
- unsigned long long size;
-};
-
-typedef (ArrayBufferView or MLBufferResourceView) MLBufferView;
-
[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLGraphBuilder {
// Construct the graph builder from the context.
@@ -106,21 +92,17 @@ interface MLGraphBuilder {
MLOperand input(DOMString name, MLOperandDescriptor descriptor);
// Create an operand for a graph constant.
- MLOperand constant(MLOperandDescriptor descriptor, MLBufferView bufferView);
+ MLOperand constant(MLOperandDescriptor descriptor, ArrayBufferView bufferView);
// Create a single-value operand from the specified number of the specified type.
MLOperand constant(double value, optional MLOperandDataType type = "float32");
// Compile the graph up to the specified output operands asynchronously.
Promise<MLGraph> build(MLNamedOperands outputs);
-
- // Compile the graph up to the specified output operands synchronously.
- [Exposed=(DedicatedWorker)]
- MLGraph buildSync(MLNamedOperands outputs);
};
dictionary MLArgMinMaxOptions {
- sequence<unsigned long> axes = null;
+ sequence<unsigned long> axes;
boolean keepDimensions = false;
boolean selectLastIndex = false;
};
@@ -168,17 +150,10 @@ enum MLConv2dFilterOperandLayout {
"ihwo"
};
-enum MLAutoPad {
- "explicit",
- "same-upper",
- "same-lower"
-};
-
dictionary MLConv2dOptions {
sequence<unsigned long> padding;
sequence<unsigned long> strides;
sequence<unsigned long> dilations;
- MLAutoPad autoPad = "explicit";
unsigned long groups = 1;
MLInputOperandLayout inputLayout = "nchw";
MLConv2dFilterOperandLayout filterLayout = "oihw";
@@ -202,7 +177,6 @@ dictionary MLConvTranspose2dOptions {
sequence<unsigned long> dilations;
sequence<unsigned long> outputPadding;
sequence<unsigned long> outputSizes;
- MLAutoPad autoPad = "explicit";
unsigned long groups = 1;
MLInputOperandLayout inputLayout = "nchw";
MLConvTranspose2dFilterOperandLayout filterLayout = "iohw";
@@ -452,7 +426,6 @@ dictionary MLPool2dOptions {
sequence<unsigned long> padding;
sequence<unsigned long> strides;
sequence<unsigned long> dilations;
- MLAutoPad autoPad = "explicit";
MLInputOperandLayout layout = "nchw";
MLRoundingType roundingType = "floor";
sequence<unsigned long> outputSizes;
@@ -469,7 +442,7 @@ partial interface MLGraphBuilder {
};
dictionary MLReduceOptions {
- sequence<unsigned long> axes = null;
+ sequence<unsigned long> axes;
boolean keepDimensions = false;
};
@@ -574,38 +547,3 @@ partial interface MLGraphBuilder {
partial interface MLGraphBuilder {
MLOperand where(MLOperand condition, MLOperand input, MLOperand other);
};
-
-[SecureContext, Exposed=(Window, DedicatedWorker)]
-interface MLOperand {};
-
-partial interface MLOperand {
- MLOperandDataType dataType();
-};
-
-partial interface MLOperand {
- sequence<unsigned long> shape();
-};
-
-enum MLInputOperandLayout {
- "nchw",
- "nhwc"
-};
-
-enum MLOperandDataType {
- "float32",
- "float16",
- "int32",
- "uint32",
- "int64",
- "uint64",
- "int8",
- "uint8"
-};
-
-dictionary MLOperandDescriptor {
- // The operand type.
- required MLOperandDataType dataType;
-
- // The dimensions field is only required for tensor operands.
- sequence<unsigned long> dimensions;
-};