Thursday, September 4, 2025
HomeLanguagesJavascriptTensorflow.js tf.data.Dataset.skip() Method

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

Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.

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

Syntax:

skip(count)

Parameters: This method has as single parameter as mentioned above and described below:

  • count: It is a tensor input where the number of element of this dataset that should be skipped to form the new dataset. When the count is greater than the size of this dataset, the new dataset will contain no elements. When the count is undefined or negative, it skips the entire dataset.

Return Value: It returns the tf.data.Dataset.

The below examples demonstrate the tf.data.Dataset.skip() method:

Example 1:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Defining input elements
const a = 
  tf.data.array([4, 5, 6, 7, 8, 9]).skip(3);
await a.forEachAsync(e => console.log(e));


Output:

7
8
9

Example 2:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Defining input elements
const a = 
  tf.data.array([4, 5, 6, 7, 8, 9]).skip(4);
await a.forEachAsync(e => console.log(e));


Output:

8
9

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

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6629 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11859 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6698 POSTS0 COMMENTS
Umr Jansen
6717 POSTS0 COMMENTS