Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Tensorflow.js tf.data.Dataset.skip() Function

  • Last Updated : 18 May, 2021

Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js.

The tf.data.Dataset.skip() function is used to create a Dataset that skips count initial elements from this dataset

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

Syntax:

skip(count)

Parameters



  • count: The number of elements of this dataset that should be skipped to form the new dataset.

Return Value: It returns tf.data.Dataset.

Example 1:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
const a = tf.data.array(
    [5, 10, 15, 20, 25, 30]).skip(2);
  
await a.forEachAsync(e => console.log(e));

Output:

15
20
25
30

Example 2:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
const gfg = tf.data.array(
    ['geeksforgeeks', 'gfg', 'geeks'
    'for', 'geeks']).skip(2);
      
await gfg.forEachAsync(
    geeks => console.log(geeks));

Output:

geeks
for
geeks

Reference: https://js.tensorflow.org/api/latest/#tf.data.Dataset.skip

My Personal Notes arrow_drop_up
Recommended Articles
Page :