Fix output Float32Array size in webgpu export (#2096)

This commit is contained in:
Ahmed Harmouche 2023-10-18 00:28:19 +02:00 committed by GitHub
commit 2b5ea7d9cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,7 +121,7 @@ const setupNet = async (device, safetensor) => {{
device.queue.submit([gpuCommands]);
await gpuReadBuffer.mapAsync(GPUMapMode.READ);
const resultBuffer = new Float32Array(gpuReadBuffer.size);
const resultBuffer = new Float32Array(gpuReadBuffer.size/4);
resultBuffer.set(new Float32Array(gpuReadBuffer.getMappedRange()));
gpuReadBuffer.unmap();
return resultBuffer;