[js/webgpu] fix RangeError in buffer download (#16165)

### Description
this is a following up fix for #15990, which should resolve the
RangeError issue.
This commit is contained in:
Yulong Wang 2023-05-30 15:04:50 -07:00 committed by GitHub
parent bf05d4ec26
commit ebe715a817
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -289,7 +289,7 @@ export class WebGpuBackend {
// the underlying buffer may be changed after the async function is called. so we use a getter function to make sure
// the buffer is up-to-date.
const data = getTargetBuffer();
data.set(new Uint8Array(arrayBuffer));
data.set(new Uint8Array(arrayBuffer, 0, data.byteLength));
}
alloc(size: number): number {