Skip to content

Commit

Permalink
added suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
carzh committed Nov 22, 2023
1 parent a4ff61c commit fa9f545
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/common/lib/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface TrainingSessionHandler extends SessionHandler {
options: InferenceSession.RunOptions): Promise<SessionHandler.ReturnType>;

getParametersSize(trainableOnly: boolean): Promise<number>;
loadParametersBuffer(array: Float32Array, trainableOnly: boolean): Promise<void>;
loadParametersBuffer(array: Uint8Array, trainableOnly: boolean): Promise<void>;
getContiguousParameters(trainableOnly: boolean): Promise<OnnxValue>;
}

Expand Down
2 changes: 1 addition & 1 deletion js/web/lib/wasm/wasm-training-core-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ export const loadParametersBuffer =
const locationAsString = 'cpu';

// allocates & copies JavaScript buffer to WASM heap
const bufferCount = getParametersSize(trainingSessionId, trainableOnly);
const bufferByteLength = buffer.length;
const bufferCount = bufferByteLength / 4;
const bufferOffset = wasm._malloc(bufferByteLength);
wasm.HEAPU8.set(buffer, bufferOffset);

Expand Down

0 comments on commit fa9f545

Please sign in to comment.