Some issues with using a dict:
dimensions isn't validated against TypedArray.bytesLength. I can set arbitrary dimensions (like [4,4,4] to a Float32Array that only has 1 element.
- Hard to create an overloaded WebNN dispatch() and WebML compute() for single input/output graphs.
- WebIDL can't distinguish between
dict<NodeName, dict<data, dimensions>> and dict<NodeName "data", NodeName "dimensions">, thus fails to bind JavaScript object to C++ implementation.
Discovered this during WebML prototyping for https://crbug.com/1338067
See related issue in WebNN webmachinelearning/webnn#275
Some issues with using a dict:
dimensionsisn't validated againstTypedArray.bytesLength. I can set arbitrary dimensions (like[4,4,4]to a Float32Array that only has 1 element.dict<NodeName, dict<data, dimensions>>anddict<NodeName "data", NodeName "dimensions">, thus fails to bind JavaScript object to C++ implementation.Discovered this during WebML prototyping for https://crbug.com/1338067
See related issue in WebNN webmachinelearning/webnn#275