mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
### Description
See
454996d496
for manual changes (excluded auto-generated formatting changes)
### Why
Because the toolsets for old clang-format is out-of-date. This reduces
the development efficiency.
- The NPM package `clang-format` is already in maintenance mode. not
updated since 2 years ago.
- The VSCode extension for clang-format is not maintained for a while,
and a recent Node.js security update made it not working at all in
Windows.
No one in community seems interested in fixing those.
Choose Prettier as it is the most popular TS/JS formatter.
### How to merge
It's easy to break the build:
- Be careful of any new commits on main not included in this PR.
- Be careful that after this PR is merged, other PRs that already passed
CI can merge.
So, make sure there is no new commits before merging this one, and
invalidate js PRs that already passed CI, force them to merge to latest.
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* A string that represents a file's URL or path.
|
|
*
|
|
* Path is vailable only in onnxruntime-node or onnxruntime-web running in Node.js.
|
|
*/
|
|
export type FileUrlOrPath = string;
|
|
|
|
/**
|
|
* A Blob object that represents a file.
|
|
*/
|
|
export type FileBlob = Blob;
|
|
|
|
/**
|
|
* A Uint8Array, ArrayBuffer or SharedArrayBuffer object that represents a file content.
|
|
*
|
|
* When it is an ArrayBuffer or SharedArrayBuffer, the whole buffer is assumed to be the file content.
|
|
*/
|
|
export type FileData = Uint8Array | ArrayBufferLike;
|
|
|
|
/**
|
|
* Represents a file that can be loaded by the ONNX Runtime JavaScript API.
|
|
*/
|
|
export type FileType = FileUrlOrPath | FileBlob | FileData;
|
|
|
|
/**
|
|
* Represents an external data file.
|
|
*/
|
|
export interface ExternalDataFileDescription {
|
|
/**
|
|
* Specify the external data file.
|
|
*/
|
|
data: FileType;
|
|
/**
|
|
* Specify the file path.
|
|
*/
|
|
path: string;
|
|
}
|
|
|
|
/**
|
|
* Represents an external data file.
|
|
*
|
|
* When using a string, it should be a file URL or path that in the same directory as the model file.
|
|
*/
|
|
export type ExternalDataFileType = ExternalDataFileDescription | FileUrlOrPath;
|
|
|
|
/**
|
|
* Options for model loading.
|
|
*/
|
|
export interface OnnxModelOptions {
|
|
/**
|
|
* Specifying a list of files that represents the external data.
|
|
*/
|
|
externalData?: readonly ExternalDataFileType[];
|
|
}
|