Tensorflow.js tf.stack() Function
The tf.stack() function is used to create a stack of tf,tensors into an r+1 rank tf.tensor.
Parameters: This function accepts two parameters as mentioned above and discussed below.
- tensors: list of tensor objects to be used, with the same shape and dtype.
- axis: It is an axis of the stack along.
Return Value: It returns tf.Tensor.
Tensor [[99 , 999, 999], [322, 411, 888], [523, 622, 666]]
Example 2: In this example, making the stack with axis as the 2nd parameter.
Tensor [[99 , 322, 523], [999, 411, 622], [999, 888, 666]]