Tensorflow.js tf.util.shuffleCombo() Function
Last Updated :
21 May, 2021
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
import * as tf from "@tensorflow/tfjs"
const arr = [11, 12, 13, 14, 15];
const arr2 = [16, 17, 18, 19, 20];
tf.util.shuffleCombo(arr, arr2);
console.log(arr, arr2);
|
Output:
12,14,11,15,13 17,19,16,20,18
Example 2:
Javascript
import * as tf from "@tensorflow/tfjs"
const arr = [4.5, 6.8, 17.1, 21.23, 45.8];
const arr2 = [47.9, 50.4, 52.5, 62.6, 73.7];
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
Share your thoughts in the comments
Please Login to comment...