diff --git a/tfjs-core/src/ops/browser.ts b/tfjs-core/src/ops/browser.ts index 45141038ca2..91b4b04917f 100644 --- a/tfjs-core/src/ops/browser.ts +++ b/tfjs-core/src/ops/browser.ts @@ -372,10 +372,13 @@ export async function toPixels( if (canvas != null) { if (!hasToPixelsWarned) { - console.warn( - 'tf.browser.toPixels is not efficient to draw tensor on canvas. ' + - 'Please try tf.browser.draw instead.'); - hasToPixelsWarned = true; + 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.'); + hasToPixelsWarned = true; + } } canvas.width = width;