Tensorflow.js tf.nextFrame() Function
Introduction: Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .nextFrame() function is used to return a promise which determines at which a requestAnimationFrame has been terminated.
- Within, Node.js this method applies setImmediate in place of requestAnimationFrame.
- Moreover, its a basic sugar method such that users are able to do the following: await tf.nextFrame().
Parameters: This method does not hold any parameter.
Return Value: It returns promise of void.
Output: Here, due to nextFrame method stars are printed one by one.
***** ***** ***** ***** *****
Output: Here, if you run the program promptly more than once then an error occurs as the tensor is disposed.
Tensor [[-1.2814652, 0.0379729, 1.4826748], [1.5050254 , 0.0769796, 0.5443317]] Tensor [[-1.9229894, 0.2478886 , 0.6501164], [0.3088476 , -1.0728339, 0.8636787]] Tensor [[-0.2324371, -1.2162384, 0.3193687], [0.0266885 , 1.3987972 , 0.4429231]]