Tensorflow.js tf.batchToSpaceND() Function Last Updated : 20 Jul, 2021 Comments Improve Suggest changes Like Article Like Report 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. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing a 3D Tensor of batch to reshape const x = tf.tensor3d([5, 10, 15, 20, 25], [5, 1, 1]); // Initializing blockShape and crops parameter const blockShape = [1, 1]; const crops = [[0, 0], [0, 0]]; // Calling the .batchToSpaceND() function over // the above parameters and Tensor x.batchToSpaceND(blockShape, crops).print(); Output: Tensor [ [[5 ],], [[10],], [[15],], [[20],], [[25],]] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing a 4D Tensor of batch to restructure const x = tf.tensor4d([0, 2, 4, 6, 8, 10], [6, 1, 1, 1]); // Using the blockShape and crops as the parameter // for the .batchToSpaceND() function x.batchToSpaceND([3, 2], [[0, 0], [0, 0]]).print(); Output: Tensor [[[[0 ], [2 ]], [[4 ], [6 ]], [[8 ], [10]]]] Reference: https://js.tensorflow.org/api/latest/#batchToSpaceND Comment More infoAdvertise with us Next Article Tensorflow.js tf.batchToSpaceND() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js TensorFlow.js-Transformations Similar Reads Tensorflow.js tf.depthToSpace() 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. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js. The tf. 2 min read Tensorflow.js tf.atan() 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 .atan() function is used to find the atan of the stated tensor input and is done element wise. Syntax :  tf. 2 min read Tensorflow.js tf.batchNorm() Function Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .batchNorm() function is useful in batch normalization. Moreover, the mean, variance, scale, including offset can b 2 min read Tensorflow.js tf.atan2() 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 .atan2() function is used to find the arctangent of the stated tensor inputs and is done element wise. Moreov 2 min read Tensorflow.js tf.atanh() 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 .atanh() function is used to find the inverse hyperbolic tan of the stated tensor input and is done elements 2 min read Tensorflow.js tf.conv2d() Function Tensorflow.js is a javascript library developed by Google to run and train machine learning models in the browser or in Node.js. The tf.conv2d() function is used to compute 2d convolutions over the given input. In a deep neural network, we use this convolution layer which creates a convolution kern 4 min read Tensorflow.js tf.asin() 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 .asin() function is used to find the asin of the stated tensor elementwise. Syntax:  tf.asin(x) Parameters: 2 min read Tensorflow.js tf.conv1d() Function Introduction: Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .conv1d() function is used to determine a 1D convolution upon the stated input tensor. Syntax: tf.con 3 min read Tensorflow.js tf.asinh() 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 .asinh() function is used to find the inverse hyperbolic sin of the stated tensor input and is done elements 2 min read Tensorflow.js tf.broadcastTo() Function Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .broadcastTo() function is used to circulate an array to a consistent model of NumPy-style. Note: Here, the shape o 2 min read Like