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
Fix FromPixels type checker to avoid error in worker #5472
Conversation
TFJS is possible running in worker, which doesn't have ability to access DOM elements. FromPixels op in tfjs webgpu backend type check doesn't consider this scene. It will break the whole program even if user provided correct input params. Fix this by checking whether DOM is available. Bug tensorflow#5467
@lina128 , |
@qjia7 Also cc jiajia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a nit.
@lina128 take another look, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reviewable status: complete! 2 of 1 approvals obtained (waiting on @qjia7)
tfjs-backend-webgpu/src/kernels/FromPixels.ts, line 65 at r1 (raw file):
Previously, qjia7 (Jiajia Qin) wrote…
nit: Maybe this checking is not needed since we have done it in the upper level ( tfjs-core
)tfjs/tfjs-core/src/ops/browser.ts
Line 96 in 38f8462
throw new Error(
+1
Hi @shaoboyan, to run the worker test, you need to have some additional karma setup, like the one in core: https://github.com/tensorflow/tfjs/blob/master/tfjs-core/karma.conf.js#L63-L65 |
f4705ea
to
26b7768
Compare
@qjia7 Done. |
@shaoboyan Please follow up the worker test in a separate PR. Thanks. |
TFJS is possible running in worker, which doesn't have
ability to access DOM elements.
FromPixels op in tfjs webgpu backend type check
doesn't consider this scene. It will break the whole
program even if user provided correct input params.
Fix this by checking whether DOM is available.
Bug #5467
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.
This change is