From 74d1f1020ba166892e4b01796335ba02570b2893 Mon Sep 17 00:00:00 2001 From: Patrick To Date: Wed, 28 Aug 2024 01:20:27 -0700 Subject: [PATCH] patrto: lenet - change createContext to use GPUDevice --- lenet/lenet.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lenet/lenet.js b/lenet/lenet.js index 45d85f19..fb5f1afc 100644 --- a/lenet/lenet.js +++ b/lenet/lenet.js @@ -22,7 +22,10 @@ export class LeNet { throw new Error('Incorrect weights file'); } - this.context_ = await navigator.ml.createContext(contextOptions); + let adapter = await navigator.gpu.requestAdapter(); + let device = await adapter.requestDevice(); + + this.context_ = await navigator.ml.createContext(device); this.builder_ = new MLGraphBuilder(this.context_); const inputShape = /* nchw */ [1, 1, 28, 28]; let input = this.builder_.input('input', {