Tensorflow.js tf.data.Dataset class .forEachAsync() Method
The tf.data.Dataset.forEachAsync() function is used after applying a function to each and every element of the dataset. We can use this method to print an array, modifying the values of the array etc.
- f: It accepts a function which is applied to each and every element of the dataset
Return Value: It returns a promise
10 20 30 40 50
Example 2: In this example we will pass a function that calculates the square of an element.
1 4 9 16 25