tfjs: Inconsistent ”Could not get context for WebGL version 2” error message
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): no
- OS Platform and Distribution: macOS 10.15.7 and iOS 14.1
- Mobile device: iPhone 11
- TensorFlow.js installed from (npm or script link):
https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.7.0 - TensorFlow.js version:
2.7.0 - Browser version:
- Safari 14.0 on iOS:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1 - Safari 14.0.1 on macOS:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15
- Safari 14.0 on iOS:
- Tensorflow.js Converter Version: ?
Describe the current behavior
Steps to reproduce:
-
Click the first Run button
-
Console log prints:
Could not get context for WebGL version 2
Tensor
[11, 22, 33, 44]
- Click Run again
- Console log prints:
Tensor
[11, 22, 33, 44]
Describe the expected behavior
Expected the log messages in steps 3 and 5 to be identical, including the WebGL error message.
Standalone code to reproduce the issue
Reproducible test case: https://js.tensorflow.org/api/latest/#add
Other info / logs
The latest stable Safari 14 ships with WebGL 2.0 disabled by default. Make sure WebGL 2.0 is disabled via Safari > Experimental WebKit Features to be able to reproduce this issue.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (3 by maintainers)
I am getting this error when trying to use tensorflow js in safari, with an ionic app.
i am having same issue on chrome @pyu10055
@annxingyuan Can you help to confirm? The WebGL 2 check happens on the first API call, once it is identified missing, we will be using WebGL 1 instead. The following API calls would not trigger the warning message.