Tensorflow.js tf.layers.reshape() 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 tf.layers.reshape() function is used to Reshape an input to a certain shape.
Parameters: This function takes the args object as a parameter which can have the following properties:
- targetShape: It is a number which does not include the batch axis.
- inputShape: It is a number which is used to create an input layer to insert before this layer.
- batchInputShape: It is a number which is used to create an input layer to insert before this layer.
- batchSize: It is a number is used to construct the batchInputShape.
- dtype: data-type for this layer.
- name: It is a string for this layer.
- trainable: It is a boolean in which whether the weights of this layer are updatable by fit or not.
- weights: Initial weight values of the layer.
- inputDtype: It is for Legacy support. Do not use for new code.
Return value: It returns the reshape.
The below examples demonstrates the reshaping of layers using the tf.layers.reshape() function.
[null, 3, 9]
Example 2: In this example we are talking about the reshaping of layers.
[null, 4, 8]