-
Notifications
You must be signed in to change notification settings - Fork 40
Closed
Description
Hi there,
I came across the error on Chrome for this example:
engine.js:103 Uncaught (in promise) Error: Backend 'undefined' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods
at get backend (engine.js:103:19)
at b.makeTensor (engine.js:612:35)
at s (tensor_ops_util.js:66:19)
at Module.a (tensor.js:199:12)
at SD.formatInputsForPredictionAll (index.js:443:12)
at SD.predictSyncInternal (index.js:883:28)
at SD.predictSync (index.js:828:17)
at finishedTraining (sketch.js:130:18)
at callcallback.js:35:9
Which goes away if you add the following line, as you did in your current example:
// For this example to work across all browsers
// "webgl" or "cpu" needs to be set as the backend
ml5.setBackend("webgl");
Curious about it, I did a quick search in the source code, and now I wonder if it might not be a case of just adding tf.ready()
at the right spot in NeuralNetwork/index.js
? I'm sorry I'm not yet fully set up to make this experiment. It seems that it's called in all the other classes but not this one:

Metadata
Metadata
Assignees
Labels
No labels