Tensorflow.js tf.layers.stackedRNNCells() Function
Introduction: 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.
Tensorflow.js tf.layers.stackedRNNCells() function is used to stack the RNN cell and make them to behave as a single cell.
Parameters: Above method accepts the following parameter:
- args: This is an object type. It has the following fields:
- cells: It is an Array of instance RNNCell that should be stacked together.
- InputShape: It should be null or array of numbers. It is used to create the input layer which is inserted before this layer. It is used to input layer only.
- batchinputShape: It should be null of an array of numbers. It is used to create the input layer which is inserted before this layer. It has more priority than inputShape, so if batchinputShape is defined it is used for creating the input layer.
- batchSize: It should be a number. In case of absence of batchinputShape, It is used to create batchinputShape with InputShape Which will be [ batchSize, …inputSize ].
- dtype: It is the datatype for the input layer. Default data – type for this input layer is float32.
- name: It should be a string. It defines the name of the input layer.
- weights: It should be tensor. Which defines the initial weight value of the input layer.
- inputDtype: It should be data-type. It is used to support Legacy.
Returns: It returns an object (StackedRNNCells).
Example 1: In this example, we will see how simple RNNCells are stacked with tf.layers.stackedRNNCells() and work as single RNNCells:
Example 2: In this example, we will combine a number of cells into a stacked RNN cell with the help of stackedRNNCells and used to create RNN.
Shape of output should be in : [null,8,16]
Please Login to comment...