Skip to content

[Web] TypeScript definitions incorrectly forbid Float16Array #26741

@RReverser

Description

@RReverser

Describe the issue

When trying to create tensors from Float16Array data, TS complains incorrectly that this type is not supported as an input, even though it is in fact accepted at runtime.

This is likely a result of it being a relatively new type, as in the past onnxruntime-web has only accepted Uint16Array representation of fp16 tensors.

To reproduce

import * as ort from 'onnxruntime-web';

const data = new Float16Array(9);
const tensor = new ort.Tensor(data, [3, 3]);

Results in:

Image

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.23.2

Execution Provider

Other / Unknown

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