Skip to content
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

Avoid draw API warning if the current backend does not have implementation #7744

Merged
merged 5 commits into from
Jun 9, 2023

Conversation

Linchenn
Copy link
Collaborator

@Linchenn Linchenn commented Jun 7, 2023

Since Draw API on WebGL and WebGPU backends are in progress, we could avoid the warning until they are launched.

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.

'Please try tf.browser.draw instead.');
hasToPixelsWarned = true;
const backendName = getBackend();
if (backendName !== 'webgl' && backendName !== 'webgpu') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about checking like below? Then we don't need to revisit it anymore.

 const kernel = getKernel(Draw, ENGINE.backendName);
  if (kernel != null) {
        console.warn(
            'tf.browser.toPixels is not efficient to draw tensor on canvas. ' +
            'Please try tf.browser.draw instead.');
  }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks!

@Linchenn Linchenn changed the title Avoid draw API warning for webgl and webgpu backend Avoid draw API warning if the current backend does not have implementation Jun 8, 2023
Copy link
Collaborator

@qjia7 qjia7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Linchenn Linchenn merged commit cbe0946 into tensorflow:master Jun 9, 2023
2 checks passed
@Linchenn Linchenn deleted the fixxx branch June 9, 2023 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants