Skip to content

Commit

Permalink
Update coreml.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jul 24, 2024
1 parent 3c2b5df commit b49faab
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions source/coreml.js
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ coreml.Context.Graph = class {
break;
}
case 'float16':
case 'int4':
case 'int8':
case 'uint8': {
data = stream.read(size);
Expand All @@ -1329,15 +1330,18 @@ coreml.Context.Graph = class {
operation.attributes[key] = convertValue(value);
}
operation.inputs = Object.entries(op.inputs).map(([name, input]) => {
const args = input.arguments.map((argument) => {
const value = input.arguments.map((argument) => {
if (argument.value && argument.value.value && argument.value.blobFileValue) {
return { name: '', value: convertValue(argument.value) };
}
if (argument.name) {
const value = this.input(argument.name);
value.to.push(operation);
return value;
}
return { value: argument.value };
});
return { name, value: args };
return { name, value };
});
operation.outputs = op.outputs.map((output) => {
const value = this.input(output.name);
Expand Down Expand Up @@ -1397,6 +1401,10 @@ coreml.Context.Graph = class {
if (value.value instanceof coreml.Tensor) {
value.initializer = value.value;
delete value.value;
if (name === '') {
this.values.set(value, value);
return value;
}
}
if (!this.values.has(name)) {
this.values.set(name, value);
Expand Down

0 comments on commit b49faab

Please sign in to comment.