-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReferenceError in PlatformBrowser.setTimeoutCustom #6922
Comments
In worker thread, window doesn't exist so !window will raise a referenceError. Check "typeof window" to fix this. BUG tensorflow#6922
@khcyt thanks for reporting the issue! Submitted a PR as above. |
In worker thread, window doesn't exist so !window will raise a referenceError. Check "typeof window" to fix this. BUG #6922 Co-authored-by: Matthew Soulanille <[email protected]>
Related PR #6923 has been merged , closing this issue. |
I'm using the actual v4.1.0 version, installed via github and i get still this error, cause the fix is missing: setTimeoutCustom(functionRef, delay) {
if (!window || !env().getBool('USE_SETTIMEOUTCUSTOM')) {
setTimeout(functionRef, delay);
return;
} Which release i have to install to get the correct version? |
@bentzibentz The fix was included in v4.0.0, and I just checked the github version (tfjs-core/src/platforms/platform_browser.ts). Could you please double check? |
@gyagp maybe the problem is, my installation of tsfj installs @tensorflow/tfjs-core v3.21.0 |
yes, tfjs-core v3.21.0 still has this problem and the version after it (v4.0.0) is the first one to fix it. Glad to know you're fine now. |
tfjs v4.0+ solves issue tensorflow#6922 which caused it to not be usable in web workers. tfjs-automl still used v3.9.0 . This fork updates it to 4.9.0+ , same as in its devDependencies.
System information
Describe the current behavior
I run tensorflow in browser a separate worker thread. This is why there is an exception in PlaformBrowser.setTimeoutCustom()
platform_browser.js:53 Uncaught (in promise) ReferenceError: window is not defined
at PlatformBrowser.setTimeoutCustom (platform_browser.js:53:9)
at tryFn (util_base.js:287:13)
at util_base.js:289:9
at new Promise ()
at repeatedTry (util_base.js:274:12)
at GPGPUContext.addItemToPoll (gpgpu_context.js:398:9)
at gpgpu_context.js:375:18
at new Promise ()
at GPGPUContext.pollFence (gpgpu_context.js:374:16)
at GPGPUContext.createAndWaitForFence (gpgpu_context.js:165:21)
Describe the expected behavior
The expected behavior would be that window is not assumed to exist.
Eiter
!globalThis.window
or'undefined'== typeof window
The text was updated successfully, but these errors were encountered: