Skip to content

Commit

Permalink
Merge conflict fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dakenf committed Oct 15, 2023
1 parent 4914d12 commit 9f0eeb1
Show file tree
Hide file tree
Showing 6 changed files with 1,616 additions and 4,410 deletions.
25 changes: 4 additions & 21 deletions js/common/lib/inference-session-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export class InferenceSession implements InferenceSessionInterface {
Promise<InferenceSessionInterface>;
static create(buffer: Uint8Array, options?: SessionOptions): Promise<InferenceSessionInterface>;
static async create(
arg0: string|ArrayBufferLike|Uint8Array|[string, string]|[Uint8Array, ArrayBufferLike],
arg1?: SessionOptions|number, arg2?: number, arg3?: SessionOptions): Promise<InferenceSessionInterface> {
arg0: string|ArrayBufferLike|Uint8Array, arg1?: SessionOptions|number, arg2?: number,
arg3?: SessionOptions): Promise<InferenceSessionInterface> {
// either load from a file or buffer
let filePathOrUint8Array: string|[string, string]|Uint8Array|[Uint8Array, (SharedArrayBuffer | ArrayBuffer)];
let filePathOrUint8Array: string|Uint8Array;
let options: SessionOptions = {};

if (typeof arg0 === 'string') {
Expand Down Expand Up @@ -187,25 +187,8 @@ export class InferenceSession implements InferenceSessionInterface {
throw new TypeError('\'options\' must be an object.');
}
filePathOrUint8Array = new Uint8Array(buffer, byteOffset, byteLength);
} else if (Array.isArray(arg0)) {
if (typeof arg0[0] === 'string' && typeof arg0[1] === 'string') {
filePathOrUint8Array = arg0 as [string, string];
} else if (arg0[0] instanceof Uint8Array && arg0[1] instanceof ArrayBuffer) {
filePathOrUint8Array = arg0 as [Uint8Array, ArrayBufferLike];
} else {
throw new TypeError(
'Unexpected argument[0]: array must be [modelPath, weightsPath],' +
' or [modelBuffer, weightsBuffer]');
}
if (typeof arg1 === 'object' && arg1 !== null) {
options = arg1;
} else if (typeof arg1 !== 'undefined') {
throw new TypeError('\'options\' must be an object.');
}
} else {
throw new TypeError(
'Unexpected argument[0]: must be \'path\', \'buffer\', [modelPath, weightsPath],' +
' or [modelBuffer, weightsBuffer]');
throw new TypeError('Unexpected argument[0]: must be \'path\' or \'buffer\'.');
}

// get backend hints
Expand Down
Loading

0 comments on commit 9f0eeb1

Please sign in to comment.