Skip to content

[examples] custom-layer examples errors out due to tf.browser.fromPixels() #1911

@caisq

Description

@caisq

To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

TensorFlow.js version

1.2.6, 1.2.7, 1.2.8 all show this issue.
Other versions not tested.

Browser version

Chrome Linux Version 76.0.3809.100 (Official Build) (64-bit)
Firefox Linux 60.8.0esr (64-bit)

Describe the problem or feature request

Launch the custom-layer example from tfjs-examples. Observe the error message:

Uncaught Error: The DOM is not ready yet. Please call tf.browser.fromPixels() once the DOM is ready. One way to do that is to add an event listener for DOMContentLoaded on the document object
at t.fromPixels (backend_webgl.ts:316)
at t.fromPixels (engine.ts:870)
at fromPixels_ (browser.ts:55)
at Object.fromPixels (operation.ts:45)
at customLayerDemo (index.js:25)
at Object.parcelRequire.index.js.@tensorflow/tfjs (index.js:56)
at newRequire (custom-layer.e31bb0bc.js:49)
at custom-layer.e31bb0bc.js:81
at custom-layer.e31bb0bc.js:107

Adding document.addEventListener('DOMContentLoaded', ...) doesn't seem to help

Code to reproduce the bug / link to feature request

If you would like to get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

GitHub issues for this repository are tracked in the tfjs union repository.

Please file your issue there, following the guidance in that issue template.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions