chore: update node_modules with new binary files and dependencies
- Add new binary files for nodemon, onnxruntime-web, and xenova/transformers - Update various JavaScript and TypeScript files in node_modules - Remove unused files and dependencies - Add new test fixtures and documentation files
This commit is contained in:
45
node_modules/onnxruntime-web/lib/onnxjs/session-handler.ts
generated
vendored
Normal file
45
node_modules/onnxruntime-web/lib/onnxjs/session-handler.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
import {InferenceSession, SessionHandler, Tensor} from 'onnxruntime-common';
|
||||
|
||||
import {Session} from './session';
|
||||
import {Tensor as OnnxjsTensor} from './tensor';
|
||||
|
||||
export class OnnxjsSessionHandler implements SessionHandler {
|
||||
constructor(private session: Session) {
|
||||
this.inputNames = this.session.inputNames;
|
||||
this.outputNames = this.session.outputNames;
|
||||
}
|
||||
|
||||
async dispose(): Promise<void> {}
|
||||
inputNames: readonly string[];
|
||||
outputNames: readonly string[];
|
||||
async run(
|
||||
feeds: SessionHandler.FeedsType, _fetches: SessionHandler.FetchesType,
|
||||
_options: InferenceSession.RunOptions): Promise<SessionHandler.ReturnType> {
|
||||
const inputMap = new Map<string, OnnxjsTensor>();
|
||||
for (const name in feeds) {
|
||||
if (Object.hasOwnProperty.call(feeds, name)) {
|
||||
const feed = feeds[name];
|
||||
inputMap.set(
|
||||
name,
|
||||
new OnnxjsTensor(
|
||||
feed.dims, feed.type as OnnxjsTensor.DataType, undefined, undefined,
|
||||
feed.data as OnnxjsTensor.NumberType));
|
||||
}
|
||||
}
|
||||
const outputMap = await this.session.run(inputMap);
|
||||
const output: SessionHandler.ReturnType = {};
|
||||
outputMap.forEach((tensor, name) => {
|
||||
output[name] = new Tensor(tensor.type, tensor.data, tensor.dims);
|
||||
});
|
||||
return output;
|
||||
}
|
||||
startProfiling(): void {
|
||||
this.session.startProfiling();
|
||||
}
|
||||
endProfiling(): void {
|
||||
this.session.endProfiling();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user