onnxruntime/js/web/lib
Yulong Wang 58f4921686
[js] changes to allow Float16Array if any polyfill is available (#19305)
### Description

This change adds only necessary code to enable ort-web works with any
Float16Array polyfill. Unlike #19302, in this PR, ort-web does not
include any specific polyfill; instead, it's user's choice for how to
use a polyfill.

ORT-web uses Float16Array if it's available; otherwise, fallback to use
Uint16Array.

```js
// case 1: user does not use polyfill:
import * as ort from 'onnxruntime-web';

const myF16Data = new Uint16Array(...);  // need to use Uint16Array
const myF16tensor = new ort.Tensor('float16', myF16Data, dims);
```

```js
// case 2: user use polyfill:
import * as ort from 'onnxruntime-web';
import {
  Float16Array, isFloat16Array, isTypedArray,
  getFloat16, setFloat16,
  f16round,
} from "@petamoriken/float16";
globalThis.Float16Array = Float16Array;  // ort-web will pick the global Float16Array

const myF16Data = new Float16Array(...);  // Use the polyfilled Float16Array type
const myF16tensor = new ort.Tensor('float16', myF16Data, dims);
```
2024-02-21 00:31:06 -08:00
..
onnxjs [js] optimize eslint config (#18460) 2023-11-20 12:00:56 -08:00
wasm [js] changes to allow Float16Array if any polyfill is available (#19305) 2024-02-21 00:31:06 -08:00
backend-onnxjs.ts [js/web/training] runTrainStep implementation (#18006) 2023-11-02 08:32:50 -07:00
backend-wasm-inference.ts Add "glue" between training WASM artifacts and training web (#17474) 2023-10-12 11:16:56 -07:00
backend-wasm-training.ts [js/web/training] runTrainStep implementation (#18006) 2023-11-02 08:32:50 -07:00
backend-wasm.ts [js/web] show warning when numThreads is set but threads is not supported (#19179) 2024-01-17 15:04:22 -08:00
build-def.d.ts [WebNN EP] Support WebNN async API with Asyncify (#19145) 2024-01-24 15:37:35 -08:00
index.ts [WebNN EP] Support WebNN async API with Asyncify (#19145) 2024-01-24 15:37:35 -08:00
version.ts [ORT 1.17.0 release] Bump up version to 1.18.0 (#19170) 2024-01-17 11:18:32 -08:00