Closed BruceDai closed 3 years ago
@huningxin @ibelem PTAL, thanks. I use require to instead of import for '@tensorflow/tfjs-backend-webgpu' model, now if browser didn't support WebGPU, there's an error 'WebGPU is not available'.
static _supportWebGPU() { if (navigator.gpu === undefined) { return false; } else { let tfjsBackendWebgpu = require("@tensorflow/tfjs-backend-webgpu"); tf.setBackend('webgpu'); tf.ready(); return tf.getBackend() === "webgpu"; } }
Thanks @BruceDai !
@huningxin @ibelem PTAL, thanks. I use require to instead of import for '@tensorflow/tfjs-backend-webgpu' model, now if browser didn't support WebGPU, there's an error 'WebGPU is not available'.