Tensorflow-JS-Examples
Tensorflow-JS-Examples copied to clipboard
avoiding dataSync() in neuro-evolution example
In the interest of getting the thing working, I just used dataSync() out of convenience. I should probably avoid it and run predict() asynchronously. This will be tricky to align with p5's draw() loop.
depending on how long it takes (im fairly new) to fetch it async you can save it to a promise and check if the promise completed before drawing the next frame probably gonna introduce a bit more lagging though (on second thought probably not since it should take about the same time to fetch the data from the gpu , but it might skip a frame or two)