Tensorflow.js tf.util.flatten() 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.flatten() function is used to flatten an inconsistent array that is nested.
tf.util.flatten(arr, result?, skipTypedArray?)
- arr: It is the stated nested array which is to be flattened. It can be of type number, Boolean, string, Promise<number>, TypedArray, RecursiveArray, or TypedArray>.
- result: It is the stated destination array that carries the elements. It is optional parameter and can be of type number, Boolean, string, Promise<number>, TypedArray.
- skipTypedArray: It is the optional parameter which prevent the flattening of typed arrays. And the by default value of it is false.
Return Value: It can return number, Boolean, string, Promise<number>, or TypedArray.