Tensorflow.js tf.batchToSpaceND() Function
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.
The tf.batchToSpaceND() function is used to restructure the given “batch” from their zero dimension to “M+1” dimensions having shape of “block-Shape + [batch]”, where block-Shape is the parameter and batch is the specified Tensor. Here cropping is done on the in-between result as per the given crop array.
tf.batchToSpaceND (x, blockShape, crops)
Parameters: This function accepts three parameters which are illustrated below:
- x: A specified batch Tensor of N-Dimension with having shape of “[batch] + spatialShape + remainingShape”, where spatialShape is of M dimensions.
- blockShape: A 1-D array must be having shape of [M], for all the values must be greater than or equal to 1.
- crops: A 2-D array shape of [M, 2] for which all the values must be greater than or equal to 0. Here crops[i] = [cropStart, cropEnd] which defines the portion to crop from input dimension i + 1.
Return Value: It returns a Tensor of the reshaped version of the specified batch.
Tensor [ [[5 ],], [,], [,], [,], [,]]
Tensor [[[[0 ], [2 ]], [[4 ], [6 ]], [[8 ], ]]]