Sunday, November 17, 2024
Google search engine
HomeLanguagesJavascriptTensorflow.js tf.util.shuffleCombo() Function

Tensorflow.js tf.util.shuffleCombo() Function

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 .util.shuffleCombo() function is used to shuffle the two stated array in order with the help of Fisher-Yates algorithm.

Syntax:  

tf.util.shuffleCombo (array, array2)

Parameters:  

  • array1: It is the stated first array which is to be shuffled. It can be of type tf.any()[], Uint32Array, Int32Array, or, Float32Array.
  • array2: It is the stated second array which is to be shuffled. It can be of type tf.any()[], Uint32Array, Int32Array, or Float32Array. Moreover, its shuffled with the equivalent permutation as that of first stated array.

Return Value: It returns void.

Example 1:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Defining first and second array
const arr = [11, 12, 13, 14, 15];
const arr2 = [16, 17, 18, 19, 20];
  
// Calling tf.util.shuffleCombo() method and
// printing output
tf.util.shuffleCombo(arr, arr2);
console.log(arr, arr2);


Output:

12,14,11,15,13 17,19,16,20,18

Example 2:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Defining first and second array 
// of float values
const arr = [4.5, 6.8, 17.1, 21.23, 45.8];
const arr2 = [47.9, 50.4, 52.5, 62.6, 73.7];
  
// Calling tf.util.shuffleCombo() method and
// printing output
tf.util.shuffleCombo(arr, arr2);
console.log(arr, arr2);


Output:

17.1,21.23,45.8,4.5,6.8 52.5,62.6,73.7,47.9,50.4

Reference: https://js.tensorflow.org/api/latest/#util.shuffleCombo

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 Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments