From b49faabbf1e730481360f703ea30a81f34be6b1b Mon Sep 17 00:00:00 2001 From: Lutz Roeder Date: Tue, 23 Jul 2024 19:08:09 -0700 Subject: [PATCH] Update coreml.js --- source/coreml.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/coreml.js b/source/coreml.js index adee201396..464b2fdba9 100644 --- a/source/coreml.js +++ b/source/coreml.js @@ -1303,6 +1303,7 @@ coreml.Context.Graph = class { break; } case 'float16': + case 'int4': case 'int8': case 'uint8': { data = stream.read(size); @@ -1329,7 +1330,10 @@ 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); @@ -1337,7 +1341,7 @@ coreml.Context.Graph = class { } return { value: argument.value }; }); - return { name, value: args }; + return { name, value }; }); operation.outputs = op.outputs.map((output) => { const value = this.input(output.name); @@ -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);