Skip to content

Make MLTensor strongly typed? #39

@wacky6

Description

@wacky6

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions