TensorflowJS: Initialization of backend webgl failed on Firefox and Safari with web worker

Viewed 1068

I am new to TensorflowJS. I have used tensorflowJS with web worker and it works perfectly on Chrome with backend webGL. However, when I tested with Firefox and Safari, it shows a warning Initialization of backend WebGL failed, and then it will automatically switch to use backend as CPU. I tried to test without using web worker and it works fine. Is there any solution to use TFJS with web worker on webGL backend?output from browser.

TensorflowJS version: 2.3, Firefox: 79.0

1 Answers

Right now the only way to do this would be to use OffscreenCanvas. However looking at support: https://caniuse.com/#feat=offscreencanvas it appears this is not ready yet in Firefox without enabling flag. Should work in Chrome / Edge / Opera / Android Browser today though. Hopefully the others will catch up soon enough though.

Related