Skip to content

[Web] Shall we accept Uint16Array for 'float16' if Float16Array is available #23817

Closed
@Honry

Description

@Honry

Describe the issue

The Float16Array has been enabled by default in latest Chrome Canary, in ort-web, the float16 data type will be map to Float16Array at here now, while we are still using Uint16Array as workaround input data, thus the code will go into following exception.

tensor-impl.ts:265 Uncaught (in promise) TypeError: A float16 tensor's data must be type of function Float16Array() { [native code] }
    at new Tensor (tensor-impl.ts:265:19)

This would break all apps that are still using Uint16Array as workaround for float16, shall we accept both Uint16Array and Float16Array for a period of time?

@fs-eire, @guschmue

To reproduce

Create ORT float16 CPU tensor with Uint16Array data:

new ort.Tensor('float16', new Uint16Array([0]), [1]);

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.20.1

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform:webissues related to ONNX Runtime web; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions