Skip to content

Commit 3499a61

Browse files
authored
fix: Executorchmodule BigInt64Array handling (#470)
## Description Fix Executorchmodule BigInt64Array handling ### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [x] iOS - [ ] Android ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [x] My changes generate no new warnings
1 parent 3ac2034 commit 3499a61

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/modules/general/ExecutorchModule.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ export class ExecutorchModule extends BaseModule {
1717
input = [input];
1818
}
1919

20-
let inputTypeIdentifiers = [];
21-
let modelInputs = [];
20+
const inputTypeIdentifiers: number[] = [];
21+
const modelInputs: number[][] = [];
2222

23-
for (let idx = 0; idx < input.length; idx++) {
24-
let currentInputTypeIdentifier = getTypeIdentifier(input[idx] as ETInput);
25-
if (currentInputTypeIdentifier === -1) {
23+
for (const subInput of input) {
24+
const typeIdentifier = getTypeIdentifier(subInput);
25+
if (typeIdentifier === -1) {
2626
throw new Error(getError(ETError.InvalidArgument));
2727
}
28-
inputTypeIdentifiers.push(currentInputTypeIdentifier);
29-
modelInputs.push([...(input[idx] as unknown as number[])]);
28+
inputTypeIdentifiers.push(typeIdentifier);
29+
modelInputs.push(Array.from(subInput, (x: number | BigInt) => Number(x)));
3030
}
3131

3232
try {

0 commit comments

Comments
 (0)